Pre loader

Dynamic data loading

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

I am creating a chart that uses an XML file that holds data in a tabular format (headers and rows) that i covert to a datatable of strings and then try to convert each column/row value to a double to populate an XYDataSeries object. Sometimes the amount of data is very large which can take 10-15 seconds to process, which is not ideal for the application it is used in.

What i would like to do is create placeholder XYDataSeries that have a series name and dynamically create the data and YAxis when the series is selected initially from the legend.

Is this possible? I have tried in the past but have issues with the data being null.

Version
v5.4
  • You must to post comments
0
0

You could … try to create an empty XyDataSeries with series name and assign to your RenderableSeries, then update it later.

For example, some psuedo-code:

 // Setup chart with empty dataseries 
 var xyData = new XyDataSeries<double,double>() { SeriesName = "my Series" };
 var renderSeries = new FastLineRenderableSeries() { DataSeries = xyData}; 
 sciChartSurface.RenderableSeries.Add(renderSeries);

 Tuple<double[], double[]> xyValues = await GetLongRunningOperation();
 xyData.Append(xyValues.Item1, xyValues.Item2); 

 // ... 
 public async Tuple<double[], double[]> GetLongRunningOperation()
 {
       // fetch long running operation in Task
       // pack XValues into Tuple.Item1, YValues into Tuple.Item2
       // return to caller 
 }

I am not sure exactly how this will behave but I think it will add a series to the legend before data, then update with data once it is available.

You could also go a little further and preload the XyDataSeries with some dummy data / set opacity or something to 50% to show that it is loading. For example.

 // Setup chart with empty dataseries 
 var xyData = new XyDataSeries<double,double>() { SeriesName = "my Series [LOADING]" };
 xyData.Append(dummyXValues, dummyYValues);
 var renderSeries = new FastLineRenderableSeries() { DataSeries = xyData, Opacity = 0.5 }; 
 sciChartSurface.RenderableSeries.Add(renderSeries);

 Tuple<double[], double[]> xyValues = await GetLongRunningOperation();
 xyData.Clear();
 xyData.SeriesName = "my Series"; 
 renderSeries.Opacity = 1;
 xyData.Append(xyValues.Item1, xyValues.Item2); 

Let me know if this helps!

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