Class ChartStyleUtil
java.lang.Object
com.inductiveautomation.perspective.common.config.charts.util.ChartStyleUtil
The canvas chart styles that ship with the module, and the fallback used when nothing else
matches.
The source of truth for bundled style content, read two ways:
CanvasChartStyleManagerseedsBUNDLED_STYLE_NAMESinto the platform'ssystemcollection at startup viabundledConfig(String), making each one an ordinary resource the Gateway web UI and REST API can read.getDefaultStyleJson(String)answers a request for a theme no configured style claims, so a custom Perspective theme still renders sensibly before anyone authors a style for it.
Resolving a name against the configured styles needs the resource collection, which
only the gateway has; see CanvasChartStyleManager#getStyleJsonByName and
CanvasChartStyleManager#getStyleJsonForTheme.
DEFAULT_LIGHT and DEFAULT_DARK are mutable process-wide statics: treat what
getDefaultStyleJson(String) returns as read-only. bundledConfig(String) deep-copies for you.
-
Field Summary
FieldsModifier and TypeFieldDescriptionResource names of the styles bundled with the module, in the order they should be seeded.static final Stringstatic final com.inductiveautomation.ignition.common.gson.JsonObjectBundled dark ECharts theme JSON, read once from the classpath at class init.static final com.inductiveautomation.ignition.common.gson.JsonObjectBundled light ECharts theme JSON, read once from the classpath at class init.static final String -
Method Summary
Modifier and TypeMethodDescriptionstatic CanvasChartStyleConfigbundledConfig(String name) Builds the full config for a bundled style, ready to be encoded into a resource.static StringbundledDescription(String name) Author-facing description for a bundled style, stored as the resource's documentation rather than in its config.static com.inductiveautomation.ignition.common.gson.JsonObjectgetDefaultStyleJson(@Nullable String themeName) Returns the bundled default forthemeName: the dark style when the name contains"dark", the light style otherwise.
-
Field Details
-
LIGHT
- See Also:
-
DARK
- See Also:
-
BUNDLED_STYLE_NAMES
-
DEFAULT_LIGHT
public static final com.inductiveautomation.ignition.common.gson.JsonObject DEFAULT_LIGHTBundled light ECharts theme JSON, read once from the classpath at class init. -
DEFAULT_DARK
public static final com.inductiveautomation.ignition.common.gson.JsonObject DEFAULT_DARKBundled dark ECharts theme JSON, read once from the classpath at class init.
-
-
Method Details
-
bundledConfig
Builds the full config for a bundled style, ready to be encoded into a resource.- Parameters:
name- one ofBUNDLED_STYLE_NAMES.- Throws:
IllegalArgumentException- ifnameis not a bundled style.
-
bundledDescription
Author-facing description for a bundled style, stored as the resource's documentation rather than in its config.- Parameters:
name- one ofBUNDLED_STYLE_NAMES.- Throws:
IllegalArgumentException- ifnameis not a bundled style.
-
getDefaultStyleJson
public static com.inductiveautomation.ignition.common.gson.JsonObject getDefaultStyleJson(@Nullable String themeName) Returns the bundled default forthemeName: the dark style when the name contains"dark", the light style otherwise. The returned object is shared — treat it as read-only.
-