Pre loader

JSON Data

Welcome to the SciChart Forums!

  • Please read our Question Asking Guidelines for how to format a good question
  • Some reputation is required to post answers. Get up-voted to avoid the spam filter!
  • We welcome community answers and upvotes. Every Q&A improves SciChart for everyone

WPF Forums | JavaScript Forums | Android Forums | iOS Forums

0
0

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

Version
5.0.1
  • You must to post comments
0
0

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()
                    .withDataSeries(dataSeries)
                    .withStrokeStyle(ColorUtil.argb(0xFF, 0x27, 0x9B, 0x27))
                    .build();

// Set the RenderableSeries on the chart
sciChartSurface.getRenderableSeries().add(rs1);

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,
Andrew

  • You must to post comments
Showing 1 result
Your Answer

Please first to submit.

Try SciChart Today

Start a trial and discover why we are the choice
of demanding developers worldwide

Start TrialCase Studies