score:1
you can use the api method getchart
to see if it exists. if it does not exist it will return undefined, if it does exist it will return that chart.
so you would get:
const tmpchart = chart.getchart('canvasid');
if (tmpchart) {
tmpchart.destroy()
}
Source: stackoverflow.com
Related Query
- How to remove old chart and append new chart to div using chartjs
- How to update a chart using VueJS and ChartJS
- How to add new data point and remove leftmost data point dynamically in Chartjs
- how to increase space between legend and chart in chartjs (ng2charts ) using angular
- Update Chart JS data dynamically and add new data, remove old data to create timeline "like" chart
- how to remove old data from Chart js on mouse hover using mvc c#?
- How to add vertical line in bar chart using chartJs and ng2-charts?
- How to save Chart JS charts as image without black background using blobs and filesaver?
- how to change background in chartjs and remove background lines?
- How to access labels array using chart plugin (Chart.pluginService.register) in Chartjs 2.x?
- How to remove gridlines and grid labels in Chartjs Radar?
- ChartJs - Pie Chart - how to remove labels that are on the pie chart
- ChartJS (React) Line Chart - How to show single tooltip with data and labels from 3 (multiple) dataset?
- How to create a gantt chart using Chart.js and populate dates?
- Create Chart using Reactjs Chartjs and axios
- How to draw outer labels for polar chart using ng2-charts and chart.js at fixed positions outside the rings?
- Grouped Bar Chart from mySQL database using ChartJS and PHP
- how to put a y-axis and x-axis label while using html and chartjs
- How to export a chart in Excel and PDF format using Chart.js
- How to display chart using Chartjs with JSON data in Laravel
- How to remove or color line/grid in polar chart area using Chart.js?
- How to highlight single bar in bar chart using Chartjs
- How to plot chart from external JSON and format X-AXIS to show time using Chart.JS?
- create Chart using Chartjs and PHP
- How to reuse a Chartjs Chart component in with different Data and get past the **Canvas is already in use** error?
- How to get Data from API to display chart using chartjs in Vuejs
- How to take a set of Date objects and display the frequency based on time of day using ChartJS
- How to destroy a canvas using Id and add new canvas to the same id
- How to get the data attribute of the canvas chart created using chartjs
- ChartJS remove previous chart when making new one
More Query from same tag
- Chart js - Line chart - How to hide the data label on the line?
- How to adjust the Js Chart's label?
- Chart.js displays the label in a weird font in IE8
- ReferenceError: Chart is not defined - chartjs
- create legend from colors saved in const
- How to change the position of the tooltip for the Bar type chart in Chart.Js
- attempting to destroy previous graph on canvas
- In ChartJS how do I change the color of a label in the legend?
- Chart not displaying on page load
- Hovering over line chart shows old chart data issue in chart.js
- How to conserve user setting for hidden dataset for update?
- Installing chartjs in project without npm, bower or CDN
- Do not draw line on condition in ChartJS line chart
- Set backgroundColor of bar-char (chart.js)
- Need help adding decimals to yaxis values
- Chart.js bar chart mouse hovering highlights all the datasets instead of just the selected one
- Chart.js set global point size not working
- ChartJS version 3 how to add percentage to pie chart tooltip
- Angular data visualisation using chart.js
- Set background color for individual bars using ChartJS?
- Line chart issue. Chart JS
- How can I set the category height of a horizontalBar chart?
- How to address type errors when removing data with chart.js?
- Chart.js line graph change x axis seperation
- how to use chartJS to show breakdown of selected data
- Add Horizontal crosshairs using Chart.js
- Chart.js how to increase segments size to be more evenly distributed
- Setting min and max values chart.js
- chart.js bar chart change color based on value
- Code for Chartjs Typescript definition file