Quartz / Chartbuilder

A front-end charting application that facilitates easy creation of simple beautiful charts
http://quartz.github.io/Chartbuilder
MIT License
2.1k stars 354 forks source link

Scales on the left. #187

Open ghost opened 9 years ago

ghost commented 9 years ago

Hi, is there a good reason (and I'm sure there is) I wouldn't want to default my scales to the right?

nsonnad commented 9 years ago

I'd say this is mostly personal preference. You could make the argument that, since most charts will be read left-to-right, left-scales help make sure people know the magnitudes before reading. At the same time, you could argue this way for putting them on the right, since you want people to know the value of the final/recent data point.

Would say it's up to you based on aesthetics. We have also tried to make the scale settings pretty abstract, namely it asks for primaryScale and secondaryScale versus left and right, so it should be configurable to make right the default.

ghost commented 9 years ago

Thanks. I might try to get it right-aligned. I looked around - where does it specify that primaryScale is left-aligned? I can't seem to find it.

yanofsky commented 9 years ago

I'm not sure how well we've tested this, but the default axis locations are defined here https://github.com/Quartz/Chartbuilder/blob/dadc6f99649b10927b961d2d255b36033d05f8b4/src/js/charts/cb-xy/draw-xy.js#L64-L67

For the record, I'm on team right axis first.

ghost commented 9 years ago

Yes, I'm team right axis first too.

I've swapped this around and it seems to ignore my instruction. It also brings up a console error if you try and force all axes to be right-hand side.: "Uncaught TypeError: Cannot read property 'ticks' of undefined"

I tried playing around with the mixin but it clearly yearns for left-hand axis first. Any suggestions?

yanofsky commented 8 years ago

So I'm having a bit of a hard time convincing myself that we should "fix" this or whether we should just remove the (broken) feature entirely.

Where it stands right now: The branch referenced above kinda closes this issue. It gives a way to define primary as either left or right that works (although not in a DRY way at the moment) however if you switch off default left-as-primary the chart will look broken, because that change requires changes to the default margin, padding, and post-render axis adjustments.

Of course, picking which side the axis should be on first is a nice option to have but the amount of customization needed to make it work properly out of the box makes it feel like it's something that is best left to someone in the midsts of creating a custom xy chart type for their organization.

Anyone have any thoughts on how we should proceed on this?

ghost commented 8 years ago

Hi, I tend to agree with you. It's probably not worth the effort to fix and make a default to the right-hand side. An alternative would be to have an option to show the exact number of the final datapoint on the right-hand side? Ed.