SciChart® the market leader in Fast WPF Charts, WPF 3D Charts, and iOS Chart & Android Chart Components
I’ve been finding lots of examples of creating Custom Chart Modifiers however they are not using a SciChartGroup using a DataTemplate and not in a MVVM scenario.
I know MVVM is the preferred structure for WPF solutions, however it does introduces some complexities as well as using DataTemplates of a SciChartGroup, therefore, would someone please be so kind as to point me in the right direction for an example or two so that I can see how this all could work together?
I’m looking at Custom Chart Modifiers by use of a CustomModifier class. As this will give me the most flexibility in terms of what I would like to do in the future and I would also like to be able to switch between modifiers, such as Panning, Zooming and drawing annotations onto the chart.
P.S. Andrew, if this requires a developer on your side to hash this out for an hour or so, let me know and I’ll be more than happy to pay for it.
As far as I’m aware, SciChartGroup won’t work without MVVM. The reason why we use this is that you can dynamically add/remove panes, as well as dynamically change chart properties within each pane.
I know MVVM is a learning curve, but it’s worth it. I’ve included some diagrams below which explain our our ‘Create Multi Pane Stock Charts’ example is structured.
There is also a youtube video here which walks through the example in detail.
If you really want to go no MVVM then you will need to use ItemsControl instead of SciChartGroup. Add your SciChartSurfaces to ItemsControl.Items, e.g.
<ItemsControl> <ItemsControl.Items> <SciChartSurface x:Name="chart0"/> <SciChartSurface x:Name="chart2"/> <!-- etc... --> </ItemsControl.Items> </ItemsControl>
You will lose the gridsplitter to resize panes, ability to stack panes but the code is far more simple!
It is possible to add back the GridSplitter, but the solution is again an MVVM solution.
I hope some of this is helpful, feel free to discuss below.
Thanks for your reply, I hope you are well 😀
Yes, I want to go with the MVVM solution, I’m just having a hard time with it and do you remember the Rx solution I sent you in one of my previous tickets? That was all in MVVM 😀
My problem right now is wrapping my head around the ChartModifier class, extending SciChartGroup with multiple panes so I can have Toggle buttons to change between Panning, Zooming and Drawing annotations onto the chart. I would like to add this to my current MVVM solution however whenever I add the Drawing annotation chart modifier, it overwrites the default modifiers.
I was wondering if there are no examples in your forums or knowledge base to achieve this then maybe I can pay for one of your developers to knock up an example for me.
Just let me know how to proceed because I think I am out of my depth right now with WPF and MVVM to achieve my desired functionality.
Thanks and kindly
Please login first to submit.