Reputation: 541
I'm moving Chart.js from version 1.x to 2.0.x and I'm stuck at this problem.
As you can see in the image below, I'm trying to display some value distributed over age brackets. At the moment there is no data, but I still want the chart to be displayed. The value that I'm willing to display will be positive integer, so the chart displayed is misleading.
example json:
{
"labels":[
"18-24",
"25-34",
"35-44",
"45-54",
"55-64",
"65+"
],
"datasets":[
{
"label":"example 1",
"data":[]
}
]
}
My question is, how can I set minimal bar value to be at 0?
Upvotes: 0
Views: 255
Reputation: 541
well, ok, this was less obvious solution than I could find for ver. 1.0.x
but anyway, here's the options JSON that helped me
chart = new Chart(ctx, {
type: 'bar',
data: data,
options: {
scales: {
yAxes: [{
ticks: {
suggestedMin: 0
}
}]
}
}
});
and that I found under: http://www.chartjs.org/docs/#scales
Upvotes: 1