I have a candlestick chart to plot with a set of JSON data that are built with Gson, coming from the SPringboot2 api. I am not too sure if the JSON format generated by Gson is not valid and compatible with the JSON parser. It turns out the list of JSON structure is considered to be one array instead of a list of multiple array in the payload. [payload here: https://i.stack.imgur.com/FBNX0.png]
Supposed that the JSON structure should look like as below:
[{"date":"20200505 15:53:00","open":1.089435,"high":1.08967,"low":1.08941,"close":1.08967,"volume":-1},
{"date":"20200505 15:54:00","open":1.08967,"high":1.089845,"low":1.089625,"close":1.08971,"volume":-1},
{"date":"20200505 15:55:00","open":1.08971,"high":1.089755,"low":1.089565,"close":1.089575,"volume":-1},
{"date":"20200505 15:56:00","open":1.089575,"high":1.08958,"low":1.089405,"close":1.08952,"volume":-1},
{"date":"20200506 08:21:00","open":1.083685,"high":1.083745,"low":1.083625,"close":1.083745,"volume":-1}]
The JSONParser in Angular.ts looks like this:
// Load data
chart.dataSource.url = "http://localhost:8080/api/candlestick/";
chart.dataSource.parser = new am4core.JSONParser;
chart.dataSource.parser.options.emptyAs = 0;
As a result, it's unable to load the chart and generate nothing but blank chart. Is it something to do with the JSON format from Gson output?