SciChart® the market leader in Fast WPF Charts, WPF 3D Charts, and now iOS Charting & Android Chart Components
We also have a tag=SciChart on Stackoverflow.com where you can earn rep for your questions!
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.
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:
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:
Hope this helps!
Please login first to submit.