score:8
Accepted answer
you can just use the method adddata()
, example:
bar.adddata([40, 60], "google");
working example - http://jsbin.com/kalilayohu/1/
score:4
this is the code
var canvas = document.getelementbyid('mychart');
var mybarchart = chart.bar(canvas,{
data:{
labels: ["january", "february", "march", "april", "may", "june", "july"],
datasets: [
{
label: "my first dataset",
data: [65, 59, 80, 81, 56, 55, 40],
backgroundcolor: [
'rgba(255, 99, 132, 0.2)',
'rgba(54, 162, 235, 0.2)',
'rgba(255, 206, 86, 0.2)',
'rgba(75, 192, 192, 0.2)',
'rgba(153, 102, 255, 0.2)',
'rgba(255, 159, 64, 0.2)'
],
bordercolor: [
'rgba(255,99,132,1)',
'rgba(54, 162, 235, 1)',
'rgba(255, 206, 86, 1)',
'rgba(75, 192, 192, 1)',
'rgba(153, 102, 255, 1)',
'rgba(255, 159, 64, 1)'
],
borderwidth: 1
}
]
},
options:{
scales: {
yaxes:[{
stacked:true,
gridlines: {
display:true,
color:"rgba(255,99,132,0.2)"
}
}],
xaxes:[{
gridlines: {
display:false
}
}]
}
}
});
you can update doing this:
mybarchart.data.datasets[0].data[4] = 50;//this update the value of may
mybarchart.update();
Source: stackoverflow.com
Related Query
- Updating chart.js bar graph in real time
- Real time colored bar chart
- Chart.js Dynamically Updating Chart with X Axis Time
- Chartjs real time graph x axis movement
- Chart js space above bar graph
- Chart.js Date and Time Bar Chart Not Rendering - Line Works Though
- Display Bar chart values in the graph - ChartJS
- chart js - bar chart with time scale on Y axis in Hours and Minutes
- How to use Real time chart in react?
- Chart js Bar Time Chart
- ChartJS not showing data for time series bar chart
- ChartJS line chart or bar graph from a Java program
- Chart.js bar chart with time on X axis and category on Y axis is not rendered
- Dynamically updating time data in chart.js freezes the chart
- How can I reduce the spacing between my legend and chart proper in my Chart.JS bar chart, and increase it in the graph area?
- ng-charts not updating labels when chart data is updated at same time
- real time scrolling based chart with chart.js
- Adding vertical and horizontal scroll to Chart js Bar graph
- The real time chart sometimes does not display when I switch the target
- Display data at ends of floating bar graph (created using chart js)
- ChartJS Bar chart with time scale - Bars overlap with each other
- Chart Js , loading data on selection but bar graph displaying old values as well on hovering
- ChartJS: Is this horizontal stacked bar and line graph multiaxis chart even possible?
- Combo bar chart graph line gets obscured by bars
- Update a chart dynamically with socket.io in real time
- How to change bar color on a angular-chart and chart js bar graph with multiple datasets?
- How can i get the Chart JS Bar Graph Bar Label and Value on click?
- Creating a real time line chart using chartjs and firebase realtime db
- Chart.js create line graph using dates in the x-axis that reflect real time intervals (not evenly distributed)
- Chart for Real time data with duplicate x axis
More Query from same tag
- How can I create a time series line graph in chart.js?
- Vue-chartjs not rendering chart until page resize
- hide labels and 0 values in chart.js?
- Can't pass data to chart.js graph
- ChartJS - Adding legend title into tooltip title
- Chart.js doughnut-like radar chart (no anglelines in the center/empty center)
- ChartJS timeline graph with events
- ChartJS line chart or bar graph from a Java program
- How to center bars on x-axis of Chart.js bar graph?
- Angular ASP.NET Core Chart.js bug on chart rebuild when filtering the list of values
- Exponential decrease
- how can i use inline plugin inner title for chart js?
- My chart is not shown on browser screen using chart.js in meteor
- Chartjs - display radarchart lines from center to corner value
- How can I get two stacked chart.js charts to be different types?
- Two independent time axes in Chart.js
- How to create chart.js vertical bar chat with rounded corners in angular 6?
- Bubbling mouse event to parent canvas that is of chart.js
- Chartjs v2.7 - combo chart with time-series (financial) data; bar width's are irregular
- Wrong display of xAxes in Chartjs
- How to fix page layout with embedded frame
- How can i launch a modal after clicking each bar in Bar chart in Chartjs and also how can i get its data?
- How to change the color of the bar in barchart if the data is negative - Angular Charts
- How to use custom rendering methods of chartJs through ng2-charts angular?
- I need to increase data in a bar chart by one with a button click
- Date range picker and chart js
- The dataset for bar graph is not set properly using ng2 charts and ng5-slider in Angular
- Dynamically update the options of a chart in chartjs using Javascript
- How to set prop data for chart.js in React?
- Create multiple pie chart simultaneously using chart.js