Page 1 of 1

Deriving custom series and custom drawing

Posted: Wed Sep 03, 2014 10:13 am
by 16570117
Hi,

we've just updated our license to 2014 Pro with sources. Main reason for that is because I need to develop custom series with some customized drawing which is by default not supported from TeeChart. I would like to start with deriving my custom series but I am not sure which class should I take to derive my custom series from.

Now we are using TFastLineSeries which was the best solution for us so far. Now I would like to do some custom drawing and I notice in sources that TFastLine is calling Polyline to draw point. This is not an option for us. We will have to manipulate every point in series and decide how to draw it according to surrounding points. So there will be a mixture of drawing each point, more points etc... What would be your suggestion?

I guess I will have to override DrawAllPoints procedure and do drawing there. How can I retrieve Chart properties and canvas size etc...to get proper dimensions, scaling, offset etc?

Thank you in advance,
Kind regards
Aljosa

Re: Deriving custom series and custom drawing

Posted: Wed Sep 03, 2014 12:46 pm
by yeray
Hi Aljosa,
PoLabs wrote:we've just updated our license to 2014 Pro with sources. Main reason for that is because I need to develop custom series with some customized drawing which is by default not supported from TeeChart. I would like to start with deriving my custom series but I am not sure which class should I take to derive my custom series from.
Note you don't need the TeeChart sources to inherit from a series and modify its behaviour/drawing procedures to make it look as you wish. However, I understand full sources are always useful in situations like yours.
PoLabs wrote:Now we are using TFastLineSeries which was the best solution for us so far. Now I would like to do some custom drawing and I notice in sources that TFastLine is calling Polyline to draw point. This is not an option for us. We will have to manipulate every point in series and decide how to draw it according to surrounding points. So there will be a mixture of drawing each point, more points etc... What would be your suggestion?
By default, TFastLineSeries isn't using Polyline. This technique is faster than drawing segment by segment, but you have to set DrawStyle property to flAll to activate it (by default it's flSegments).
PoLabs wrote:I guess I will have to override DrawAllPoints procedure and do drawing there. How can I retrieve Chart properties and canvas size etc...to get proper dimensions, scaling, offset etc?
If you want to draw something next to each point, you could override TFastLineSeries.DrawValue method instead of TFastLineSeries.DrawAllValues.
As you'll see in the sources, this method starts calculating the X,Y coordinates in pixels for the given ValueIndex (CalcPosition). So it shouldn't be difficult to draw something else relative to these X,Y coordinates.

Don't hesitate to let us know if you still find problems with it.