Passing JSON response value into SfCartesianChart

Below here is the JSON response from API.

Need help to pass the value and epochdate into X and Y axis of a SfCartesian Chart.


{
“result”: “[{“value”:53.4610,“epochdate”:1516406400000.0},{“value”:53.4610,“epochdate”:1516492800000.0},{“value”:53.5560,“epochdate”:1516579200000.0},{“value”:53.9560,“epochdate”:1516665600000.0},{“value”:53.7140,“epochdate”:1516752000000.0},{“value”:53.3240,“epochdate”:1516838400000.0},{“value”:74.1430,“epochdate”:1610841600000.0}]”,
“targetUrl”: null,
“success”: true,
“error”: null,
“unAuthorizedRequest”: false,
“__abp”: true
}



1 Reply 1 reply marked as answer

DP Dharanitharan Palanisamy Syncfusion Team January 26, 2021 10:59 AM UTC

Hi Esakkiapppan,  
  
Greetings from Syncfusion. We have analyzed your query at our end and like your requirement, we have samples in the sample browser also in the kb. So, refer to the following links will help you to achieve your requirement.  
  
Sample code to bind the data source to our charts from JSON file,  
  
In the above example code, we map the direct DateTime value to the DateTime axis, and for your case, you can convert your epochdate to DateTime like in the following code snippet.    
int epochdate  = 1516406400000.0;    
var date = DateTime.fromMillisecondsSinceEpoch(epochdate);    
  
After converting to DateTime value and you can map as to our chart data source.   
   
Kb will explain the steps for binding the data source to charts from JSON file,   
   
Please revert us if you need any further assistance.   
   
Thanks,   
Dharanitharan. P    



Marked as answer
Loader.
Up arrow icon