uwdata / vega

Vega Development Staging
https://vega.github.io/
BSD 3-Clause "New" or "Revised" License
58 stars 15 forks source link

Axis and Legends should be orderable within Marks #82

Closed marcprux closed 9 years ago

marcprux commented 9 years ago

If you want to have a bar chart's bars display behind the axis grid lines, but have textual annotations show up in front of the grid lines (lest they look weird), it isn't currently possible since the axis "layer" property can only be set to "front" or "back". I've always thought it would make the most sense to just include axes and legends in the marks array itself, thereby using the same ordering, but in lieu of that option, perhaps the "layer" property could also accept a number which would be used as the mark index where it would display (where 0 is the same as "front" and marks.count is the same as "back")

arvind commented 9 years ago

This use case can be expressed through an interleaving of group marks, one that contains the bars and another that contains the axes and text marks.

Axes and legends go through an additional parsing stage behind the scenes, and both the markup and scene graph representations are distinct from marks. As a result, I'm not inclined to merge these three areas of the specification language.

marcprux commented 9 years ago

The problem with interleaving the group marks is that you can't specify the text marks positional attributes as being relative the to the bar marks (a la the "grouped_bar" example "from": {"mark": "bars"}) if they are housed in a separate group. Perhaps the "layer" property could accept a mark name that it would use to place the axis/legend above.