Hello,
In my application, I use a chart with many custom axes with different ranges. In order to place the axes so that their labels not overlap I use MaxLabelsWidth() function to get the space needed by each axis for its labels. I’ve noticed that for some values of maximum of axis the MaxLabelsWidth() function returns a wrong value. I’ve checked the ranges of (0,100), (0,200), up to (0,1000) and obtained wrong results for the following ranges: (0,300), (0,400), (0,800) and (0,900).
Thanks for help
Jarek
MaxLabelsWidth error
MaxLabelsWidth error
- Attachments
-
- MaxLAbelsWidthError.zip
- Test project
- (90.24 KiB) Downloaded 399 times
-
- Screenshot
- MaxLabelsWidthError.jpg (258.05 KiB) Viewed 4752 times
Re: MaxLabelsWidth error
Hi Jarek,
You should force a chart repaint before getting the axes max labels width. I'd add all the axes and repaint the chart only once. You could also repaint the chart after adding each custom axis but of course this would mean a lot of repaints as you have many custom axes.
You should force a chart repaint before getting the axes max labels width. I'd add all the axes and repaint the chart only once. You could also repaint the chart after adding each custom axis but of course this would mean a lot of repaints as you have many custom axes.
Code: Select all
Chart1->Draw();
Best Regards,
Yeray Alonso Development & Support Steema Software Av. Montilivi 33, 17003 Girona, Catalonia (SP) | |
Please read our Bug Fixing Policy |
Re: MaxLabelsWidth error
Thank you for your reply.
Unfortunately, the proposed solution is not applicable for my application.
In my application I delete and recreate all axes each time the displayed data are changed so the solution that causes additional flickering is unacceptable for me. Whats more, additional redrawing of the chart after all axes are created doubles the time needed for the view to be rendered.
I’ve used the same code in TeeChart version 7 ant it worked properly - the widths of the labels were correctly calculated by the MaxLabelsWidth() function and the additional redraw was unnecessary.
I’ve analyzed your code and found that if I call InternalCalcPositions() for each axis after its creation and before MaxLabelsWidth() call the later function returns proper values. InternalCalcPositions is a private function so getting access to it isn't pretty. Could you consider modifying MaxLabelsWidth so that calling InternalCalcPositions wouldn't be necessary or propose other workaround?
Regards,
Unfortunately, the proposed solution is not applicable for my application.
In my application I delete and recreate all axes each time the displayed data are changed so the solution that causes additional flickering is unacceptable for me. Whats more, additional redrawing of the chart after all axes are created doubles the time needed for the view to be rendered.
I’ve used the same code in TeeChart version 7 ant it worked properly - the widths of the labels were correctly calculated by the MaxLabelsWidth() function and the additional redraw was unnecessary.
I’ve analyzed your code and found that if I call InternalCalcPositions() for each axis after its creation and before MaxLabelsWidth() call the later function returns proper values. InternalCalcPositions is a private function so getting access to it isn't pretty. Could you consider modifying MaxLabelsWidth so that calling InternalCalcPositions wouldn't be necessary or propose other workaround?
Regards,
Re: MaxLabelsWidth error
hi Jarek,
I've added it to the wish list to be investigated for further releases (TV52015463).
In the meanwhile, if you are source code customer, you could make the InternalCalcPositions method public.
I've added it to the wish list to be investigated for further releases (TV52015463).
In the meanwhile, if you are source code customer, you could make the InternalCalcPositions method public.
Best Regards,
Yeray Alonso Development & Support Steema Software Av. Montilivi 33, 17003 Girona, Catalonia (SP) | |
Please read our Bug Fixing Policy |