Vue-chartjs: Implementing of the "begin-zero" option

Created on 27 Nov 2017  路  6Comments  路  Source: apertureless/vue-chartjs

Expected Behavior

When I have some positive data I want to see zero value on values axis:

Actual Behavior

image

Use HorizontalBar in this way:
<vue-horizontal-bar-chart :chart-data="ordersChartData" :beginzero="true"></vue-horizontal-bar-chart>

Environment

  • vue.js version: "^2.5.8"
  • vue-chart.js version: "^3.0.2"
  • npm version: "5.5.1"

Most helpful comment

@icangku @AndreaRylander
you have to put it in the y or x axis option
see this post

https://github.com/apertureless/vue-chartjs/issues/272#issuecomment-349903067

All 6 comments

I don't really get the problem.
Why don't you pass just the

ticks: {
  beginAtZero: true
 },

to your options?

@apertureless sorry, it is my mistake, I just forgot pass the begin zero option like a property of the ticks object and done it in this way:

options: {
   responsive: false,
   beginAtZero: true
}

and I was confused by result. Thank you for help. Close the issue.

I did something like this,

<bar-chart :chart-data="barData" :height="100" :options="{responsive: false, maintainAspectRatio: false, ticks : {beginAtZero : true}}"></bar-chart>

But it goes for nothing, help me please

I have the same problem. I have tried
:options="{maintainAspectRatio: false, ticks : {beginAtZero : true}}"
and
:options="{maintainAspectRatio: false, beginAtZero : true}"
but the y-axis still starts at the value of the lowest data point. How can I get it to start at zero?

@icangku @AndreaRylander
you have to put it in the y or x axis option
see this post

https://github.com/apertureless/vue-chartjs/issues/272#issuecomment-349903067

@miguel-rod Yes, I tried and it worked, thank you!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

egorzekov picture egorzekov  路  4Comments

Sykomaniac picture Sykomaniac  路  3Comments

sylvaincaillot picture sylvaincaillot  路  3Comments

sergeynilov picture sergeynilov  路  3Comments

bdeanindy picture bdeanindy  路  3Comments