I am using Amchart v4 and have the folowing data.
[
{
"date": 1583419378000,
"id": "A",
"value": "76"
},
{
"date": 1583419378000,
"id": "B",
"value": "72"
},
{
"date": 1583419378000,
"id": "C",
"value": "908"
},
{
"date": 1583419379000,
"id": "A",
"value": "44"
},
{
"date": 1583419379000,
"id": "B",
"value": "704"
},
{
"date": 1583419379000,
"id": "C",
"value": "918"
},
]
The x-axis is the date (timestamp) and the y-axis is the value. I want to create 3 lines on my line chart using the id.
Is there a way to group by id to get 3 lines? I only have one 'series' at the moment and it produces one line with all the data?
let dateAxis = chart.xAxes.push(new am4charts.DateAxis());
dateAxis.renderer.minGridDistance = 60;
chart.yAxes.push(new am4charts.ValueAxis());
// Create series
let series = chart.series.push(new am4charts.LineSeries());
series.dataFields.valueY = "value";
series.name = "id";
series.dataFields.dateX = "date";
series.dataFields.category = "id";
series.tooltipText = "{value}"
series.tooltip.pointerOrientation = "vertical";
chart.cursor = new am4charts.XYCursor();
chart.cursor.snapToSeries = series;
chart.cursor.xAxis = dateAxis;
I have tried series.dataFields.category = "id";