obsidian-charts icon indicating copy to clipboard operation
obsidian-charts copied to clipboard

Ability to add `hidden: true` to a chart codeblock

Open holroy opened this issue 1 year ago • 0 comments

Describe the feature

I would like the ability to hide some of the datasets by default when using a chart codeblock, similar to what can be done using the javascript variant.

So to extend the default line chart example, I would like for the following to work:

```chart  
type: line  
labels: [Monday,Tuesday,Wednesday,Thursday,Friday]
series:  
  - title: Title 1  
    hidden: true
    data: [1,2,3,4,5]  
  - title: Title 2
    data: [5,4,3,2,1]
  - title: Title 3  
    data: [8,2,5,-1,4]  
```

And that this displays as a default display of the example after clicking on the first title icon to hide it: image

Does this fix a problem? If so, specify.

It's not so much a problem, as an inconvenience if one want to include data for multiple various datasets readily available for display, but not displayed from the start.

Did you consider other alternatives?

It can be solved if using a javascript variant to render the chart, as shown in this Obsidian forum thread, by utilising the hidden: true feature of the underlying chart.js library, so I reckon it shouldn't be too hard to implement. Also see https://www.chartjs.org/docs/latest/api/interfaces/ControllerDatasetOptions.html#hidden for original definition of the variable, and how it propagates into multiple other DatasetOption variants.

I've also tried moving the hidden: true statement around in the codeblock definition, but I could not get it to trigger in the places I've tried. Please do prove me wrong, if this in indeed is already possible, and I've just not found the correct way to enter it.

Screenshots and recordings

No response

holroy avatar Mar 30 '23 10:03 holroy