Page 1 of 1

Re-calibrating Axis Labels when Exporting...

Posted: Mon Mar 09, 2009 3:15 pm
by 10545679
I'm adding chart image exporting capabilities to my application. One of the features is that the user can select the size of the resulting image. The code is relatively straightforward. However when the source chart is much bigger than the resulting image, the axis labels get "scrunched up". See below:

Image

Here is a demo project to illustrate what I'm doing:

http://www.cozmix.com/misc/tchartscale.zip

What I would like would be for the axis label to re-calibrate on the exported image like they do when you reduce the size of a TChart e.g.

Image

Is this possible? I hope there's a way to do this!

Thanks,

Steve

Posted: Tue Mar 10, 2009 12:54 pm
by yeray
Hi Steve,

I've tested your sample application and I've seen that using Assign method causes some strange behavior with the axes.

I've added this to be revised for further releases (TV52013950), but in the meanwhile, please use the following code instead of Assign method. This seems to work fine:

Code: Select all

  With xChart do
    begin
      ColorPaletteIndex := Chart1.ColorPaletteIndex;
      Foot       := Chart1.Foot;
      Legend     := Chart1.Legend;
      SubFoot    := Chart1.SubFoot;
      SubTitle   := Chart1.SubTitle;
      Title      := Chart1.Title;
      Walls      := Chart1.Walls;
    end;

Posted: Tue Mar 10, 2009 1:08 pm
by 10545679
Yeray,

Thanks for looking into it. I have tested the solution and it seems to work - many thanks. However, I don't understand how you can assign object pointers, free the object and not have an AV. For example, will Chart1.Foot etc be freed when xChart is freed?

Cheers,

Steve

Posted: Tue Mar 10, 2009 2:55 pm
by 10545679
Yeray,

On further investigation I realize that (of course) the Axis formats are not copied. So this is definitely a high priority fix for me. Hotfixes are welcome!

Thanks,

Steve

Posted: Tue Mar 10, 2009 3:48 pm
by narcis
Hi Steve,
However, I don't understand how you can assign object pointers, free the object and not have an AV. For example, will Chart1.Foot etc be freed when xChart is freed?
No, Chart1.Foot will be freed by Chart1's destructor when it's freed.

Posted: Thu Mar 19, 2009 3:18 pm
by 10545679
9348257 wrote:I've added this to be revised for further releases (TV52013950)....
Has this bug been fixed? It's getting really quite urgent. Any idea when it will be fixed?

Thanks,

Steve

Posted: Fri Mar 20, 2009 11:38 am
by narcis
Hi Steve,

The issue hasn't been fixed yet nor I can provide an estimate date at the present moment. In the meantime you can use the workaround Yeray suggested.

Posted: Fri Mar 20, 2009 11:41 am
by 10545679
Thanks for the reply. The work around does not copy all of the properties over e.g. the axis format and min max properties are not copied. So I really would like to see a fix for this problem.

Many thanks,

Steve Maughan