Behaviour SwRS-MDOKFSTUDIO-DIAG-123
Charts are drawn as themed SVG pictures with errors in place
When the page draws a Vega-Lite or Vega chart, it SHALL replace the specification text with one SVG image whose background, text, axis and mark colours follow the preview theme, and show the error message in place of the chart when the specification is invalid.
Step 3 of path 1 in StRS-MDOKFSTUDIO-DIAG-015: from “The chart is drawn in the colours of the page” to “”.
Scenarios 3
The situations the tests check; open one to read it.
nominalA chart is drawn as a themed picture
Givena page with a Vega-Lite chart and a Vega chart in the Cream theme
Whenthe chart runtime has run
Theneach chart element holds one img of the class myst-vega-image whose source is an SVG data URI (max-width 100%, centred), data-render-state is rendered, the axis text and title use the foreground of the page, the marks use the link colour of the page, the background is transparent and the font is the page font
nominalA theme change draws again
Givencharts drawn in the light theme
Whenthe page background and foreground change to a dark theme
Theneach chart is drawn again with the new colours
refusalAn invalid specification
Givena chart whose text is not valid JSON or YAML, or that Vega-Lite or Vega rejects
Whenthe page draws it
Thendata-render-state is error and the chart shows one paragraph Unable to render the chart with a details section holding the reason as plain text, the document is unchanged and the Chart source section still shows the text
| Input | Outcome |
|---|---|
| JSON or YAML specification | the same chart |
| an image mark with a url | refused with a message; data:image pictures are drawn |