Method for hiding display of TimeSeries (SOLUTION)

59 views
Skip to first unread message

Chris Kosik

unread,
Jun 22, 2019, 4:27:58 AM6/22/19
to Smoothie Charts
Noticed there were some older questions regarding chart visibility/ Time-series visibility and workarounds.

Thought I would put my 2-cents in and throw what may be an obvious solution to some out there:

The previously answered solution regarding setting entire chart opacity to 0 to keep data ingesting is basically correct, no changes there.

However, I wanted to toggle the visibility of individual Time Series and you can achieve that by accessing and toggling Time Series disabled boolean.

From the smoothie.js source code:


function TimeSeries(options) {
this.options = Util.extend({}, TimeSeries.defaultOptions, options);
this.disabled = false;
this.clear();
}



Example:

function toggleChnl(channel){
if(channel.disabled == false){
channel.disabled = true;
console.log('turn invisible..');
}
else if(channel.disabled == true){
channel.disabled = false;
console.log('visible..');
}
}

Where channel = Time Series object (I call them channels for sensor streams in a system).

Application applies to a common usage of creating a toggle based legend of lots of Time Series lines.



Reply all
Reply to author
Forward
0 new messages