Pre loader

Serialize Chart and 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

hi,
does SciChart provides any mechanism to serialize a chart along with the data plotted?
My requirement is that I should be able to save the chart as a file and restore it back.

Please advise.

Thanks,
Vibin

Version
4.2
  • You must to post comments
0
0

Hi Vibin,

Sorry we’re not handling\supporting serialization of DataSerieses, what i can suggest you is:

extend the renderable series you need(or even whole sciChartSurface) and override there WriteXml() and ReadXml() methods

public class SciChartSurfaceExt : SciChartSurface
{
    public override void WriteXml(XmlWriter writer)
    {
        base.WriteXml(writer);

        var rSerieses = RenderableSeries;

        foreach (var rSeries in rSerieses)
        {
            var seria = (FastLineRenderableSeries) rSeries;
            if (seria != null)
            {
                var ds = seria.DataSeries as XyDataSeries<double, double>; ;
                if (ds != null)
                {
                    //do what you need;
                   // ds.XValues and ds.YValues 
                }
            }
        }
    }
}

something like this, and here “//do what you need” you can try to serialize it by yourself and deserialization part also

  • 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