muze icon indicating copy to clipboard operation
muze copied to clipboard

Stack/Group by more than 1 dimension or measure

Open javichi opened this issue 4 years ago • 1 comments

Hi guys,

I'm checking Muze to integrate it with cube js REST API and it looks awesome so far.

The only thing I can't figure out is how to create charts stacked or grouped by more than 1 dimension or measure. All the examples I have seen so far group or stack by one single property (color)

This is a very important use case for us. For example:

measure 1: water from rain measure 2: water from sea

We would like to display a bar that stacks both measures and total is the sum of both.

Is this possible?

Thanks

javichi avatar Feb 15 '21 16:02 javichi

@javichi Currently, Muze does not support stacking by more than one dimension or measure. But, the example you have given, can be achieved using muze by tweaking the data a little bit. If we create a single measure, and a single dimension which contains the water source values, such as rain, sea, etc. Then we need to just pass that dimension in color encoding field. So, the data that will be passed to muze will look like,

water source region
120 rain us
300 sea us

Here, water is a measure and source, region is a dimension. Then, we need to pass the source field in color encoding,

   canvas.color('source')
      .rows(['water'])
      .columns(['region'])

ranajitbanerjee avatar Feb 20 '21 15:02 ranajitbanerjee