Pre loader

Tag: LineRenderableSeriesViewModel

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 votes
4k views

I made wpf project with MVVM. I added LineRenderableSeriesViewModel to the model. SelectedSeriesStyle contains StrokeThickness=3 property. When I click on series, the SeriesSelectionModifier set correctly the line thicknes, but when I set IsSelected property in model, the seriesline thickness not changing. The stroke and PointMarkerTemplate properties work correctly.
Why not changing StrokeThickness property by model?

  • Zsolt Huse asked 5 years ago
  • last active 5 years ago
1 vote
5k views

Hello,
I’m currently rewriting a program in .net7 WPF using MVVM as much as possible.

In my MainViewModel:

I read data from a CSV file and transforming it into an ObservableCollection of LineRenderableSeriesViewModel (stored in the « RenderableSeriesViewModels » variable) . Additionally, the Y axes are transformed into ObservableCollection of IAxisViewModel (within the « Yaxes » variable).
Each series corresponds to a LineRenderableSeriesViewModel and each Y axis is represented as a NumericAxisViewModel. The X-axis is a DateTime common to all series and is declared only in XAML.

Within my view’s XAML:

I declare RenderableSeries=”{s:SeriesBinding RenderableSeriesViewModels}” and YAxes=”{s:AxesBinding YAxes}. I’ve defined a legend template to add several elements:
– DataContext=”{Binding RenderableSeries}”
– A checkbox to toggle serie visibility (IsVisible binding).
– A checkbox to toggle Y-axis visibility for the serie (YAxis.Visibility binding).
– A color picker to change the color of a serie, bound to “Stroke”, “YAxis.TickTextBrush”, and “YAxis.BorderBrush”
– A slider for adjusting serie thickness (StrokeThickness binding).

Results:

Each element acts on the graph as expected: RenderableSeries updates and the graph refreshes correctly.

In the MainViewModel, RenderableSeriesViewModels and YAxes are not updated for all elements:
– “IsVisible” and “StrokeThickness” for the concerned series are instantly modified in RenderableSeriesViewModels but “Stroke” is not.
– “YAxes” is not updated.

The code for the LegendTemplate and a screenshot of the resulting legend are in the attachements.

Could you please help me to understand what I do wrong?

Showing 2 results

Try SciChart Today

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

Start TrialCase Studies