Reputation: 12365
I'm trying to create a bar grouped bar chart for time series data. There are 2 series, sampled at the same interval. The stacked bar chart looks like this:
Code: Vega lite editor code
Now, instead of stacking them, I like to create a grouped bar chart as described in the docs:
The xOffset parameter doesn't seem to like the temporal axis, though:
The bars are on top of each other instead of next to each other: Adapted code
Any tips on how to solve this?
Upvotes: 1
Views: 201
Reputation: 30174
You have too many data points. Adding the timeunit:month achieves this:
"x": {
"field": "date",
"type": "temporal", "timeUnit": "month",
"title": null,
"axis": {"labelAngle": -70},
"sort": null
},
Or this:
"x": {
"field": "date",
"type": "temporal",
"timeUnit": "month",
"title": null,
"axis": {
"tickCount": 8,
"labelAlign": "left",
"labelExpr": "[timeFormat(datum.value, '%b'), timeFormat(datum.value, '%m') == '01' ? timeFormat(datum.value, '%Y') : '']",
"labelOffset": 4,
"labelPadding": -24,
"tickSize": 30
},
"sort": null
},
Upvotes: 1