Hi,
In the RolloverModifier sample (enclosed)the values of both data series are displayed in the custom ItemsControl with corresponding SeriesInfo template, see the attached project for details. If I want to add another ChartModifier I have to add a SciChart:ModifierGroup, see xaml below:
<SciChart:SciChartSurface.ChartModifier>
<SciChart:ModifierGroup>
<SciChart:RolloverModifier />
</SciChart:ModifierGroup>
</SciChart:SciChartSurface.ChartModifier>
If I do these changes the values of both data series are not displayed in the ItemsControl any more.
Is there a fix for this ??
- andreasrep asked 10 years ago
- You must login to post comments
Hi Andreas,
Thank you for the solution to reproduce. I’ve just taken a look – since you have moved the RolloverModifier inside a ModifierGroup, you need to change a binding on the ItemsControl that reads out the rollover values.
The RolloverModifier is just a data-source. You can treat it as a sort of ViewModel in the MVVM sense. It exposes a collection of SeriesInfo objects which you can consume anywhere in your app.
In our RolloverModifier example, the SeriesInfo objects are consumed by an ItemsControl with this binding:
<!-- Define an area in the top left of the chart which binds to the RolloverModifier.RolloverData.SeriesInfo collection --> <!-- Each SeriesInfo contains information such as SeriesName, Color and Data Value at the mouse location --> <!-- This collection updates dynamically as the mouse is moved. We bind to it using an ItemsControl so if more series are --> <!-- added then the feedback also updates --> <ItemsControl Margin="23,23" HorizontalAlignment="Left" VerticalAlignment="Top" Background="#77FFFFFF" BorderBrush="#55000000" BorderThickness="2" Grid.IsSharedSizeScope="True" ItemsSource="{Binding ChartModifier.SeriesData.SeriesInfo, ElementName=sciChartSurface}" Padding="5"> ...
Since you have moved the RolloverModifier inside a ModifierGroup, the binding will no longer work (check your Visual Studio output window for binding errors, it will be there).
So, change it to this and it will work
<!-- Defines the RolloverModifier, which provides mouse-move feedback of underlying datapoints --> <SciChart:SciChartSurface.ChartModifier> <SciChart:ModifierGroup> <SciChart:RolloverModifier x:Name="rolloverModifier"/> <!-- Name the rollovermodifier --> </SciChart:ModifierGroup> </SciChart:SciChartSurface.ChartModifier> ... <!-- Bind to the RolloverModifier.SeriesData by name --> <ItemsControl Margin="23,23" HorizontalAlignment="Left" VerticalAlignment="Top" Background="#77FFFFFF" BorderBrush="#55000000" BorderThickness="2" Grid.IsSharedSizeScope="True" ItemsSource="{Binding SeriesData.SeriesInfo, ElementName=rolloverModifier}"
Best regards,
Andrew
- Andrew Burnett-Thompson answered 10 years ago
- You must login to post comments
Please login first to submit.