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

Using Percent Sign in Scale #3549

Closed
simonferndriger opened this issue Nov 4, 2016 · 5 comments
Closed

Using Percent Sign in Scale #3549

simonferndriger opened this issue Nov 4, 2016 · 5 comments

Comments

@simonferndriger
Copy link

This is either a bug report or feature request, depending on the answer to this problem.

I looked up the documentation to use the % in my y-scale. There is a link/reference to http://www.chartjs.org/docs/#scale-title-configuration
Unfortunately, there is no content under this address.

So, someone, please tell me how to do this with the current version (since all examples I found on StackOverflow don't work anymore).

Thank you!

@etimberg
Copy link
Member

etimberg commented Nov 4, 2016

@simonferndriger this is a bug in the documentation that that link doesn't work. If you search in the page, the section exists though.

Are you wanting the '%' on each tick mark or on the axis title?

@simonferndriger
Copy link
Author

Both would work for me. However, on each tick would be my first choice!

@etimberg
Copy link
Member

etimberg commented Nov 4, 2016

@simonferndriger you can do

options: {
  scales: {
    yAxes: [{
      ticks: {
        callback: function(tick) {
          return tick.toString() + '%';
        }
      }
    }]
  }
}

@simonferndriger
Copy link
Author

simonferndriger commented Nov 7, 2016

@etimberg Thanks! It works :) However, I would have thought that there could be a more intuitive way to do something rather common like this (choosing the scale unit), but it's fine for me.

@etimberg
Copy link
Member

Fixed in #3751

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

2 participants