Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Custome label y axis #147

Closed
whitehorse0 opened this issue Jul 16, 2017 · 2 comments
Closed

Custome label y axis #147

whitehorse0 opened this issue Jul 16, 2017 · 2 comments

Comments

@whitehorse0
Copy link

whitehorse0 commented Jul 16, 2017

Expected Behavior

Hi sir, i want to ask is it possible to custom scales yAxis ticks label?

Actual Behavior

.....
ummm, if I want the scales yAxis ticks to be a value with percentage or dollar $. Is it possible?

many thank you, sir

@claide
Copy link

claide commented Jul 17, 2017

Yes tried that by inserting this option inside your yAxes.

ticks: {
   callback: function(label, index, labels) {
	 return '$'+label/1000; // just change the '$' to % for percentage
   }
}

@apertureless
Copy link
Owner

Yep like @claide said,
you have to create a custom callback for the xAxis ticks in your options object and pass it.

http://www.chartjs.org/docs/latest/axes/labelling.html#creating-custom-tick-formats

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants