The solution is:
This is taken from the ChartJS GitHub.
You set the new value and then use the ChartJS API to update the chart to hide the ones you have toggled off. If you wanted to toggle them again you just do the reverse.
//Hide chart.getDatasetMeta(1).hidden=true; chart.update(); //Show chart.getDatasetMeta(1).hidden=false; chart.update();
Here's an example in JSFiddle.
- hide dataset by default using Chart.js and a custom script
- I am using chart js to draw a chart. I did everything right but i don't know why the x axis and y axis label is not comming in chart. code below
- How to save Chart JS charts as image without black background using blobs and filesaver?
- Chart.js bar chart : Grid color and hide label
- How to hide the y axis and x axis line and label in my bar chart for chart.js
- Adding custom text to Bar Chart label values using Chart.js
- Chart JS dataset disabled by default
- How to draw a needle on a custom donut chart and add datapoints to the needle?
- How to create a gantt chart using Chart.js and populate dates?
- Create Chart using Reactjs Chartjs and axios
- Configure Pie Chart Colors Using Chart.js and PHP
- Using chart js options with react-chartjs-2 and typescript
- Using chart js version 3, how to add custom data to external tooltip?
- How to draw outer labels for polar chart using ng2-charts and chart.js at fixed positions outside the rings?
- Issue while plotting bar chart with custom x-axis with month and year in chart.js
- Grouped Bar Chart from mySQL database using ChartJS and PHP
- How to export a chart in Excel and PDF format using Chart.js
- Text inside Doughnut chart using Chart.js and Angular2, Ionic2
- How to update a chart using VueJS and ChartJS
- Labels (category type) on left and right of bar chart using chart.js?
- Custom label from using separate array in Chart JS
- How to change default label of each bubble in bubble chart using chartjs-plugin-datalabels
- How to plot chart from external JSON and format X-AXIS to show time using Chart.JS?
- Flask Socketio | Update and plot a chart using background tasks created by Flask Executor or ThreadPoolExecutor
- Printing Chart using ngPrint and tc-chartjs
- create Chart using Chartjs and PHP
- how to increase space between legend and chart in chartjs (ng2charts ) using angular
- Chart, X and Y-Axis labels are blurred in horizontal bar chart using chart.js
- My chart won`t live update - done in Chart.js and Java Script
- Can't Draw Horizontal Line on Graph Using ChartJS Annotation Plugin and Primevue Chart
More Query from same tag
- How to remove grid on chart.js
- Can I specify a different font size for each row of text in Chart Title?
- Unable to update state in ReactJS
- How to hide Chart.js data labels for small screens
- why Graph is not showing until i minimize window. (using chart.js )
- zingchart heatmap not show all hours on y axes
- chart.js bar chart datalabel vanishes on hovering over chart
- Parsing an unnamed JSON array into React component
- Time series data visualization using JSON
- Adding Chart.js line chart to Jinja2/Flask html page from JS file
- How to destroy chart object in order to change chart data dynamically (Chart.js)?
- Rendering Chart.js Bubble Chart Using Array Data
- How to update Chartjs chart (react-chartjs-2) with dynamic data?
- How to install Chart.js in Laravel? ("Uncaught ReferenceError: Chart is not defined")
- Chart js pie chart not showing dynamic data using JSON
- Chart.js hidden property
- How can I have different values for the chart and the tooltip in chart.js?
- Chart.js and PHP
- How to put images/ charts into table?
- Chart.js create line graph using dates in the x-axis that reflect real time intervals (not evenly distributed)
- Chartsjs update datasets with dropdown
- angular-charts.js doesnt work with ionic
- [Vue warn]: Error in mounted hook: "TypeError: this.$refs.canvas is undefined"
- Draw points and lines inside a bar in bar chart
- Change chartType onclick ChartJS
- How to fix bars in Chart.js with long labels
- How to export report as PDF/CSV in ChartNew.js
- How to get access to Chart instance related to current tooltip callback in Chart.js
- Why is my Line Chart not displaying (Chart.JS)?