Pre loader

Selected Point styling in mvvm

Welcome to the SciChart Forums!

  • Please read our Question Asking Guidelines for how to format a good question
  • Some reputation is required to post answers. Get up-voted to avoid the spam filter!
  • We welcome community answers and upvotes. Every Q&A improves SciChart for everyone

WPF Forums | JavaScript Forums | Android Forums | iOS Forums

0
0

Hi there,

I am relatively new to C# and scicharts so you will have to forgive me a little.

In the project I am working on, I am trying to add dynamic renderable series as the user selects items in a tree. I have looked through the online tutorials and forums but still am having trouble. I am creating my own renderable series view model class derived off of LineRenderableSeriesViewModel. I found documentation that I needed to override the ViewType property and set it to a FastLineRenderableSeriesForMvvm.

When I am creating these objects to add to the ObservableCollection which is bound to my scichart surface, I can set the PointMarker and its properties, but not the SelectedPointMarker properties.

XAML:

    <s:SciChartSurface Style="{StaticResource BasicSciChartSurfaceStyleRateVsTime}"
                       ViewportManager="{Binding RateVsTimePlot.Manipulator.Viewport}"
                       Name="RateVsTime" x:FieldModifier="private"
                       ZoomHistoryManager="{Binding RateVsTimePlot.ZoomHistory}"
                       PreviewMouseLeftButtonDown="PreviewRateVsTimeMouseLeftButtonDown"
                       PreviewMouseLeftButtonUp="PreviewRateVsTimeMouseLeftButtonUp"
                       RenderableSeries="{s:SeriesBinding RateVsTimePlot.RenderableSeriesViewModels}"
                       local:YAxesCollectionBehaviour.AxisSource="{Binding RateVsTimePlot.YAxesViewModels}"
                       local:YAxesCollectionBehaviour.AxisStyle="{StaticResource AxisStyle}"/>         

Style:

<Style x:Key="ProdLineStyle" TargetType="s:FastLineRenderableSeriesForMvvm">
    <Setter Property="s:TooltipModifier.IncludeSeries" Value="False"/>
    <Setter Property="SelectedPointMarker">
        <Setter.Value>
            <s:EllipsePointMarker Fill="{Binding SeriesColors.ProductionColor}"
                                  Stroke="{Binding SeriesColors.ProductionColor}"
                                  Width="6" Height="6">
            </s:EllipsePointMarker>
        </Setter.Value>
     </Setter>
</Style>

ViewModel :

        var renderableSeries = new GenericRenderableSeriesViewModel
        {
            DataSeries = dataSeries.DataSeries,
            YAxisId = dataSeries.AxisId,
            IsSelected = IsSelected,
            SeriesColors = _dataColors[fluidRateType],
            DisplayEnabled = AnalysisInteractionMode.IsLineManipulationDisabled,
            PointMarker = new EllipsePointMarker(),
            StyleKey = "ProdLineStyle"
        };

        renderableSeries.SetRenderableSeriesColorSettings();

        renderableSeries.DataSeries.SeriesName = fluidRateType.ToString();
        return renderableSeries;

public void SetRenderableSeriesColorSettings()
    {
        Stroke = SeriesColors.ProductionColor;

        if (PointMarker == null) return;

        PointMarker.Stroke = SeriesColors.ProductionColor;
        PointMarker.Fill = SeriesColors.ProductionColor;
        PointMarker.Height = PointNonSelectedHeight;
        PointMarker.Width = PointNonSelectedWidth;
    }

When I run my app, I see what I am expecting by default, but when I do a point selection rectangle, the behavior is not correct. I only see the line. The points with in the rectangle disappear.

I am trying to move away from having the style set the selectedPointMarker, and doing it through code in the view model just like the function above as users will be able to change these properties in the future. But so far I haven’t found a way to do either.

Am I using the correct classes, or do I need to override something else? Any ideas or suggestions would be greatly appreciated

Thanks
Rylan

Version
4.2.0.8998
  • Yuriy Zadereckiy
    Hi Rylan, thanks for bringing this to our attention! Probably the property just has not been added to BaseRenderableSeriesViewModel. I think we can fix this quickly an publish an update. Please bear with us, we’ll let you know when it is ready.
  • You must to post comments
0
0

HI Rylan,

We have fix this issue. Please, try new build ( v4.2.0.9204 ) from our NuGet.

Best regards,

Markiyan.

  • You must to post comments
Showing 1 result
Your Answer

Please first to submit.

Try SciChart Today

Start a trial and discover why we are the choice
of demanding developers worldwide

Start TrialCase Studies