Chart Serie(s) off by default

  • 2
  • Question
  • Updated 1 year ago
  • Answered
Hello,

Would there be a way to turn off 1 or more series by default from a chart without clicking?

Example I have Serie 1, Serie 2 and Serie 3.

And I want the Serie 1 to be 'Off by default" while displaying Serie 2 and 3

And when the need arise, I could click on Serie 1 manually to add it to chart


Thank you,
Photo of Dave

Dave

  • 5,538 Points 5k badge 2x thumb

Posted 3 years ago

  • 2
Photo of Erik Wahlberg

Erik Wahlberg

  • 2,156 Points 2k badge 2x thumb
Actually encountered an issue like this in the past but I think my work around may be primitive in regards to what you're trying to achieve.

I create a dummy model for most pages so that I can render visualizations & things in/out of view. For instance, clicking the button "Display By Owner" updates a field in dummy model to 1, and the chart that has the series by owner is set to render when that field in dummy model is 1. And the "Display by Rep" basically does the inverse action (while replacing the other chart). 

So what if you created two charts, one with series 1-2 and the other series 1-3. By default display the series 1-2. Add a button above chart that updates ______ field in your dummy model, which then triggers conditional rendering of series 1-2 out and conditionally renders series 1-3 in. 
Photo of Rob Hatch

Rob Hatch, Official Rep

  • 44,006 Points 20k badge 2x thumb
Erik's answer is interesting.  But you can also do this with just one chart. 

Each Series can be a separate model.
Set each model to not load data on page load.
On your page - Add a button for each model that has the "query model" action. 
Add a second button for each model that has the "remove all rows" action. 

Conditionally render these buttons so only one shows (based on the presense or absense of model data)

So then...

On page load your chart will be blank. 
When you click the "add series 1" button it will appear in the chart.  (same for series 2 and 3 and 4...)
When you click the "remove series 1" button it will disappear from the chart. 

There you go. 
Photo of Jack Sanford

Jack Sanford, Champion

  • 8,322 Points 5k badge 2x thumb
I think there must be a better solution to this. You can click on a series in the chart and it disables. I've seen High Charts implementations elsewhere where a series is disabled by default. There's a way to code for that, and it would be great if Skuid implemented that into the visualization component so you could declaratively decide whether to show it or not.