We also need to zoom in/out it, enlarge/ shrink it and scroll it.
The chart may change at run time, when select differnent set of data for the
chart, the chart will clear everything (canvas clear everything) ,and for
each new data points we recreate each circle and add it to the canvas.
If the chart holds too much points, close to thousands, it will slow down
the performance when create it. I am thinking if we cannot make it faster
when we create thousands of points in the chart, we may make it faster when
we scroll it.
I have tried 2 way to make it faster:
1) when scroll it, I will only add the points actually shows in the chart.
For examples, if 1000 points need in the chart, but after zoom in, only 100
points in the chart, so when we scroll the chart, each time chart only
creates 100 points. We need to recreate the chart coulple of times when we
scroll it. It works good when have less points inthe chart, but if zoomed
out, the chart start getting slower.
2) Then, I am thinking I can use a image brush to replace the chart. When
mouseDown replace the chart with a image, and MouseMove to move the image,
and MouseUp replace the image with the canvas chart. I am sure it will be
faster the scroll chart.
(Use scrollViewer is very slow, too.)
I question is: is this the way we should implement a chart? What is the best
way to implement a chart?
It still slow when create the chart if we have too many points, lines in the
chart.
Does WPF have some limitation or I have not find a right way to do it?
Someone suggested I create a one circle and make it as image, and use that
image for all the circles. But it will cause other problem: the circle may
need to be highlighted, then we need to create a saparated image for a
highlighted circle? And circle may be in different color, then we need to
create different colored image...
In this way, the number of different image for a circle may be hundreds...