Skip to content
This repository has been archived by the owner on May 2, 2022. It is now read-only.

Stack/Group by more than 1 dimension or measure #284

Open
javichi opened this issue Feb 15, 2021 · 1 comment
Open

Stack/Group by more than 1 dimension or measure #284

javichi opened this issue Feb 15, 2021 · 1 comment
Assignees

Comments

@javichi
Copy link

javichi commented Feb 15, 2021

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

@ranajitbanerjee
Copy link
Member

@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'])

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants