Multiple axis [BOUNTY $100]
Is there a way to have multiple axis at one side of a chart? If not, do you plan to have this option in a newer release?
any news on this?
+1
This is a serious game-stopper for me. I have checked the current branch that @wikunia made, but as it is based on an older version I'm afraid that doesn't work. Would it be possible for someone knowing a lot of the new structure to refactor the code into a doubleline-block for the new Chart.js?
I saw this discussion: https://github.com/nnnick/Chart.js/pull/220 ending in 'please rewrite', but couldn't you (@fulldecent ) or maybe @nnnick give a hand here?
Currently looking at this, can anyone comment on the following idea to quickly implement this.
- change the this.scale to an array containing a scale per dataset
- add a scale for each dataset
- use the right scale per set
I have made a proof-of-concept, which doesn't yet include drawing the scales themselves here: https://github.com/NanneHuiges/Chart.js/tree/feature/MultipleYAxis
the Chart.MultiAxisLine.js is a copy of Chart.Line.js, easiest way to review would probably to look at a diff with that file. I have made a gist of that and you can view it here:
https://cdn.rawgit.com/NanneHuiges/1490655646edd4a6944f/raw/bdbfd0bac471594f5f0eff0a1be3d191ee69fd2e/chart.js.diff.html
I have made some minor improvements. The axis-of choice is now a property of a dataset. Currently each dataset gets the next axis number, but this makes it ready to add the axis-of-choice for each dataset. This way you can have several datasets with the same axis.
The main feature that is missing is drawing of the scales: currently only the first scale gets drawn. If someone could take a look as how to add that functionality I'd be thankfull.
- branch: https://github.com/NanneHuiges/Chart.js/tree/feature/MultipleYAxis
- diff with the Chart.line.js (as it is heavily based on that file)
example:

I have added a 'right scale' feature, but for some reason the text gets rendered very ugly. The rendering is fine until a certain cutoff point. I've made the padding a bit smaller in this example, so you can see the effect:

I'd really like someone who knows more about canvas to take a quick peak.
(another todo is update/redraw I think, as I haven't checked that out yet).
I have yet again changed some things. labels now live on the left, you can select what axis get labels and which get strokes. Still hopeing on some interest here.
@NanneHuiges, thanks it works great, would love to see it pulled into the official repo.
:+1:
+:100:
+1
+1 to have this merged in sooner than later!
+0.5, the current version from NanneHuiges seems to break the legend and the axis on the same side look kind of ugly
+1
@nnnick will you ever merge this pr?
+1
Not sure wether or not we want this in the core
Why?
Enviado pelo meu Windows Phone
From: Jakemailto:[email protected] Sent: 29/12/2014 18:14 To: nnnick/Chart.jsmailto:[email protected] Cc: Luís Rudgemailto:[email protected] Subject: Re: [Chart.js] Multiple axis (#17)
Not sure wether or not we want this in the core
Reply to this email directly or view it on GitHub: https://github.com/nnnick/Chart.js/issues/17#issuecomment-68298109
@jakesyl I feel like this would be a good feature in the future, but it's definitely needs some sort of discussion first. For example, is there a limit of 2 axes? are you allowed unlimited axes? how do we handle grid lines for multiple axes? Do the 0 points always line up?
+1 Definitely interested in this, even if it was just an extension