StaticChart#

Server-rendered chart wrapper. <static-chart> fetches a base64-encoded SVG from a JSON endpoint and renders it as an <img>. Use it for charts that are produced on the server (matplotlib pipeline) rather than as interactive Highcharts charts. The <loading> overlay is shown for the duration of each fetch.

The endpoint must return {"status": true, "data": "<base64-encoded SVG>"}. The component embeds that payload as a data:image/svg+xml;base64,... URL.

Range buttons#

The header above the chart shows six built-in range buttons. Clicking one sets the date_from form value to the corresponding moment and re-fetches:

  • 1m – 1 month back

  • 3m – 3 months back

  • 6m – 6 months back

  • 9m – 9 months back

  • YTD – start of current year

  • 1y – 1 year back

The chosen range is sent to the endpoint as date_from=YYYY-MM-DD.

Date-range form#

When hasForm is true, the component also renders two <input type="date"> fields (dateFrom and dateTo). Changing either triggers an immediate re-fetch with both values posted as date_from / date_to.

Component accepts following params:

  • url (required) – JSON endpoint that returns {"status": true, "data": "<base64 SVG>"}.

  • hasForm – Boolean flag; when true, renders the date-range form alongside the range buttons (default false).