Ned Ryerson Ned Ryerson - 1 year ago 324
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.

Answer Source

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.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download