Oxyplot - Get visible Points

*爱你&永不变心* 提交于 2021-01-29 03:58:10

问题


I'm using OxyPlot to draw a huge amount of data in a StairStepSeries. The performance is good, but very bad if I'm activating Markers. Therefore I would like to implement a check: Markers can only be activated if a certain number of visible points are not exceeded.

Is it possible to get only the number of visibile points? I found no solution. I get only the total number of points of a chart.


回答1:


I haven't tested this myself.

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() method will give the Rectangle the series currently uses on the screen. Loop through all the DataPoints inside your StairStepSeries and check if it is in the Current screen rectangle.



来源:https://stackoverflow.com/questions/41185544/oxyplot-get-visible-points

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!