SciChart® the market leader in Fast WPF Charts, WPF 3D Charts, and iOS Chart & Android Chart Components
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!
Please note: SciChart team will only answer questions from customers with active support subscriptions. Expired support questions will be ignored. If your support status shows incorrectly, contact us and we will be glad to help.
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.