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

0
0

When trying to implement chart printing based on the xps example, I came across some wierd behaviour. In my scenario I’m using the same instance of the viewmodel as datacontext for the chart shown in GUI and the chart created in the CreateSciChartSurfaceWithoutShowingIt method. This causes the chart shown in the GUI to loose all it’s axis and datas. I have a suspicion this caused by the chart loosing it’s databining. In the attached example I have added to charts to the GUI and both are using the same instance of the viewmodel, to make it more clear. Only one chart works as expected. If trying to print to xps, both charts in the GUI looses their data. Please advice. Tnxs in advance. Keep up the good work

Attachments
  • You must to post comments
0
0

Hi Oddvin,

This issues appears because of SeriesSource inner implementation. But there is simple workaround – you just need to use DataSet instead. Also, you need to comment out this row from CreateSciChartSurfaceWithoutShowingIt(…) method to prevent chart from disappearance after printing:

        private Visual CreateSciChartSurfaceWithoutShowingIt(Size size)
        {
            // Create a fresh ChartView, this contains the ViewModel (declared in XAML) and data
            var control = new ChartView();
            var scs = control.SciChartSurface;

            //Comment out this line
            //scs.DataContext = this.customUserControl.SciChartSurface.DataContext;
...
}

Hope this helps! Please, let us know if you need any further assistance with this,

Best regards,
Yuriy

  • You must to post comments
Showing 1 result
Your Answer

Please first to submit.