Chartist-js: Add option that allows reversing or inverting line charts

Created on 14 Jul 2015  Â·  8Comments  Â·  Source: gionkunz/chartist-js

I cannot find an option in the documentation where the numbering on a line graph can be reversed so that it is ascending instead of descending.

enhancement

Most helpful comment

This is not possible with simple configuration. However, you could transfrom the data into negative values and configure the labelInterpolationFnc to display the positive value again. This kind of mimics a inverted chart.

http://jsbin.com/xoqulakite/edit?js,console,output

All 8 comments

I was wanting to do this too. Would be great

By numbering you mean the value scale that goes down vs. up right?

Yes that's correct.
On Jul 28, 2015 5:16 AM, "Gion Kunz" [email protected] wrote:

By numbering you mean the value scale that goes down vs. up right?

—
Reply to this email directly or view it on GitHub
https://github.com/gionkunz/chartist-js/issues/382#issuecomment-125516053
.

This is not possible with simple configuration. However, you could transfrom the data into negative values and configure the labelInterpolationFnc to display the positive value again. This kind of mimics a inverted chart.

http://jsbin.com/xoqulakite/edit?js,console,output

Awesome, that worked perfectly for me! Thanks so much!

This really should be in the docs somewhere. It's very valuable and I almost ditched the library til I saw this thread.

The approach that @gionkunz provided is simple and elegant, and it works perfect, thanks a lot!
And I also agreed with what @philmccarty said; Instead of leaving it in the issue, this should be placed somewhere in the docs. It will be helpful for those people like me, who is trying to make a ranking chart like https://github.com/gionkunz/chartist-js/issues/556.

showArea: true doesn't work with inverted chart like described in example. Is there a workaround?

Was this page helpful?
0 / 5 - 0 ratings