GitHub user rluech edited a discussion: How can I force a chart to show the 
complete set of possible levels along an axis/dimension?

How can I force a chart to show the complete set of possible levels along an 
axis/dimension?

Let's say I have a barchart with four bars on the x-axis. When data is filtered 
for a specific user the chart collapses to one bar because the other three 
levels do not appear in the users data subset. 
This doesent look great. I want the chart to always show the four possible 
levels.

query result from full dataset:

| Axis | Value |
| ----------- | ----------- |
| A | 20 |
| B | 70  |
| C | 30 |

query result from filtered subset:

| Axis | Value |
| ----------- | ----------- |
| A | 7 |

For now I achieve this by producing a dataset with SQL-Lab for those charts.
- Simple table: A left join of query data to the four levels form DUAL (Oracle).
- Filterabel table: Pivot / unpivot the query data if the dataset should 
contain other filter variables.

| Axis | Value |
| ----------- | ----------- |
| A | 7 |
| B | NULL |
| C | NULL |

| Filter1 | Filter2 | Axis | Value |
| ----------- | ----------- | ----------- | ----------- |
| Date | foo  | A | 7 |
| Date | foo  | B | NULL |
| Date | foo  | C | NULL |
| Date | bar | A | NULL |
| Date | bar | B | 3|
| Date | bar | C | NULL |
| ... | ... | ... | ... |

Is there more efficient way to achieve this?
- In R or Python there is a data type factor and categorical respectively that 
solve this problem. 
  By tabulating factor and categorical, the full set of possible labels is 
displayed. 
- There is the ENUM data type on some DBs but it does not behave like factors 
as far as I know.
- Another way could be to use custom echarts with fixed levels along an axis or 
dimension.

What is the intended solution by apache superset/preset?











GitHub link: https://github.com/apache/superset/discussions/29267

----
This is an automatically sent email for [email protected].
To unsubscribe, please send an email to: 
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to