'Plot data with week numbers on the x-axis in AMChart5
I'm a bit lost here while using AMCharts5. There are just too many configuration parameters. So, let's assume the following data series:
{
date: new Date(2021, 0, 5).getTime(),
value: 156
},
{
date: new Date(2021, 0, 6).getTime(),
value: 33
},
one sample per day DEMO
My question is about the labels on the X axis. In that demo its shows the days, 01/01, 01/02, etc. But what I would like to have is: week 1, week 2, etc. So we need data grouping (I think). I tried the following
// Create X-Axis
let xAxis = chart.xAxes.push(
am5xy.DateAxis.new(root, {
groupData: true,
baseInterval: { timeUnit: "week", count: 7 },
renderer: am5xy.AxisRendererX.new(root, {})
})
);
but considering the outcome, I get the impressing I'm tweaking the wrong parameters here :)
Any help would be appreciated!
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
