Chart.js icon indicating copy to clipboard operation
Chart.js copied to clipboard

Multiple axis [BOUNTY $100]

Open AuspeXeu opened this issue 13 years ago • 59 comments

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?

AuspeXeu avatar Mar 18 '13 15:03 AuspeXeu

any news on this?

luisrudge avatar Sep 15 '14 16:09 luisrudge

+1

gustavomonarin avatar Sep 28 '14 10:09 gustavomonarin

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?

NanneHuiges avatar Sep 30 '14 07:09 NanneHuiges

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

NanneHuiges avatar Sep 30 '14 11:09 NanneHuiges

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: image

NanneHuiges avatar Oct 01 '14 07:10 NanneHuiges

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:

image

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).

NanneHuiges avatar Oct 01 '14 15:10 NanneHuiges

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 avatar Oct 06 '14 09:10 NanneHuiges

@NanneHuiges, thanks it works great, would love to see it pulled into the official repo.

Duffcase avatar Oct 12 '14 17:10 Duffcase

:+1:

outrunthewolf avatar Oct 29 '14 13:10 outrunthewolf

+:100:

derekperkins avatar Nov 06 '14 22:11 derekperkins

+1

jtomasrl avatar Nov 07 '14 18:11 jtomasrl

+1 to have this merged in sooner than later!

danteoh avatar Nov 20 '14 21:11 danteoh

+0.5, the current version from NanneHuiges seems to break the legend and the axis on the same side look kind of ugly

danst0 avatar Nov 23 '14 13:11 danst0

+1

toytonic avatar Nov 25 '14 16:11 toytonic

@nnnick will you ever merge this pr?

luisrudge avatar Nov 25 '14 16:11 luisrudge

+1

tomwayson avatar Dec 23 '14 06:12 tomwayson

Not sure wether or not we want this in the core

jakesylvestre avatar Dec 29 '14 20:12 jakesylvestre

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

luisrudge avatar Dec 29 '14 20:12 luisrudge

@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?

etimberg avatar Dec 29 '14 20:12 etimberg

+1 Definitely interested in this, even if it was just an extension

aaronstaves avatar Jan 21 '15 16:01 aaronstaves