score:1
i've had similar issues with .clear() and .destroy()
what worked for me:
completely remove and replace the
<canvas>
element
score:2
destroy() works fine for me, check this code.
if (window.mydoughnut)
window.mydoughnut.destroy();
var ctx = $elm.getcontext("2d");
window.mydoughnut = new chart(ctx).doughnutalt(value, {showscale: true, scaleshowlabels: true, animation: false});
score:6
try this:
before binding data , remove the canvas too ;)
html:
<div id="divchartcontainer"></div>
script:
$('#divchartcontainer').empty();
$('#divchartcontainer').append('<canvas id="canvas"></canvas>');
var ctx = document.getelementbyid("canvas").getcontext("2d");
var mylinechart = new chart(ctx).bar(barchartdata, {
responsive: true,
barvaluespacing: 10,
barstrokewidth: 0,
scaleshowlabels: true,
scaleshowgridlines: true,
scalegridlinecolor: "rgba(0,0,0,.05)",
scalegridlinewidth: 1,
});
issue solved !!
Source: stackoverflow.com
Related Query
- Chart.js: Dynamic Changing of Chart Type (Line to Bar as Example)
- Create multiple dynamic stacked chart using chart.js in Angular 10?
- ChartJS bar chart fixed width for dynamic data sets
- chart js with angular2 loading dynamic data only after zoomin
- Chart JS dynamic chart
- Chart JS Dynamic number of datasets
- Dynamic line chart with chart.js and PHP
- Using two JSON objects to make Chart.JS Bar Chart Dynamic in Typescript / Angular
- How to make dynamic chart using Vue component with chart-js
- Chartjs dynamic chart return both x & y axis undefined
- Make chartjs pie chart wiyh dynamic data
- How to make dynamic chart js using JSON in Codeigniter?
- Dynamic data in bar chart not rendering React js
- Multiple dynamic vertical lines on a chart with Chart.js
- Issue While Passing Dynamic Datas in React Chart Js 2
- Chart JS not working with Dynamic Data
- How to put dynamic colors for pie chart - chart js
- ChartJS dynamic line chart ghosting back to old data when hovered on
- How to create a dynamic multi-line chart in chart.js
- what is wrong with my code ? java script chart position
- How to print a chart rendered by code
- VueJS + Chartjs - Chart only renders after code change
- how to insert dynamic data from sql into chartjs stacked bar chart javascript
- How do I destroy/update Chart Data in this chart.js code example?
- Dynamic information in chart.js radar chart
- getting additional value fields from data source for dx.chartjs doughnut chart
- 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
- Dynamic js chart display problems
- How to update Chartjs chart (react-chartjs-2) with dynamic data?
- Dynamic Chart in PHP using Chart js
More Query from same tag
- How to add several labels to the same set of data in chartjs?
- Array of objects condensed into array of unique objects with nested array
- Chart.js: Chaing Font Color and Size not working
- Draw a horizontal and vertical line on mouse hover in chart js
- jquery - How to update line chart.js with multiple datasets
- Adding trendlines to existing chart Chart.js
- in line chart, line is going beyond height when I remove y axis
- Why I don't see the second plot?
- Chart js - Line chart cuts border for lines in boundaries
- chart.js switch x/y axis on line chart
- Primefaces charts replaced by chartJS?
- Error with Chart.js : TypeError: t is undefined
- Horizontal 'limit' line in Chart.js
- Increase gap between line-chart and legend ChartJS
- ChartJS and Ajax calls
- Place Text in Chart-Canvas Area in ChartJS
- Chart.js line chart with area range
- How can I add shadow color below the line in chart.js charts?
- Dynamic Chart Data
- Chart.js not displaying in box
- How can I display the xAxes and yAxes data in the tooltip, Chart JS?
- How can I hide tick marks on Chart.js?
- Javascript get JSON into arrays, combine and use elsewhere
- ChartJs - Doughnut Chart - how to remove labels if percentage is less than a limit
- ChartJs x axis labels on waterfall chart
- Unable to plot JSON to chartJS
- A chart Js error issue are occured in my Laravel other page?
- Update only Chart.js without animations and without refreshing the browser
- Angular Chartjs error TS2304: Cannot find name OffscreenCanvasRenderingContext2D
- chart.js not allowing y axis steps with logarithmic scale