Page 1 of 1

problem with axis labeling and grid

Posted: Mon Mar 02, 2009 2:48 pm
by 10551564
Hi,

we just switched from TeeChart 7.06 to 8.04.
Compiling the same project with 8.04 gives unexpected results for the axis in some cases.

I've uploaded some pictures at http://www.steema.net/upload/ .


At Problem with axis label and grid Pic3.jpg you see a chart with left axis from 0 to 200.
Changing the axis to -100 to 300 shows the expected result (see: Problem with axis label and grid Pic2.jpg).


In our application there is a function which clones a chart, thus makes a copy of the source chart and pastes it to the destination chart.

Now the problem becomes visible (see: Problem with axis label and grid Pic3.jpg):

The font of the labeling has changed and changing the left axis to -200 and 500 shows there is no grid and no labeling between 300 and 500 and between -200 and -100.

Using the chart editor to change the font size or color of the labeling doesn't show any effect.
Changing the color of the grid changes only the color of the lines already visible, but doesn't bring up the unvisible lines.

Saving the chart as tee-text-file before and after shows no difference in the two files.
After saving the chart and loading it as a new chart the axis behaves normal.


Do you have any idea what could cause this problem?

Is there a workaround to delete the axis and recreate it new at runtime?


Thanks and best regards

Posted: Mon Mar 02, 2009 3:49 pm
by yeray
Hi Heinz,

I've tried to draw a chart similar to your and tried to reproduce your problem but I couldn't. Could you try this code and see if you could reproduce the problem?

Code: Select all

uses series, teestore;

procedure TForm1.FormCreate(Sender: TObject);
var i: Integer;
begin
  Chart1.Color := clWhite;
  Chart1.View3D := false;
  Chart1.Legend.Visible := false;

  Chart1.AddSeries(TLineSeries.Create(self));
  Chart1[0].ParentChart := Chart1;
  Chart1[0].Color := clRed;
  Chart1[0].Pen.Width := 2;

  for i := 0 to 90 do
    Chart1[0].AddXY(i+1,(i+1)*2);

  with Chart1.Axes.Left do
  begin
    SetMinMax(0,200);
    Grid.Style := psSolid;
    Grid.Color := clBlack;
    Ticks.Visible := false;
    TicksInner.Visible := false;
    Increment := 50;
  end;

  with Chart1.Axes.Bottom do
  begin
    SetMinMax(0,100);
    Grid.Style := psSolid;
    Grid.Color := clBlack;
    Ticks.Visible := false;
    TicksInner.Visible := false;
    Increment := 10;
  end;
end;

procedure TForm1.Button1Click(Sender: TObject);
begin
  Chart1.Axes.Left.SetMinMax(-100,300);
end;

procedure TForm1.Button2Click(Sender: TObject);
begin
  SaveChartToFile(Chart1,'C:\tmp\testing1.tee');
end;

procedure TForm1.Button3Click(Sender: TObject);
var tmpChart:TCustomChart;
begin
  Chart1.Free;   //assuming Chart1 is already on the Form
  tmpChart:=TChart.Create(Self);
  LoadChartfromFile(tmpChart,'C:\tmp\testing1.tee');
  Chart1 := tmpChart as TChart;
  With Chart1 do
  begin
    Parent:=Self;
  end;
end;

Problem with axis and grid

Posted: Tue Mar 03, 2009 10:12 am
by 10551564
Hi Yeray,

I tried your code. But I could not reproduce the problem with it. Then I tried to force an error by doing not recommended things like axis.automatic:=true and setting then min- and max-values. But it was not possible to get the same behaviour as in my application.

Now I uploadad my application at http://www.steema.net/upload. Please have a look at it and try to get the axis work as usual with help of the ChartEditor.

Thanks and best regards!

Posted: Tue Mar 03, 2009 12:05 pm
by yeray
Hi Heinz,

Thank you for sending us your program but I'm afraid that tpl files aren't very familiar to us. I've seen that they contain info similar to the delphi's dfm files but I don't know what IDE should I use to open your project although I think that you haven't sent the whole code.

On the other hand, your application seems to be too big and probably it probably wouldn't be an easy to debug application for us. So it would be really helpful if you could reproduce the problem in a new simple project we can run and edit here. And even better if it could be with a delphi IDE, for example.

Thanks in advance.

Posted: Tue Mar 03, 2009 12:28 pm
by 10551564
Hi Yeray,

I've sent the compiled exe-file to you, the other files are ini- and template-files which are neede for executing. So you only have to start the executable and do the few steps described int the doc.
I didn't want you to debug our application, but seeing the problem in the real environment could make things more clear.

Now the good news:
It seems that I've found another solution for duplicating the chart without problems by saving and loading it to stream.

Posted: Tue Mar 03, 2009 4:26 pm
by yeray
Hi Heinz,

I'm happy to see that you've found a way to do this without problems.

In the other hand, if we can't see the whole code that seems to cause a conflict, we can't attack it. that's why we always try to see what exactly are the customers doing in order to solve the issues.