Dear all,
I am struggling to translate this vertical stacked bar chart to the HighCharts equivalent:
The underlying data has three fields:
- Group by index 0: MetricAggregation (calculated field that either results in countries or cities)
- Group by index 1: MetricType (cooling, electricity, etc.)
- Value index 0 (total 2): MetricValueUnitConverted (numeric value)
The best that I came up with is this (sorry, I can only apparently embed 1 screenshot
): Vertical bar chart without stacking. Bars are next to each other.
However, there is no stacking yet and due to missing values in the water category (null value for one row), the bars don’t match the x-axis (tooltip correctly states Switzerland, but the column is shown at South Africa).
This is the underlying JSON configuration:
{
"xAxis": {"categories": ["getColumn", 0]},
"yAxis": { "title": { "text": null } },
"series": [
"map",
[
"unique", ["getColumn", 1]
],
{
"type": "column",
"name": ["item", 1],
"stack": ["item", 0],
"data": [
"map",
[
"filter",
["getColumn", 0, 1, 2],
["==", ["get", ["item"], 1], ["item", 2]]
],
[
["get", ["item"], 0],
["get", ["item"], 2]
]
]
}
],
"legend": { "enabled": true }
}
I know that “stack”: [“item”, 0] is wrong, but I do not know how to loop over the unique entries in getColumn=1 [these would be cooling, electricity, etc.] and the unique entries in getColumn=0 [equivalent to countries or cities, basically the x-axis labels].
Regarding the mismatch shown above for Switzerland / South Africa: I tried to change the result of the data mapping to be a dictionary defining x and y as follows. However, doing so does not render anything besides the legend.
{
"x": ["get", ["item"], 0],
"y": ["get", ["item"], 2]
}
Your support is very much appreciated!
Thanks in advance,
Thomas


