Chart to Image Problem

TeeChart VCL for Borland/CodeGear/Embarcadero RAD Studio, Delphi and C++ Builder.
Post Reply
TestAlways
Advanced
Posts: 228
Joined: Tue Aug 28, 2007 12:00 am
Location: Oregon, USA

Chart to Image Problem

Post by TestAlways » Thu Feb 14, 2008 11:16 pm

I use the image from TCharts in reports--has worked great, until now.

My charts are not always visible in the software--occationally they may be hidden. This is by deisng. This causes a problem.

In the demo here:

http://www.TBInc.com/files/ChartToImageProblem.zip

( I included an EXE so you could see the issue)

The problem is that the chart's axis left axis may not be refreshed when the chart is rendered to a graphic.

Use the following steps to reproduce this in the demo:

1) Click on the 'Low Values' radio button. (This populates the series with smaller values then the higher one will in a moment)

2) Click on the 'Chart to Image' button to see the chart created in an image. Note the left axis matches pretty much what is shown in the chart.

3) Click on the 'Visible 'check to hide the chart.

4) Click on the 'High Values' check box to add great values to the chart.

5) Click on the 'Chart to Image' button again--and see that the left axis looks wrong--the old values are being show, it was not updated.

If this is a bug, it's a show-stopper for me.

Any help?

Thanks
Edward Dressel

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

Post by Yeray » Fri Feb 15, 2008 9:29 am

Hi Edward,

This happens because you populate your series but the chart is not drawn. So you should force it to be calculated adding the following line at the final of your UpdateChart method:

Code: Select all

chrtActValueInGrowth.Draw;
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

TestAlways
Advanced
Posts: 228
Joined: Tue Aug 28, 2007 12:00 am
Location: Oregon, USA

Post by TestAlways » Fri Feb 15, 2008 3:29 pm

9348257 wrote:This happens because you populate your series but the chart is not drawn.
AFAIK, this is a new problem, not something that has been around.

I've redone the demo, where the problem seems similar. When the original chart's width is 800 and the image's width is 200, the values on the X axis overlap.

Here is how it appears correctly (the width of the original chart and the rendered image are the same):

Image

Here is what happens when the rendered image is 1/4 the size of the original chart:

Image

In the demo (http://www.TBInc.com/files/ChartToImageProblem.zip), simply click '200' for the image's width--the values on the X axis are incorrect.

TestAlways
Advanced
Posts: 228
Joined: Tue Aug 28, 2007 12:00 am
Location: Oregon, USA

Post by TestAlways » Mon Feb 18, 2008 4:43 pm

no response--this is stopping a release of my application.

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

Post by Yeray » Tue Feb 19, 2008 9:40 am

Hi Edward,

Sorry for delay.

The last in your method "UpdateChart" is:

Code: Select all

UpdateImage;
If you change it for the following, your problem is solved:

Code: Select all

  if not rbtnImage800.Checked then
    chrtActValueInGrowth.Width := 200;

  UpdateImage;

  if not rbtnImage800.Checked and rbtnChart800.Checked then
    chrtActValueInGrowth.Width := 800;
This is one solution but probably you could find anotherone better. The problem is that you have a big chart that you want to show in a small place. So, to show it well you'll need to draw the original chart smaller and then copy to the image (and restore the original if needed).

Also note that you call a lot of times to Draw function I pointed you before and your application doesn't seem to need it as many as you use it.
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

TestAlways
Advanced
Posts: 228
Joined: Tue Aug 28, 2007 12:00 am
Location: Oregon, USA

Post by TestAlways » Tue Feb 19, 2008 1:21 pm

Obviously, I created this as a demo, not real code.

In my source code, charts will be aligned in various ways--it's not as easy as setting the width/height of the chart.

I've used this method for *years( and have never had a problem until lately--it is a new problem.

Why doesn't the axis fix itself for rendering to a canvas? The chart is passed all of the information? Especially seeing it worked before.

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

Post by Yeray » Wed Feb 20, 2008 10:58 am

Hi Edward,

We'll investigate why changing axis' increment has no effect in the temporal chart. I've added the issue to the wish list to be fixed in further releases (TV52012836).

By meanwhile, you could use the workaround I told you before.
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

Post Reply