Page 1 of 1

Bug in chart editor BMP export

Posted: Fri Jan 17, 2014 1:31 pm
by 16568293
Hi,

exporting a chart in BMP format by the chart editor seems to fail. It only exports one series. The preview shows all series correctly. But saving is not ok.

Uli

Re: Bug in chart editor BMP export

Posted: Fri Jan 17, 2014 4:14 pm
by yeray
Hi Uli,

What exact TeeChart version and IDE are you using?
Also, please arrange a simple example project we can run as-is to reproduce the problem here.

Here with Delphi 7, Teechart Pro v2013.09, I create a new application, I drop a TChart and a TTeeCommander into the form and I use the following code:

Code: Select all

procedure TForm1.FormCreate(Sender: TObject);
var i: Integer;
begin
  for i:=0 to 3 do
    Chart1.AddSeries(TBarSeries).FillSampleValues;
end;
Then, I open the editor through the commander and I export the chart as a bmp throught the "Save..." button in the "Export/Picture" tab, having "Bitmap" selected as Format. And here it is the result I get (I zipped the bmp because the forum doesn't allow bmp extension for the attachments):
test.zip
(30.15 KiB) Downloaded 751 times

Re: Bug in chart editor BMP export

Posted: Fri Jan 17, 2014 5:11 pm
by 16568293
Hello Yeray,

it seems I have to dig a but deeper in my program.
Creating your test example also works here (Delphi XE4, TeeChart pro v2013.11).

But it does not work correctly in my application.
So if I load two series at once both series are exported. If I load one series, export it and then add another series the export of both series does not work, only the first series is still exported.
As this fault is not happening with a quick test example the problem must be caused by another reason. So I must dig in.
I'll come back.

Uli

Re: Bug in chart editor BMP export

Posted: Wed Jan 22, 2014 2:47 pm
by 16568293
Hello again,

I like to come back to the problem.
So I have created a small project that you can download by https://drive.google.com/file/d/0B8QsTW ... sp=sharing
The project contains the pas, dfm, dpr file as well as the exe file (renamed as exx).
So you can run the program and add a curve by a button click. The chart editor will then automatically get opened.

So now simply add a curve, go to the export tab in the editor and check the bmp preview. Add another curve and check the preview again.
Obviously something is wrong as only the first curve is shown.

But I don't know what is the reason.

Here is the code of the test program:

Code: Select all

procedure TMainForm.Button1Click(Sender: TObject);
begin
  if (activeseries<1) or (activeseries>3) then
  begin
    activeseries := 1;
    Series1.Clear;
    Series2.Clear;
    Series3.Clear;
  end;
  case activeseries of
  1: Series1.FillSampleValues(100);
  2: Series2.FillSampleValues(100);
  3: Series3.FillSampleValues(100);
  end;
  activeseries := activeseries+1;
  ChartEditor1.Execute;
end;
Thanks in advance for your help.
I'm using XE4.

Uli

Re: Bug in chart editor BMP export

Posted: Thu Jan 23, 2014 10:22 am
by yeray
Hello Uli,

Thanks for the project. The chart in your project has some settings made at design time, making a bit more difficult to identify what exact property or combination of properties is causing this.
I've identified it seems to happen when you use GDI and you initialize the hiding the Legend Shadow. So the options to workaround this are:
- Use GDI+ instead of GDI.
- Make the Legend Shadow visible at design time (or at FormCreate, before the chart has been drawn) and hide it at runtime, after a chart repaint.
Ie, in your project, if I add the FormCreate event and this code, it works fine:

Code: Select all

procedure TMainForm.FormCreate(Sender: TObject);
begin
   Chart1.Legend.Shadow.Visible:=true;
   Chart1.Draw;
   Chart1.Legend.Shadow.Visible:=false;
end;

Re: Bug in chart editor BMP export [solved]

Posted: Thu Jan 23, 2014 10:40 am
by 16568293
Hello Yeray,

thanks.
I prefer to use your code example as I do not like the blurred GDI+ picture.

All the best (still wondering about the side effect of the legend shadow on BMP export)
Uli