a chart (be it a bar chart or a line chart, probably others too) has more than one dimension along its x-axis (e.g. time + category) and one dimension (e.g. count) along its y-axis,
then
data points are not attributed to their correct position along the x-axis when they come after data points with an implicit value of 0
Steps to reproduce
Use the following query to have a data set:
SELECT 1 AS COUNT,
'Apple' AS fruit,
'Monday' AS day
UNION ALL SELECT 3 AS COUNT,
'Apple' AS fruit,
'Tuesday' AS day
UNION ALL SELECT 3 AS COUNT,
'Orange' AS fruit,
'Tuesday' AS day
Create a bar chart for this data set with
day and fruit on its x-axis
count on its y-axis
Expected results
The expectation is clear: There should be
1 bar for Monday for Apple with a height of 1
2 bars for Tuesday for Apple and Orange with a height of 3 each
Actual results
There are:
2 bars for Monday
one for Apple with a height of 1 ✅
one for Orange with a height of 3 ❌ This is Tuesday's data
1 bar for Tuesday for Apple with a height of 3 ✅
It seems that the framework just starts painting the data points starting at the earliest opportunity possible
Workaround
This issue can be worked around by adjusting the query to artificially introduce data points with value 0 in all places where there is an implicit 0 value, where possible. This however makes queries more complex and may not work in all cases.
For the example above this means:
SELECT 1 AS COUNT,
'Apple' AS fruit,
'Monday' AS day
UNION ALL SELECT 0 AS COUNT,
'Orange' AS fruit,
'Monday' AS day
UNION ALL SELECT 3 AS COUNT,
'Apple' AS fruit,
'Tuesday' AS day
UNION ALL SELECT 3 AS COUNT,
'Orange' AS fruit,
'Tuesday' AS day
Issue description
When
then
Steps to reproduce
Use the following query to have a data set:
Create a bar chart for this data set with
day
andfruit
on its x-axiscount
on its y-axisExpected results
The expectation is clear: There should be
Actual results
There are:
It seems that the framework just starts painting the data points starting at the earliest opportunity possible
Workaround
This issue can be worked around by adjusting the query to artificially introduce data points with value 0 in all places where there is an implicit 0 value, where possible. This however makes queries more complex and may not work in all cases.
For the example above this means:
would not exhibit the issue: