gpt4 book ai didi

c# - 缩放时获取一组数据点

转载 作者:行者123 更新时间:2023-11-30 18:37:03 25 4
gpt4 key购买 nike

我有一个带有 Series (SeriesChartType.Point) 的 MSChart 对象;启用缩放以允许用户放大数据的特定区域。在用户放大该区域后,我有兴趣了解仍然可见的数据点集。

有没有办法确定哪些数据点仍然可见?

最佳答案

类似下面的内容应该适合您。我用 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

关于c# - 缩放时获取一组数据点,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13159392/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com