SciChart® the market leader in Fast WPF Charts, WPF 3D Charts, iOS Chart, Android Chart and JavaScript Chart Components


IS it possible to get data from Json instead of storing values in the App for examples provided?

  • You must to post comments

Hi Kaiash,

I’m not quite sure what you mean? Do you mean is it possible to fetch data from a web service and load to an Android Chart instead of storing values in the app?

If so, of course! SciChart for Android doesn’t care where you get data from. We simply demonstrate that you can append data to the SciChartSurface by using our DataSeries API.

Take a look at our Android Line Chart Example. To get data into the chart, you simply need to create a new XyDataSeries and append data to it. Like this:

// Create a SciChartBuilder instance 
SciChartBuilder sciChartBuilder = new SciChartBuilder(getContext()); 

// Create a new DataSeries 
IXyDataSeries<Double, Double> dataSeries = sciChartBuilder.newXyDataSeries(Double.class, Double.class).build();

// xValues, yValues can be any data that you choose
dataSeries.append(xValues, yValues); 

// create a new RenderableSeries which draws the data 
final FastLineRenderableSeries rs1 = sciChartBuilder.newLineSeries()
                    .withStrokeStyle(ColorUtil.argb(0xFF, 0x27, 0x9B, 0x27))

// Set the RenderableSeries on the chart

Now, if you want to create a chart with no data, simply skip the dataSeries.append step.

You can later use dataSeries.append, dataSeries.Insert, dataSeries.Update, dataSeries.Remove and dataSeries.clear to change the data, and SciChart will automatically redraw the chart.

See the XyDataSeries methods here.

I hope that answers your question! If you have more questions please ask.

Best regards,

  • You must to post comments
Showing 1 result
Your Answer

Please first to submit.