0
我正在使用OxyPlot在StairStepSeries中繪製大量數據。表現很好,但如果我激活標記,則表現非常糟糕。因此我想實施一項檢查:只有在不超過一定數量的可見點時才能激活標記。Oxyplot - 獲取可見點
是否可以只獲取可見點的數量?我找不到解決方案。我只得到一個圖表的總點數。
我正在使用OxyPlot在StairStepSeries中繪製大量數據。表現很好,但如果我激活標記,則表現非常糟糕。因此我想實施一項檢查:只有在不超過一定數量的可見點時才能激活標記。Oxyplot - 獲取可見點
是否可以只獲取可見點的數量?我找不到解決方案。我只得到一個圖表的總點數。
我自己沒有測試過。
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中的所有數據點,並檢查它是否在當前屏幕矩形中。