Hello everyone.
I am studying the wpf chart drawing and I have been abled to generate a dummy scope graph.
I am using the following method:
public Polyline NormalizedValues(Polyline pl)
{
Polyline result = new Polyline();
for (int i = 0; i < pl.Points.Count; i++)
{
Point pt = pl.Points[i];
Point npt = NormalizedValue(pt);
result.Points.Add(npt);
}
return result;
}
public Point NormalizedValue(Point pt)
{
Point npt = new Point();
npt.X = (pt.X - _ca.xMin) * chartCanvas.Width / (_ca.xMax - _ca.xMin);
npt.Y = chartCanvas.Height -
(pt.Y - _ca.yMin) * chartCanvas.Height / (_ca.yMax - _ca.yMin);
return npt;
}
public void Draw()
{
chartCanvas.Children.Clear();
foreach (Trace tr in _Traces)
{
Polyline Normalized = NormalizedValues(tr.Values);
Normalized.Stroke = tr.Color;
chartCanvas.Children.Add(Normalized);
}
}
If the size of the chartCanvas is small around 200 * 200, the drawing is very
fast but once the window is maximized then the curve drawing starts to
be much slower.
I would like to ask your advise about the different possible technique I could apply to optimize the polyline drawing. How could I render a serie at least of 1024 samples in a fast way when I have the canvas maximized ?
I have found the following article:
http://www.newyyz.com/ntgsite/2012/02/fast-line-rendering-in-wpf/
But it seems to be related to GDI and not on WPF rendering directly.
Do we have like in GDI, bitmap rendering or double buffering methods ?
Could somebody provide me some usefull links to wpf optimization ?
What could be the best approach without based on the peace of code I have pasted?
I hope there is something which could be use to still be able to call the Draw() method without too many changes.
Any inputs are welcome.
Thank you very much in advance.
Best regards.
MiQi.