Ned Ryerson Ned Ryerson - 3 months ago 49
C# Question

DynamicDataDisplay WPF - Get data visible in current viewport

This question is about the DynamicDataDisplay library available at codeplex.

Is there a way to get the data that is currently visible in the current ViewPort.

i.e. I want to get the data that is currently visible when the user does a ctrl+mouse zoom.


Ok, so I figured this out myself.

Your axes have a property called AxisControl which has a property Range. The Range property has the min and max of what is actually being displayed within your axes.


<d3:ChartPlotter Name="Plotter">
                <d3:HorizontalDateTimeAxis Name="XAxis"/>
                <d3:VerticalAxis Name="YAxis" />


 Plotter.Loaded += (s, e) => Plotter.Viewport.PropertyChanged += ViewportOnPropertyChanged;
 private void ViewportOnPropertyChanged(object sender, ExtendedPropertyChangedEventArgs e)
            var minX = XAxis.AxisControl.Range.Min;
            var maxX = XAxis.AxisControl.Range.Max;
            var minY = YAxis.AxisControl.Range.Min;
            var maxY = YAxis.AxisControl.Range.Max;

You don't necessarily want to use Viewport.PropertyChanged for this.