Brunel-Visualization / Brunel

Brunel Visualization
Apache License 2.0
291 stars 77 forks source link

Multipe Charts Per Column #228

Open GraemeHutcheon opened 7 years ago

GraemeHutcheon commented 7 years ago

We often create a chart per variable e.g. A Batch can be of multiple Wafers and Wafers can be of different Technologies I would create a chart Per Technology so that the data on each chart is comparable Can this be done today with Brunel ?

grahamwills commented 7 years ago

Yes, but the caveat is that you would need to explicitly set the axes for each chart so they have the same range, as otherwise Brunel will auto fit them.

Here is a base example of one chart per variable:

data('sample:US States.csv') x(region) y(latitude) | x(region) y(longitude)

When you try this, you see the y axes are not comparable, so to make this work, you'd need to do this

data('sample:US States.csv') x(region) y(latitude:[-160,70]) | x(region) y(longitude:[-160,70])

GraemeHutcheon commented 7 years ago

Close but I think it was my explanation was not clear ... What if the data is vertical and a column LABEL has the Variable name in it - 'longitude' and 'latitude' - and I want a chart for each - I don;t want to know what all those labels are - we tend to work with a lot of vertical data.

data('sample:US States.csv') x(region) y(y) chartby(LABEL)

and it would spit out two charts one for longitude and the other for latitude

grahamwills commented 7 years ago

Ok, got it. This is a feature we have wanted for a while. We term it 'faceting' and other teams can call it "small multiples" or sometimes "trellis plots"

A lot of the details for it are quite tricky -- specifying the styles and layouts for the "inner charts" as well as axes and whether or not to have the scales consistent across charts or varying per chart.

Our approach is going to be to define an outer element -- the main chart -- that sets up the spaces into which the little charts would be drawn. Something like: data('sample:US States.csv') bar x(LABEL) and that would allow you to specify axes, horizontal or vertical layouts, use two fields -- lots of options with the standard syntax.

THEN (and this is the fun part) we would add a second chart to be inserted into each of the elements of the main chart (the inner one), filtering its data to match the data in that space. So something like this: data('sample:US States.csv') bar x(LABEL) > x(region) y(y)

Again, you would then get complete control over the display in this inner level.

So the bad news is ... not ready yet. The good news is; we are working on it. This following does something close to what you want:

data('sample:US States.csv') x(region) style(".element{opacity:0.1} line,path {visibility:hidden}") axes(x:'') split(#count) > data('sample:US States.csv') x(latitude) y(longitude) axes(x,y)

note all the extra annoying fiddly code we'll make optional later. But it basically works. The two main major bits of work we need to fix are: (1) also allowing ">>" to work which will say to make the axes for each inner chart independent of each other, not fixed at the same value, and (2) better layout and fixing some issues with the scales.

So, this new feature is on the way, and you're request has bumped it up the priority table!