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.

Xaml

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

Code

 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.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top