# Show/Hide line chart data series with button or switch - Dashboard 2.0

**URL:** <https://discourse.nodered.org/t/show-hide-line-chart-data-series-with-button-or-switch-dashboard-2-0/87089>\
**Category:** Dashboard\
**Tags:** dashboard-2\
**Created:** [8 April 2024 22:36 UTC](https://discourse.nodered.org/t/show-hide-line-chart-data-series-with-button-or-switch-dashboard-2-0/87089 "2024-04-08T22:36:03Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![MecatronicaMADE](https://avatars.discourse-cdn.com/v4/letter/m/ce7236/32.png) [@MecatronicaMADE](https://discourse.nodered.org/u/MecatronicaMADE)\
**Post date:** [8 April 2024 22:36 UTC](https://discourse.nodered.org/t/show-hide-line-chart-data-series-with-button-or-switch-dashboard-2-0/87089/1 "2024-04-08T22:36:03Z")

</div>

I know that it is possible to show/hide line chart data series by click on "legend".

But I want to ask you if Is there a way to hide/show line chart data series with a button or switch? I mean use a button to modify the property show/hide in line chart?

Thank you.

---

<div class="post-metadata">

**Author:** ![KarolisL](https://avatars.discourse-cdn.com/v4/letter/k/a4c791/32.png) [@KarolisL](https://discourse.nodered.org/u/KarolisL)\
**Post date:** [9 April 2024 05:47 UTC](https://discourse.nodered.org/t/show-hide-line-chart-data-series-with-button-or-switch-dashboard-2-0/87089/2 "2024-04-09T05:47:30Z")

</div>

May I suggest to use plotly: [Line charts in JavaScript](https://plotly.com/javascript/line-charts/)

I havent tested it on dashboard 2, but it works fine on dashboard

Examples:

> [@Plotly - example charts](https://discourse.nodered.org/t/plotly-example-charts/30697):
>
> I've been playing with Plotly for a few days, and have received a lot of kind support from @bakman2, so would like to share what I've got so far, in case anyone else is interested. The complete flow as attached below. The usual way to install a 3rd party script/library is to create a static folder, install & run the script/library from there. However, in these examples there is no need to do this, as plotly.js is being loaded using a CDN and a ui-template node. [flow] In all 3 examples, the …

---

<div class="post-metadata">

**Author:** ![Paul-Reed](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/paul-reed/32/66906_2.png) [@Paul-Reed](https://discourse.nodered.org/u/Paul-Reed)\
**Post date:** [9 April 2024 07:56 UTC](https://discourse.nodered.org/t/show-hide-line-chart-data-series-with-button-or-switch-dashboard-2-0/87089/3 "2024-04-09T07:56:40Z")

</div>

Where is the data coming from for the chart?  
If it's from a database, then try using buttons to inject different db queries into the chart node.

![weather](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/0/c/0cc58717233995476920d9ebcdbbbe8e69c5c019.gif)

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)\
**Post date:** [9 May 2024 07:56 UTC](https://discourse.nodered.org/t/show-hide-line-chart-data-series-with-button-or-switch-dashboard-2-0/87089/4 "2024-05-09T07:56:45Z")

</div>

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
