score:12
Accepted answer
Well you can use the below code. So that, Y Axes of your bar chart starts from zero.
options: {
scales : {
yAxes : [{
ticks : {
beginAtZero : true
}
}]
}
}
[Sample-Code]
var ctx = document.getElementById("myChart1");
var data = {
labels: ["January", "February", "March", "April", "May", "June", "July"],
datasets: [
{
label: "My First dataset",
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,
data: [65, 59, 80, 81, 56, 55, 40],
}
]
};
var myBarChart = new Chart(ctx, {
type: 'bar',
data: data,
options: {
scales : {
yAxes : [{
ticks : {
beginAtZero : true
}
}]
}
}
});
Source: stackoverflow.com
Related Query
- Chart.js axes always show zero
- how to only show zero grid axes at center and hide all other gridlines in chart js
- Chart JS: Always show tooltips in a multi dataset line chart
- Want to show small part of js Bar Chart when value is zero
- Always show doughnut Chart tooltip in Angular 5
- Chart js always show labels on a doughnut chart
- Charts.js v2: always show custom (html) tooltips on chart
- How to always show line chart tooltip in ionic-angular.?
- Chart.js Show labels on Pie chart
- chart.js: Show labels outside pie chart
- Chart.js how to show cursor pointer for labels & legends in line chart
- Show bar with zero value in ChartJs v2
- show label in tooltip but not in x axis for chartjs line chart
- chartjs show dot point on hover over line chart
- Chart JS Show HTML in Tooltip
- chart js tooltip how to control the data that show
- How to show percentage (%) in chart js
- Show X axis on top and bottom in line chart rendered with Chart.js 2.4.0
- Chart looks only grey, does not show the color - Chartjs,discordjs
- Chart JS show multiple data points for the same label
- how to always show label in chartjs without mouseover?
- Show data dynamically in line chart - ChartJS
- Chartjs - show elements in all datasets on hover using bar chart
- Chart js data to start at zero
- Remove the label and show only value in tooltips of a bar chart
- Chart Js Show the old data on mouse hover
- ChartJS: Show all labels of a mixed chart in the tooltip
- ChartJS:align zeros on chart with multi axes
- Show all values in Chart js y axis
- PrimeNg bar chart how to show a label for the y-axis
More Query from same tag
- Add rectangle fill to line chart
- How can i do so that my chartjs updates everytime data is inserted or by time interval?
- Can't render multiple responsive canvas graphs in different tabs
- charts.js not updating after ajax request
- How do I refresh data from json-file with charts.js?
- Chart.js render in hidden Bootsrap tab
- Error: Failed to create chart: can't acquire context from the given item
- ChartJS in React throws 'too may re-renders'
- charts labels and data with php arrays
- pie chart label undefined ionic 3
- Add horizontal Line to my chart.js Barchart
- Problem creating scatter graph using chart.js
- How to use log scale with Chart Kick?
- Can't figure out how to skip first datapoint on the x-axis and labels on X-axis skip second-to-last datapoint with Chart.js
- Loop through multiple rows as labels and data in chart.js and PHP
- chart.js chart distorted with fixed width
- ChartJS Line Charts - remove color underneath lines
- Chart.js 2.1.2 Bar Chart Animation Issue
- Chart.js legend customisation
- Is there any way to change the font color and size of labels in Chartjs 3.0.0
- Automatic label updates
- Pass variable from function js to other function js
- Radar charts for chartjs always stay filled
- Chart.Js - Background Bar in Chart Bar
- How to remove the line/rule of an axis in Chart.js?
- How can I change the starting point of horizontal bars in Charts.js
- Problem with saving data in array o Angular and Typescript
- Options: plugins not functioning
- How to put indicator between yAxis values on yAxis chartJs?
- Creating charts dynamically using ChartJS and AngularJS