metricsgraphics / metrics-graphics

A library optimized for concise and principled data graphics and layouts.
http://metricsgraphicsjs.org
7.45k stars 474 forks source link

Design and implement a solution for ordinal y axes #537

Open dwithnall opened 9 years ago

dwithnall commented 9 years ago

Howdy,

I'm trying to generate a chart with text values on the Y axis and time on the X (The Y axis represents physical locations separated by distance). I believe this is supported in the underlying D3 library (ordinal axis), but the only examples I've seen online do it for the X axis.

My data has been generated in a way which scales the Y value appropriately, I am just unsure if it is possible (or how) to replace the auto generated Y axis with one containing text labels. Any advice you can provide would be appreciated.

Kind regards,

Dave

brylie commented 9 years ago

What type of chart are you wanting to make? E.g. bar?

dwithnall commented 9 years ago

Sorry, you'd think that putting the obvious information into the initial question would be an obvious thing to do.

I'm trying to use a multiple line chart.

Something along the lines of this

http://www.wyongmodelrailwayclub.com/wp-content/uploads/2013/11/TimeTable.jpg

Time is along the X axis, with the locations along the Y.

However I want the locations to be scaled based on the distance between them. For example

1 = Location 1 5 = Location 2 6 = Location 3 7.5 = Location 4

D.


Sent from a mobile device. Please excuse any mistakes in spelling or grammar due to missed autocorrect.

What type of chart are you wanting to make? E.g. bar?

— Reply to this email directly or view it on GitHub https://github.com/mozilla/metrics-graphics/issues/537#issuecomment-152501353 .

brylie commented 9 years ago

@dwithnall do you have some example code online? E.g. in bl.ocks.org?

hamilton commented 9 years ago

Hi @dwithnall! Thanks for the issue. This would indeed be useful (and is on our horizon), but is not implemented quite yet. Someone had a somewhat-similar issue (#264) though yours deals with ordinal Y and not simply discrete. We do plan on implementing this case at some point, but have some refactoring to do first which we've been putting off.

At any rate, a custom axis-labeling (which is easily done with the current functionality) and a custom tick-declaring (don't think this is implemented - @almossawi do you know?) would do the trick.

brylie commented 9 years ago

Somewhat relevant: check out the D3.js recreation of E.J. Marey’s graphical train schedule.

brylie commented 9 years ago

Also, you might be interested to read Visualizing MBTA Data - An interactive exploration of Boston's subway system.

dwithnall commented 9 years ago

You are all awesome.

Thanks a lot for the information, it is extremely helpful. That MBTA visualization is very impressive.

I have been exploring creating the chart directly in D3 as I am going to require a level of customization and interactivity that will probably require rebuilding half of MetricsGraphics anyway.

Thanks again.

D.

On 3/11/2015 9:33 PM, Brylie Christopher Oxley wrote:

Also, you might be interested to read Visualizing MBTA Data - An interactive exploration of Boston's subway system http://mbtaviz.github.io/.

— Reply to this email directly or view it on GitHub https://github.com/mozilla/metrics-graphics/issues/537#issuecomment-153325929.