2014-02-21 5 views
0

와 내가 함께 일하고 난 예를 다음과 같은 링크를 다운로드 oxyplot : http://blog.bartdemeyer.be/2013/03/creating-graphs-in-wpf-using-oxyplot/는 Oxyplot는 WPF

내가 가서 음모를 꾸미고 내 자신의 데이터를 추가했지만 들어오는 포인트가 누적되고, 그 그래프가 읽을 수 없게 만든다.

차트를 업데이트하여 이전 포인트가 제거되고 새 포인트가 정상적으로 표시되고 누적되지 않도록하는 방법을 알려주세요.

http://blog.bartdemeyer.be/wp-content/uploads/image_thumb19.png

답변

0

사용 LineSeries.Points.RemoveAt(index)

예 :

(DataPlot.Series[0] as LineSeries).Points.Add(new DataPoint(xValue, yValue0)); 
(DataPlot.Series[1] as LineSeries).Points.Add(new DataPoint(xValue, yValue1)); 
if (valueRange > 10000) //points will accumulate until the x-axis reaches 10000 
    { //after 10000 
    (DataPlot.Series[0] as LineSeries).Points.RemoveAt(0); //removes first point of first series 
    (DataPlot.Series[1] as LineSeries).Points.RemoveAt(0); //removes first point of second series 
    } 

하지만 당신은 그것을 함께 사용해야합니다 - 하나 개의 새로운 점을 추가하고 하나를 제거. 그러면 포인트가 누적되지 않으며 원하는 x 축 범위를 갖게됩니다.