Is it possible to access the data through a chart series on an XY chart?
I'm sure that's an easy way to do this, but I'm not finding it.
I'm loading my data through a json and parsing it.
var series = chart.series.push(new am4charts.LineSeries());
chart.dataSource.url = "/data/myData.json";
chart.dataSource.parser = new am4core.JSONParser();
series.dataFields.valueY = "value";
series.dataFields.dateX = "date";
Once series finishes loading its external data, it will set its own data
property with it. So it will become accessible via series.data
.
However, loading operation is asynchronous, meaning that it will not become available immediately after your code above executes. So you can use events to know precisely when it becomes available.
series.dataSource.events.on("done", function(ev) {
console.log(series.data);
});