Page 1 of 1

Adjusting box width according to position

Posted: Sun Mar 13, 2016 12:52 am
by 16466355
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

Re: Adjusting box width according to position

Posted: Mon Mar 14, 2016 3:47 pm
by yeray
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.

Re: Adjusting box width according to position

Posted: Tue Mar 15, 2016 1:11 am
by 16466355
That worked great. Thanks so much!