Gave Chart Component access to CMS table

we have chart component, and v9.0 also have cms which collection feature supports many data types including number.
how about allowing chart component to use cms collection(s) as it’s dataset

That’s an interesting idea. Can you give an example of the type of data you would be displaying on your chart? Is this mainly to make use of the CSV import in the CMS?

1 Like

yes and no, it is mainly to use the CMS Collection it self, so whether one import it from csv, or write it directly on BSS it should work the same;

generaly speaking, I would like chart component to treat the CMS collection dataset to be a pseudo API for it(the chart) to render;

something like this:

“name”; “struct”; “anthenas”; “location”
“tower 1”; “tower-1”; 12; “east side”
“tower 4”; “tower-4”; 9; “new town”
“tower 6”; “tower-6”; 3; “farm land”
“tower 2”; “tower-2”; 24; “new town”
“tower 12”; “tower-12”; 6; “old east side”

or any dataset which ussually being sent from server, csv’ed flattened json REST API.
bassically to turn CMS collection as local pseudo csv resource API before export/publish;

problem is perhaps simple statistic like sum, count, etc, I don’t think BSS need to handle that(for dev time memory efficiency), and should be push to chart.js on runtime, which still require BSS to feed the correct dataset to chart js correct attribute/data-attribute name;

*Alternative for js developer
allows dev to add specific CMS Collection data to settings → design → meta tags on specific page


perhaps as JSON-LD, which then can be used via javascript runtime;

One issue that I see is that the CMS is evaluated during export only. The collections are not available at runtime. So your chart will be updated when exporting, but remain with stale data after this. Maybe what you need is to script the chart with JS instead so it is updated from your api live?

if this means it’s not available on dev server, than that’s certainly a problem since I cannot test it without exporting…

my use case doesn’t realy have problem with stale data. BSS is an SSG after all and not a CRUD app.I can just treat BSS(as in the desktop app) as the dashboard admin manager.

I’m fine with scripting(with js to render the data to chartJS on my own without the chart component) it on my own, as long as I can have the actual same data on the time of export.

how about adding placeholder file on Design → Javascript

as to prevent name collision, the .cms.json are for the actual dataset, as for .cms.mjs are for versioning to correctly fetch the .cms.json

then again it become a problem if the CMS collection is not available on the dev server.

if it became too complicated to implement you can just forget this idea @martin… the feature is definitely a nice to have but not a deal breaker in any way…