TeeChart crashes on canvas drawing.
TeeChart crashes on canvas drawing.
We need to draw around 3000 ellipses using canvas drawing as shown in snapshot attached. We are drawing them with onafterdrawtchart event. As soon as we draw those ellipses, teeChart crashes after few moments. We feel that Teechart is not able to handle this amount of data. So is there a workaround that canvas uses less memory or becomes light weight so as to optimize the drawing for required points?
Also we had one more point in mind i.e. while working on series, we have an option i.e. drawAllPoints, which can be set to false when we do not want the overlapping points to be redrawn or want 1 pixel per point. So is there a similar way for canvas drawing too?
We are using: Teechart activeX pro 2018 and Visual studio 2013
Regards
Bhanu
Re: TeeChart crashes on canvas drawing.
Hello Bhanu,
Have you seen the Bubble series? You may prefer to use it instead of drawing manually to the canvas.
I can draw 3000 bubbles without crashing in VB6:
Is it giving any error message when crashing for you?
Regarding drawAllPoints and a system to avoid drawing points/bubbles where there have been points/bubbles already drawn, I'm afraid there's no system like that implemented for Bubbles or for the custom drawing.
However, you could implement a system yourself. Using Bubbles, you could hide other bubbles with the same x and y values and only show the last. Ie:
You can do this with Bubbles because the points are sorted by the x values.
If you prefer to use custom drawing, you may want to keep your array sorted in some way so you can optimize the search for repeated values.
Have you seen the Bubble series? You may prefer to use it instead of drawing manually to the canvas.
I can draw 3000 bubbles without crashing in VB6:
Code: Select all
TChart1.Aspect.View3D = False
TChart1.Legend.Visible = False
Dim i, j As Integer
TChart1.AddSeries scBubble
For i = 0 To 3000 - 1
TChart1.Series(0).asBubble.AddBubble Round(Rnd * 100), Round(Rnd * 100), 10, "", clTeeColor
Next i
Regarding drawAllPoints and a system to avoid drawing points/bubbles where there have been points/bubbles already drawn, I'm afraid there's no system like that implemented for Bubbles or for the custom drawing.
However, you could implement a system yourself. Using Bubbles, you could hide other bubbles with the same x and y values and only show the last. Ie:
Code: Select all
For i = TChart1.Series(0).Count - 1 To 1 Step -1
j = i - 1
While (j >= 0) And (TChart1.Series(0).XValues.Value(i) = TChart1.Series(0).XValues.Value(j))
If (TChart1.Series(0).YValues.Value(i) = TChart1.Series(0).YValues.Value(j)) Then
TChart1.Series(0).SetNull j
End If
j = j - 1
Wend
Next i
If you prefer to use custom drawing, you may want to keep your array sorted in some way so you can optimize the search for repeated values.
Best Regards,
Yeray Alonso Development & Support Steema Software Av. Montilivi 33, 17003 Girona, Catalonia (SP) | |
Please read our Bug Fixing Policy |