Page 1 of 1

Chart to Image Problem

Posted: Thu Feb 14, 2008 11:16 pm
by 10546565
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

Posted: Fri Feb 15, 2008 9:29 am
by yeray
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;

Posted: Fri Feb 15, 2008 3:29 pm
by 10546565
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.

Posted: Mon Feb 18, 2008 4:43 pm
by 10546565
no response--this is stopping a release of my application.

Posted: Tue Feb 19, 2008 9:40 am
by yeray
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.

Posted: Tue Feb 19, 2008 1:21 pm
by 10546565
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.

Posted: Wed Feb 20, 2008 10:58 am
by yeray
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.