【问题标题】:Oxyplot - Get visible PointsOxyplot - 获取可见点
【发布时间】:2016-12-16 13:30:07
【问题描述】:

我正在使用 OxyPlot 在 StairStepSeries 中绘制大量数据。性能很好,但如果我激活标记则非常糟糕。因此我想实现一个检查:只有在不超过一定数量的可见点时才能激活标记。

是否可以只获得可见点的数量?我没有找到解决办法。我只得到图表的总点数。

【问题讨论】:

    标签: c# .net oxyplot


    【解决方案1】:

    我自己没有测试过。

    public int GetNumberOfVisiblePointsOnScreen(StairStepSeries stairStepSeries)
    {
        int numberOfVisiblePointsOnScreen = 0;
        foreach (DataPoint point in stairStepSeries.Points) {
            if (stairStepSeries.GetScreenRectangle ().Contains (stairStepSeries.Transform (point)))
                numberOfVisiblePointsOnScreen++;
        }
        return numberOfVisiblePointsOnScreen;
    }
    

    GetScreenRectangle() 方法将给出系列当前在屏幕上使用的 Rectangle。遍历 StairStepSeries 中的所有 DataPoints 并检查它是否在当前屏幕矩形中。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2015-03-16
      • 1970-01-01
      • 2018-05-30
      • 2015-04-30
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多