Hiding series in charts

Issue #537 resolved
Ben Earner created an issue

When plotting a series per system it can be time consuming to whittle down to the show only the series you want. Would it be possible to have a “hide series” button, so the series can then be switched on as needed?

@dplatten has some suggested code that seems to work nicely:

<a onclick="$($('#histogramAcquisitionPlotDLPdiv').highcharts().series).each(function(){this.hide()})" class="btn btn-default btn-sm" role="button">Hide all series</a>
<a onclick="$($('#histogramAcquisitionPlotDLPdiv').highcharts().series).each(function(){this.show()})" class="btn btn-default btn-sm" role="button">Show all series</a>
<a onclick="$($('#histogramAcquisitionPlotDLPdiv').highcharts().series).each(function(){if (this.visible) {this.hide();} else {this.show()}})" class="btn btn-default btn-sm" role="button">Toggle all series</a>

Comments (18)

  1. Ed McDonagh

    Add hide/show series buttons

    For all histogram charts a hide, show and toggle button is added to selectively hide/show/toggle all series. "Toggle Series" sets the unselected series to be activated and selected series to be deactivated. References issue #537.

    → <<cset 1e13d59cdad0>>

  2. David Platten

    @edmcdonagh and @bearner, it should be easy enough to hide the buttons if there's only one series being plotted. I'll put some code together and commit it.

  3. David Platten

    Changed CT filtered page to only show Hide, Show and Toggle series buttons if there is more than one series on the chart. Also implemented code so that only one of the Hide all or Show all buttons is showing at any one time. Also moved a couple of duplicate JavaScript functions to a file. References issue #537 and #536

    → <<cset d91da62cbabf>>

  4. David Platten

    @edmcdonagh and @bearner, http://testing.openrem.org has my changes live. I've only updated the code on the CT page. If you plot a chart with "Plot a series per system" unchecked then the "Hide the series" buttons are not displayed at all. If you check the "Plot a series per system" box then you will see the "Hide the series" buttons.

    Let me know what you think.

    As an aside, you have to choose "Mean" rather than "Median" as the median database function isn't working on the test site.

  5. Ben Earner reporter

    It looks good to me when playing around with it. The buttons are there when you need them, but not distracting when you don't want to/can't use them. Very neat!

  6. David Platten

    Thanks for the comments Ben. I'll make similar changes to the other filtered pages and commit them too.

  7. David Platten

    The visibility of the new Hide..., Show... and Toggle... series buttons are now changed as appropriate when a user drills down to histograms. References issue #537

    → <<cset daf0f97436f1>>

  8. Log in to comment