I am writing WPF code to show a real-time plot which is a connected line containing about 10,000 points. It takes about 5 seconds to show a picture in my computer. Does anyo
I guess the code sample is 1) a test to try a something that isn't really the sample or 2) a homework.
Try to override the OnRender and do something like:
Pen drawingPen = new Pen(Brushes.Black, 1);
protected override void OnRender(DrawingContext dc)
{
dc.DrawRectangle(Background, null, new Rect(RenderSize));
double x=rand.Next(300);
double y = rand.Next(300);
for (double i = 0; i < 1000; i = i + 0.1)
{
y = 100 + rand.Next(100);
dc.DrawLine(drawingPen, new Point(i, x), new Point(i + 1, y));
x = y;
}
}
or for something with real data, consider if you really need to show every point depending on the resolution of the visual context. ( If your scale is 0-10 and you are producing points 0.0001,0.00015 are they really gone differ on your scale)