[英]Get set of datapoints when zoomed
I have an MSChart object with a Series (SeriesChartType.Point); 我有一个带有Series(SeriesChartType.Point)的MSChart对象; Zooming is enabled to allow the users to zoom into a specific region of the data.
启用缩放以允许用户放大数据的特定区域。 After the user has zoomed into that region, I'm interested in knowing the set of DataPoints that are still visible.
用户放大到该区域后,我很想知道仍然可见的DataPoints集。
Is there a way to ascertain which DataPoints are still visible? 有没有办法确定哪些DataPoints仍然可见?
Something like the following should work for you. 像下面这样的东西应该适合你。 I tested it with a
Line
ChartType
, but should work for any plotting type as long as the data is X,Y
(and not X,Y,Y
) 我使用
Line
ChartType
测试它,但只要数据是X,Y
(而不是X,Y,Y
),它应该适用于任何绘图类型
Dim Xmin As Double = aChart.ChartAreas(0).AxisX.ScaleView.ViewMinimum
Dim Xmax As Double = aChart.ChartAreas(0).AxisX.ScaleView.ViewMaximum
Dim Ymin As Double = aChart.ChartAreas(0).AxisY.ScaleView.ViewMinimum
Dim Ymax As Double = aChart.ChartAreas(0).AxisY.ScaleView.ViewMaximum
Dim VisibleDataPoints As New Series
For Each pt As System.Windows.Forms.DataVisualization.Charting.DataPoint In aChart.Series(0).Points
If pt.XValue >= Xmin And pt.XValue <= Xmax Then
If pt.YValues(0) >= Ymin And pt.YValues(0) <= Ymax Then
VisibleDataPoints.Points.Add(pt)
End If
End If
Next
VisibleDataPoints.ChartType = System.Windows.Forms.DataVisualization.Charting.SeriesChartType.Line
VisibleDataPoints.Color = Color.Red
aChart.Series.Add(VisibleDataPoints)
HTH HTH
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.