SciChart® the market leader in Fast WPF Charts, WPF 3D Charts, and iOS Chart & Android Chart Components

Welcome to the SciChart Community Forums!

Please use the forums below to ask questions about SciChart. Take a moment to read our Question asking guidelines on how to ask a good question and our support policy. We also have a tag=SciChart on Stackoverflow.com where you can earn rep for your questions!

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 am directly editing my XyDataSeries on a chart by using my mouse. As the mouse moves I edit either the x or y value of a point using the methods

    public void SetPointYValueAt(IDataSeries series, int index, double newValue)
    {
        series.YValues[index] = newValue;
        series.InvalidateParentSurface(RangeMode.None);
    }

    public void SetPointXValueAt(IDataSeries series, int index, double newValue, double xMin, double xMax)
    {
        var xValue = newValue;

        // limit x values to keep them sorted
        if (xValue < xMin) xValue = xMin;
        if (xValue > xMax) xValue = xMax;
        series.XValues[index] = xValue;

        series.InvalidateParentSurface(RangeMode.None);
    }

With this code I am not getting an update at my ViewModel:

    public IDataSeries<double, double> MyDataSeries
    {
        get { return _myDataSeries; }
        set
        {
            _myDataSeries = value;
            OnPropertyChanged("MyDataSeries");
        }
    }

Here is my XAML:

            <sciChartExtensions:StepLineRenderableSeries x:Name="HResitivitySeries" IsDigitalLine="True" DataSeries="{Binding MyDataSeries, Mode=TwoWay}">

Where StepLineRenderableSeries is derived from FastLineRenderableSeries with IsDigitalLine = true and the HitTest method overridden.

How can I get MyDataSeries to update?

  • You must to post comments
0
0

I should have given more details. The methods SetPointXValueAt and SetPointYValueAt are located in a derived class

public class StepSeriesDataPointEditModifier : SeriesSelectionModifier

For this reason putting OnPropertyChanged in those methods will not help.

I will explain why I need to do this. I have a DigitaLine plot which is used to edit the data in the plot. The edited data has to be available in the viewmodel and model, where it will be used as input for numerical modeling.

I was hoping there would be some method in the dataseries that I could call to force the notification that it has changed.

  • You must to post comments
0
0

I am part way there. I can add a handler to my viewmodel with

        MyDataSeries.DataSeriesChanged += OnDataSeriesChanged;

but to invoke the DataSeriesChanged I have to modify my methods:

    public void SetPointYValueAt(IDataSeries series, int index, double newValue)
    {
        //series.YValues[index] = newValue;

        var xyDataSeries = series as XyDataSeries<double, double>;
        if (xyDataSeries != null)
        {
            var x = xyDataSeries.XValues[index];
            xyDataSeries.RemoveAt(index);
            xyDataSeries.Insert(index, x, newValue);
        }


        series.InvalidateParentSurface(RangeMode.None);
    }

Removing a data point and adding a new one triggers the DataSeriesChanged, but it is not as clean as just reseting the y value.

  • You must to post comments
Showing 2 results
Your Answer

Please first to submit.