score:2
it looks like you are using chart.js v1 instead of v2.
first, update your the chart.js code to v2, preferably the latest version.
then, change the following code:
var bargraph = new chart(ctx, {
type: 'bar',
data: chartdata
options: options
});
to:
var bargraph = chart.bar(ctx, {
data: chartdata,
options: options
});
beginatzero: true
should then work as expected.
working jsfiddle: https://jsfiddle.net/ko54hp6n/
for an alternative to beginatzero: true
, you can also use the min: 0
ticks configuration option to start the bar axis at zero:
var options = {
scales: {
yaxes: [{
ticks: {
min: 0
}
}]
}
}
working jsfiddle: https://jsfiddle.net/ko54hp6n/1/
Source: stackoverflow.com
Related Query
- Chart.js Radar chart legend label font size doesn't work
- How do I put this on Real-Time? I already put (async: True) but it doesnt work
- Options beginAtZero doesn't work in angular-chart.js
- Minimum value for x Axis doesn't work for horizontal bar chart | ChartJS
- Line chart doesn't work with type time chart.js
- Charts.js scales yaxes ticks min max doesnt work
- Code doesn't work after updating chart.js versioning
- Chart.js beginAtZero doesn't work
- Chart.js v3 - beginAtZero does nothing to my chart
- Chart.js : Controller for Scatter chart doesn't work for draw function
- I cant get Legend to work for my chartjs donut chart
- fill: 'origin' property does not work for my chart
- JavaScript implementation doesnt work (Chart.js)
- what is wrong with my code ? java script chart position
- How to print a chart rendered by code
- Ng2 charts - Animation doesn't work on line chart onInit
- VueJS + Chartjs - Chart only renders after code change
- How do I destroy/update Chart Data in this chart.js code example?
- Chartjs Overlap click function doesnt work
- Chart JS Custom Labels don't work
- 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
- Background color does not work when trying to create my data before using scatter chart with chart.js
- Getting the HTML code of a chart created by chart.js
- How to run Chart.js samples using source code
- beginAtZero not working on mixed chart
- angular-charts.js doesnt work with ionic
- ChartJs doesn't work on a local downloaded page of Circular Gauge chart example
- everything i put in the options of the Line charts doesnt work
- how to not repeat code while creating multiple charts in chart js
More Query from same tag
- Enabling chartsJS bar chart to start on y axis
- Making my website interactive with the size of the screen/browser
- Loop to create lines for graph chartjs
- Chartjs! How to remove datalabel when value is 0
- Change the color of the legend box and the color of the x grid lines in chart.js
- ChartNew.js - Remove/Hide zero label from Pie Chart
- How to change position from absolute to relative in charts in ChartJS
- Combine Chart.js programmatic and legend based dataset toggling
- Chart.js - how to disable everything on hover
- change space between horizontal (grid) lines for line chart
- Chartjs : Remove specific labels
- Calling data from search bar to chart.js graph in Angular
- ChartJS Arrays Acting as One Item
- ChartJS Annotations display custom label
- ReactJs: componentWillReceiveProps doesn't get called for component whose redux action gets dispatched last
- custom label title for scatter in React-ChartJS-2
- Showing 'undefined%' in the graph if data does not exist
- Uncaught TypeError: Cannot read property 'format' of undefined
- Get access to the chart.js component instance in React
- Chart.js - Getting data from HTML
- I have a issue with chart.js, php and infomix database?
- Define backgroundColor from data in chartJS
- Update a chart dynamically with socket.io in real time
- How to hide row in chartJS when filtering?
- Chart content not getting displayed in ionic
- How can I cause a legend to appear to the right of the pie (Chart.JS)?
- ChartJS Recreate Chart
- Remove Angularjs-Chart border and reduce chart arc thickness
- Keep chart.js doughnut with fixed width and height centered in container
- Chart.js - How to Add Text in the label of the Chart with JavaScript?