Record Class CanvasChartStyleConfig

java.lang.Object
java.lang.Record
com.inductiveautomation.perspective.common.config.charts.CanvasChartStyleConfig
Record Components:
style - the raw ECharts theme object, in the shape echarts.registerTheme consumes. Stored verbatim so no rendering path has to reshape it.
themes - the Perspective session theme names this style claims.
previewBackgroundColor - the CSS color for the backdrop behind the style drawer's preview pane in the Gateway web UI, so an author can check contrast. Held outside style so it cannot leak into the ECharts theme; null leaves the preview on its default backdrop.

public record CanvasChartStyleConfig(com.inductiveautomation.ignition.common.gson.JsonObject style, List<String> themes, @Nullable String previewBackgroundColor) extends Record
One canvas chart style: the ECharts theme a chart renders with, plus the metadata the Perspective Gateway web UI needs to list and preview it.

Each style is its own gateway-scoped resource under RESOURCE_TYPE, shared by every project on the gateway. The resource name is the style's display name and the resource's documentation is its author-facing description, so neither is a field here.

A style is reachable by resource name — what a page author's chartStyle property names directly — and by themes() membership, which is how a session's plain theme property finds one. Resolution needs the resource collection, so it lives gateway-side in CanvasChartStyleManager; only the bundled content lives here, in ChartStyleUtil.

The bundled light and dark styles are non-overridable resources in the platform's system collection, so the configuration framework itself rejects any edit to them. To depart from one, copy it under a new name and assign the copy the theme.

  • Field Details

    • RESOURCE_TYPE

      public static final ResourceType RESOURCE_TYPE
  • Constructor Details

    • CanvasChartStyleConfig

      public CanvasChartStyleConfig(com.inductiveautomation.ignition.common.gson.JsonObject style, List<String> themes, @Nullable String previewBackgroundColor)
      Normalizes the non-@Nullable fields so no caller has to null-check them. Gson populates records reflectively and leaves a field null when the JSON omits it, so this runs on every decode, not just on the constructor calls in this codebase.
  • Method Details

    • toString

      public final String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared with Objects::equals(Object,Object).
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • style

      public com.inductiveautomation.ignition.common.gson.JsonObject style()
      Returns the value of the style record component.
      Returns:
      the value of the style record component
    • themes

      public List<String> themes()
      Returns the value of the themes record component.
      Returns:
      the value of the themes record component
    • previewBackgroundColor

      public @Nullable String previewBackgroundColor()
      Returns the value of the previewBackgroundColor record component.
      Returns:
      the value of the previewBackgroundColor record component