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

Welcome to the SciChart Community Forums!

Please use the forums below to ask questions about SciChart. Take a moment to read our Question asking guidelines on how to ask a good question and our support policy

We also have a tag=SciChart on Stackoverflow.com where you can earn rep for your questions!

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.