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

Hi. Apparently I need the SciChartSurface object in order to print. I’m living in the MVVM world and I’m currently binding the surface’s DataSet to my viewmodel. How can I get the same data to my paginator for printing? I can get a scichartsurface object to my paginator but currently I’m having to create a second object with all my viewmodel data in it, which seems somewhat inefficient – not to mention awkward.

Thanks for any guidance.

  • You must to post comments
0
0

Hi Andy,

I can’t comment too much about your specific architecture (certainly without seeing it!) but we do have some related posts on chart printing and rendering to bitmap which may be of use. These are:

<

ul>

  • How to Print a Chart
  • Offscreen Rendering to Bitmap without showing the chart
  • <a href=”https://www.scichart.com/questions/question/export-graph/#post-1087 rel=”nofollow”>How to Render a chart to bitmap
  • To solve these sorts of problems what I tend to do is create a service, e.g. IPrintService which is injected into the viewmodel. It’ll need a SciChartSurface instance, but notice the surface implements an interface, so you can set this as an interface property in your view-model without breaking coupling between View and ViewModel (MVVM die-hards may balk at this, but from MVP days, an interface in your viewmodel is not a view đŸ˜‰ ). There’s an article here showing how you could inject an ISciChartSurface into a viewmodel via attached property and binding.

    A quick google around and passing the Visual to the ViewModel seems like the only way to do it, as printing is by and large, a view-operation:
    http://stackoverflow.com/questions/3875789/print-wpf-visuals-with-mvvm-pattern

    Hope this helps!

    Andrew

    • You must to post comments
    Showing 1 result
    Your Answer

    Please first to submit.