rickshaw
rickshaw copied to clipboard
Disable Series on Start using Series.Toggle?
Hi. Is there a way to disable a series manually? I'd like to disable some series first and allow the user to enable them using Behavior.Series.Toggle Thanks
You can disable the series programmatically using graph.series[0].disable()
, replacing 0 with the desired series index.
While this will prevent the series from appearing, the corresponding element in the legend will still appear to be enabled. It doesn't seem like the Series.Toggle extension supports changing the class of legend elements programmatically, so you'd probably have to do it yourself (just find the element in the legend and add the 'disabled' class). For example, if you're using jQuery: $('.rickshaw_legend .line:nth-child(1)').addClass('disabled')
. See this function for details.
You could also submit a pull request to add support for this within Series.Toggle.
Disclaimer: not a Rickshaw maintainer
thanks, works perfectly fine!
I was able to do it with document.getElementsByClassName("label")[0].click();
Not the most elegant, but pretty simple.
For me the order of the legend and graph.series was different, so I used this:
$('.rickshaw_legend .label:contains("foo")').siblings('.action').click()