Adjusting box width according to position

TeeChart VCL for Borland/CodeGear/Embarcadero RAD Studio, Delphi and C++ Builder.
Post Reply
sde
Newbie
Newbie
Posts: 21
Joined: Fri Jun 21, 2013 12:00 am

Adjusting box width according to position

Post by sde » Sun Mar 13, 2016 12:52 am

Hi,

In the program that I support, we allow the user to plot numerous TBoxSeries/THorizBoxSeries on a single chart and allow the user to designate how much space they want between them (controlled by the position property). However, we then want to adjust the box width accordingly (fatter when there is more space between consecutive boxplots and thinner when the boxplots are closer together) otherwise with a fixed box width, they overlap when you move them closer together.

My first thought was to use the CalcPosValue functions, which weren't working until I realized that they only work after the chart has been drawn. So then I tried to add CalcPosValue to the AfterDraw event of the TChart in question, but it is not working for me there either.

Also, the AfterDraw is not a good method for me in general even if it did work because we have a batch functionality where we don't draw the charts to screen but go straight to export.

So can you please provide any help or suggestions for how to implement the feature I have described to adjust boxplot width according to position without having to resort to drawing the chart?

Thanks!
SDE

Yeray
Site Admin
Site Admin
Posts: 9612
Joined: Tue Dec 05, 2006 12:00 am
Location: Girona, Catalonia
Contact:

Re: Adjusting box width according to position

Post by Yeray » Mon Mar 14, 2016 3:47 pm

Hello,

You can try forcing a chart repaint (Chart1.Draw; ) at OnCreate and using CalcPos* functions after it, once the internal properties have been set.
Best Regards,
ImageYeray Alonso
Development & Support
Steema Software
Av. Montilivi 33, 17003 Girona, Catalonia (SP)
Image Image Image Image Image Image Please read our Bug Fixing Policy

sde
Newbie
Newbie
Posts: 21
Joined: Fri Jun 21, 2013 12:00 am

Re: Adjusting box width according to position

Post by sde » Tue Mar 15, 2016 1:11 am

That worked great. Thanks so much!

Post Reply