score:0
the problem is that you invoke update()
on the chartdata
object but not on the chart instance. the chartdata
object does not have an update()
function.
how to get a reference to the chart.js instance is explained here.
below code fragments illustrate what needs to be changed in your code to solve your problem.
constructor() {
...
this.chartreference = react.createref();
}
componentdidmount() {
this.chart = this.chartreference.current.chartinstance;
...
}
adddata(chart) {
...
this.chart.update(); // instead of chart.update();
}
removedata(chart) {
...
this.chart.update(); // instead of chart.update();
}
render() {
return (
...
<bar
ref={this.chartreference}
...
/>
...
);
}
Source: stackoverflow.com
Related Query
- Chart.js update function (chart,labels,data) will not update the chart
- angular-chartjs line chart TypeError: t.merge is not a function
- Annotation events not update the chart
- code works fine on jsfiddle but one function is not working on website
- Chart.js not resorting rows based on plugin after using update function
- Angular-Charts bar chart does not update when I change the data, series, labels
- $scope variable do not respond to the onClick function of angular chart
- Destroying chart.js is not working when chart created inside function - chart.destroy() is not a function
- Chart.js: chart does not update
- Primeng line chart not updating automatically,only update on window refresh
- ChartJS, updating chart type does not update xAxis properly
- Chart.js chart in vue.js component does not update
- Can not update bar chart values in Chart.js 2.0.0 alpha3
- 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
- My Chartjs is not updating after setstate full code attached Reactjs Update
- chartjs line graph destroy function is not clearing the old chart instances
- chart.js update is not a function
- How to constantly update y axis using a C# function to update a Live (Streaming) Chart.js Chart in ASP.NET core Web Application Razor Pages
- e.labels.map is not a function when creating a chart with chart.js
- how to not repeat code while creating multiple charts in chart js
- Chart.update is not a function typeError
- Dynamically update values of a chartjs chart
- ReferenceError: Chart is not defined - chartjs
- Chart.js: bar chart first bar and last bar not displaying in full
- Dynamically update the options of a chart in chartjs using Javascript
- Chart.js responsive option - Chart not filling container
- show label in tooltip but not in x axis for chartjs line chart
- using vue-chartjs in vue 3 : createElement is not a function
- Html chart does not fit a small Android WebView
- Chart.js ng2-charts colors in pie chart not showing
More Query from same tag
- Two data sets with different time instances on the same ChartJs chart
- Chart.js - hide / remove label on second dataset
- How to disable converting decimal number to exponential?
- Labeling and Data (ChartJS)
- Execute onClick function on Custom Legend
- chartjs - multi axis line chart - cannot read property 'min' of undefined
- Chartjs draw line chart where line go back and forth (by chronological order)
- "Maximum call stack size" Error When Adding Data to Chartjs Using Props With Fetch (Vue/Chartjs)
- Dynamically creating graphs with jQuery
- How to render default values from Django Serializer for charting purposes?
- How to catch an onClick event on bubble chart?
- Show all values in Chart js y axis
- ChartJS:align zeros on chart with multi axes
- How can i do so that my chartjs updates everytime data is inserted or by time interval?
- how to insert dynamic data from sql into chartjs stacked bar chart javascript
- How can I move a label left, paint it black, or remove it (Chart.JS)?
- Vue chartjs is not rendering from API
- How To Match Left and Right Tick Intervals with Chartjs
- Chart.js: Combined Line and Bar Data
- chartjs: trying to rotate the y-Axis label
- Chart.js How to sum the values in a pie chart and display them in the header
- flask altering python list
- Add shadow Chart.js
- Remove radar chart labels in chart.js
- How to append more data in tooltip of graph in chart.js
- Chart.js PolarArea Chart. Changing the labels to a 45 degree angle
- Chart.js how to show cursor pointer for labels & legends in line chart
- Chart.js doughnut animate/draw clockwise
- How to destroy chart object in order to change chart data dynamically (Chart.js)?
- [Vue warn]: Error in mounted hook: "TypeError: this.$refs.canvas is undefined"