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.

0

0

I’m trying to create a context menu that has the menu items ‘Copy’ and ‘Save Image As…’. In my ChartView.xaml, I created a SciChartSurface.ContextMenu and an event handler in the Code Behind. CopyImageToClipBoard(object sender, RoutedEventArgs e) calls sciChartSurface.ExportBitmapToClipboard() that was defined in the class ‘SciChartSurfaceExtensions.cs’. I’ve read the tutorial: http://www.scichart.com/screenshots-xps-printing-x-axis-text-labels and the suggested approach works for a single chart. But how do I implement this with a collection of charts? Would I have to append all the chart images into one large image first? How can I get these commands to copy all the charts in my window or save all the charts in my window to an image file?

..and just out of curiosity, how can I pass the sciChartSurface object from XAML to a ViewModel?

Hi,
I've been struggling with two main issues with my application and I think I've exhausted my resources so I'm hoping someone can help me.Issue 1: 'Copy' and 'Save Image As...'
In my ChartView.xaml, I created a SciChartSurface.ContextMenu and an event handler in the Code Behind.
CopyImageToClipBoard(object sender, RoutedEventArgs e) calls sciChartSurface.ExportBitmapToClipboard() that was defined in the class 'SciChartSurfaceExtensions.cs'.These functions work for a single chart but how can I get these commands to copy all the charts in my window or save all the charts in my window to an image file?Out of curiosity, how can I pass the sciChartSurface object from XAML to a ViewModel?Issue 2: Zoom History - the ability to restore a previous visible range.
I tried to use Caliburn.Micro Event Aggregator to send a message from my extended RubberBandXyZoomModifierEx to my ShellViewModel (ShellView is the parent View that holds multiple ChartViews) but the message is not properly sent. This is more of an issue with Caliburn.Micro.I have a property called 'SharedXVisibleRange' that all charts in the ShellViewModel bind to.I notice SciChart has an EventAggregator Property. Can I use this instead? If so, how do I use it? Do you have any other suggestions on how I can successfully implement the zoom history?I also looked at this post: http://www.scichart.com/forums/topic/mvvm-dynamic-line-drawing/page/2/ But I was unable to use it since I could not figure out how they passed an instance of their ViewModel into their extended RubberBandXyZoomModifier.

Can you please take a look at my sample code and give me some suggestions? Please let me know if I am way off with my implementation. I'm still a newbie. =)The controls are:
Right-click: context menu
Left-click: drag to zoom
Left-click + Ctrl: panThanks in advanced!Johnny

I think you should change the code which creates bitmap from SciChartSurface in such a way that it would create bitmap from your Panel(or any FrameworkElement) in which charts are placed rather than from single SciChartSurface. Please, use search google for this, it is quite common task so there are lots of existing implementations. Does this make sense for you?

Passing visual components to VM isn’t widely used approach, because it is a violation of MVVM. But as long as you “injects” them via interface, I think it is OK. Please, take a look at this article about MiVVM for more info.

Regarding zoom history, please, take a look at this post, where one of our customers kindly shared his own implementation. Probably it will be useful for you, at least to start with.

To pass VM instance into constructor, you can use either binding or just passing it during modifier construction(in the VM).