Package com.inductiveautomation.perspective.common.config.charts


@NullMarked package com.inductiveautomation.perspective.common.config.charts
Server-side model for canvas-chart (ECharts) styling.

Canvas charts are styled by fetching ECharts theme JSON from the gateway at runtime — there is no bundled client-side default. This package owns the shape of a chart style resource and the bundled style content that ships with the module.

How the pieces fit

  • CanvasChartStyleConfig is one chart style: the ECharts theme JSON plus the Perspective themes it claims. Each is its own gateway-scoped resource — one directory, one config.json — registered through the platform configuration framework in perspective-gateway and edited in the Gateway web UI, so one set of styles applies across every project. The theme JSON is stored verbatim: exactly the object echarts.registerTheme consumes, never reshaped.
  • ChartStyleUtil holds the bundled light/dark style content and the by-name fallback used when no configured style claims a theme.

Data flow

The gateway serves style JSON over the content-hashed, immutably-cached routes /canvas-chart-styles/style/:name/:hash/style.json (a style by name) and /canvas-chart-styles/theme/:name/:hash/style.json (the style assigned to a Perspective theme); the frontend (useChartStyle) fetches one and registers it with ECharts. A freshly-loaded session receives the current style hash on its project-load response and resolves its chart style once from that hash — there is no live propagation to running sessions. An author's edit only affects sessions loaded (or reloaded) after the edit.

Ownership

This package defines the resource shape and the bundled content (under resources/canvas-chart-styles/) only. Registration, seeding, resolution, serving, and hashing all live in perspective-gateway's charts package; resolution in particular needs the resource collection, which is gateway-only.