More custom axes with same min/max are not drawn equally!

TeeChart VCL for Borland/CodeGear/Embarcadero RAD Studio, Delphi and C++ Builder.
Post Reply
ChartIt
Newbie
Newbie
Posts: 29
Joined: Tue Mar 13, 2007 12:00 am

More custom axes with same min/max are not drawn equally!

Post by ChartIt » Mon Aug 23, 2010 5:45 pm

Hello,

I just upgraded from V7 to V2010, and now I'm angry.
To list all the errors I've found would take too long time,
and lead the focus away from the most critical things at the moment.

They are:

1:
Crash when selecting font tab in the chart editor.
The different fonts can be changed with the Delphi Object Inspector without problems.
See attached screen shot.

2:
When showing more custom axes with the same range (min/max), the first one appears to be "shorter" than the rest.
This results e.g. in grid lines not being positioned perfectly on top of each other.
See attached screen shot.

I'm using Delphi 2006 and TChart v2010

Thanks in advance for any help!
Attachments
More series with overlay.JPG
NOT OK
More series with overlay.JPG (45.68 KiB) Viewed 12040 times
One series OK.JPG
OK
One series OK.JPG (38.58 KiB) Viewed 12035 times
Crash when choosing font tab.JPG
CRASH
Crash when choosing font tab.JPG (128.67 KiB) Viewed 12029 times

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

Re: More custom axes with same min/max are not drawn equally!

Post by Yeray » Tue Aug 24, 2010 2:55 pm

Hi ChartIt,
ChartIt wrote:1:
Crash when selecting font tab in the chart editor.
The different fonts can be changed with the Delphi Object Inspector without problems.
See attached screen shot.
This is a known problem we've already fixed for the next maintenance release (TV52014813)
ChartIt wrote:2:
When showing more custom axes with the same range (min/max), the first one appears to be "shorter" than the rest.
This results e.g. in grid lines not being positioned perfectly on top of each other.
See attached screen shot.
I'm trying to reproduce it with the following code but the grid lines are well aligned.

Code: Select all

uses series;

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

  for i:=0 to 3 do
  begin
    Chart1.AddSeries(TFastLineSeries);
    Chart1[i].Add(Random(10) + 100);
    for j:=1 to 25 do
      Chart1[i].Add(Chart1[i].YValue[j-1] + Random(5) - 2.4);

    if (i = 0) then
    begin
      Chart1[i].VertAxis:=aRightAxis;
      Chart1.Axes.Right.SetMinMax(75,125);
      Chart1.Axes.Right.LabelsFont.Color:=Chart1[i].Color;
    end
    else
    begin
      Chart1.CustomAxes.Add;
      Chart1[i].CustomVertAxis:=Chart1.CustomAxes[i-1];
      Chart1[i].CustomVertAxis.OtherSide:=true;
      Chart1[i].CustomVertAxis.PositionUnits:=muPixels;
      Chart1[i].CustomVertAxis.PositionPercent:=-i*45;
      Chart1[i].CustomVertAxis.Axis.Visible:=false;
      Chart1[i].CustomVertAxis.SetMinMax(75,125);
      Chart1[i].CustomVertAxis.LabelsFont.Color:=Chart1[i].Color;
    end;
  end;

  Chart1.MarginRight:=20;
end;
gridlines.png
gridlines.png (23.92 KiB) Viewed 12005 times
So maybe you are setting a different SetMinMax to one axis and the others?
Please, try to change the code above so the problem can be reproduced here, or arrange a simple example project for the same purpose.
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

ChartIt
Newbie
Newbie
Posts: 29
Joined: Tue Mar 13, 2007 12:00 am

Re: More custom axes with same min/max are not drawn equally!

Post by ChartIt » Wed Aug 25, 2010 5:07 am

Hi,
Thanks for your reply.

With this code you should be able to see the issue:

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

for i:=0 to 3 do
begin
Chart1.AddSeries(TFastLineSeries);
Chart1.Add(Random(10) + 100);
for j:=1 to 25 do
Chart1.Add(Chart1.YValue[j-1] + Random(5) - 2.4);

if (i = 0) then
begin
Chart1.CustomAxes.Add;
Chart1.CustomVertAxis:=Chart1.CustomAxes;
Chart1.CustomVertAxis.OtherSide:=true;
Chart1.CustomVertAxis.PositionUnits:=muPixels;
Chart1.CustomVertAxis.PositionPercent:=-i*45;
Chart1.CustomVertAxis.Axis.Visible:=false;
Chart1.CustomVertAxis.SetMinMax(0,4);
Chart1[i].CustomVertAxis.LabelsFont.Color:=Chart1[i].Color;
Chart1[i].CustomVertAxis.Increment := (Chart1[i].CustomVertAxis.Maximum - Chart1[i].CustomVertAxis.Minimum)/10;
end
else
begin
Chart1.CustomAxes.Add;
Chart1[i].CustomVertAxis:=Chart1.CustomAxes[i];
Chart1[i].CustomVertAxis.OtherSide:=true;
Chart1[i].CustomVertAxis.PositionUnits:=muPixels;
Chart1[i].CustomVertAxis.PositionPercent:=-i*45;
Chart1[i].CustomVertAxis.Axis.Visible:=false;
Chart1[i].CustomVertAxis.SetMinMax(0,400);
Chart1[i].CustomVertAxis.LabelsFont.Color:=Chart1[i].Color;
Chart1[i].CustomVertAxis.Increment := (Chart1[i].CustomVertAxis.Maximum - Chart1[i].CustomVertAxis.Minimum)/10;
end;
end;
Chart1.MarginRight:=20;
end;

When making the Chart big you should see a double grid line, this time in the middle (at 2/200).
Could it be a rounding issue when I'm calculating the Increment?

In the meanwhile I've found another critical issue:
I can't change the cursor by code, it only works with the Chart Editor.

A new project with a fresh TChart, and the following code:

procedure TForm1.FormCreate(Sender: TObject);
begin
Chart1.Cursor := crHourGlass;
end;

doesn't change anything.
Do I have to call any function after changing the cursor to get it updated?
With v7 I didn't experience this.

Best Regards

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

Re: More custom axes with same min/max are not drawn equally!

Post by Yeray » Wed Aug 25, 2010 3:33 pm

Hi ChartIt,

I can't see the double grid line you mention, even with the chart maximized or zooming.
Anyway, you can hide all the grid lines except of one of them. Here it is the example:

Code: Select all

uses Series;

procedure TForm1.FormCreate(Sender: TObject);
var i, j: Integer;
begin
  Chart1.Align:=alClient;
  Chart1.View3D:=false;
  Chart1.Legend.Visible:=false;

  for i:=0 to 3 do
  begin
    Chart1.AddSeries(TFastLineSeries);
    Chart1[i].Add(Random(10) + 100);
    for j:=1 to 25 do
      Chart1[i].Add(Chart1[i].YValue[j-1] + Random(5) - 2.4);

    Chart1.CustomAxes.Add;
    Chart1[i].CustomVertAxis:=Chart1.CustomAxes[i];
    with Chart1[i].CustomVertAxis do
    begin
      OtherSide:=true;
      PositionUnits:=muPixels;
      PositionPercent:=-i*45;
      Axis.Visible:=false;
      LabelsFont.Color:=Chart1[i].Color;

      if (i = 0) then
        SetMinMax(0,4)
      else
      begin
        SetMinMax(0,400);
        Grid.Visible:=false;
      end;

      Increment := (Maximum - Minimum)/10;
    end;
  end;
  Chart1.MarginRight:=20;
end;

procedure TForm1.Chart1Zoom(Sender: TObject);
var i: Integer;
begin
  for i:=0 to Chart1.CustomAxes.Count-1 do
    with Chart1.CustomAxes[i] do
      SetMinMax(CalcPosPoint(Chart1.Zoom.Y1), CalcPosPoint(Chart1.Zoom.Y0));
end;

procedure TForm1.Chart1UndoZoom(Sender: TObject);
var i: Integer;
begin
  for i:=0 to Chart1.CustomAxes.Count-1 do
    if i = 0 then
      Chart1.CustomAxes[i].SetMinMax(0,4)
    else
      Chart1.CustomAxes[i].SetMinMax(0,400);
end;
ChartIt wrote:In the meanwhile I've found another critical issue:
I can't change the cursor by code, it only works with the Chart Editor.
Please, take a look at this thread, there are some solutions proposed:
http://www.teechart.net/support/viewtop ... sor#p29360
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

ChartIt
Newbie
Newbie
Posts: 29
Joined: Tue Mar 13, 2007 12:00 am

Re: More custom axes with same min/max are not drawn equally!

Post by ChartIt » Wed Aug 25, 2010 4:13 pm

Hi,

1:
See enclosed screen shot with my example.
Hiding the grid lines only solves the problem visual, but not the fact that the axes might be scaled different.

2:
Why is the function Chart.Cursor available if it's not working??

3:
New issue (or old??):
Sometimes heavy flickering of the chart when scrolling and changing values of points!
(Think this is solved in next release)

4:
New issue (or old??):
Chart sometimes not repainting when other windows have been on top of it!
(Think this is solved in next release)

I'm getting more and more frustrated :(
Attachments
Grid lines overlap.JPG
Grid lines overlap.JPG (93.56 KiB) Viewed 11981 times

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

Re: More custom axes with same min/max are not drawn equally!

Post by Yeray » Fri Aug 27, 2010 3:11 pm

Hi ChartIt,
ChartIt wrote:1:
See enclosed screen shot with my example.
Hiding the grid lines only solves the problem visual, but not the fact that the axes might be scaled different.
Here it is the project in Delphi 2006 + TeeChart v2010 that works fine for me here.
synchron_axes.zip
(412.91 KiB) Downloaded 530 times
Anyway, as you said, a pixel difference could be because of a rounding that has to be done when passing from values (doubles) to pixels (integers). I think there isn't too much we can do here apart from hiding grids.
ChartIt wrote: 2:
Why is the function Chart.Cursor available if it's not working??
Yes, this is a known issue already in the wish list to be revised in future releases.
ChartIt wrote:3:
New issue (or old??):
Sometimes heavy flickering of the chart when scrolling and changing values of points!
(Think this is solved in next release)
Depending on the number of points you have in your chart, the drawing process will be faster or slower. I'd recommend you to try to implement as many tips as possible from the Real-time Charting article.
If you still have troubles with it, don't hesitate to let us know.
ChartIt wrote:4:
New issue (or old??):
Chart sometimes not repainting when other windows have been on top of it!
(Think this is solved in next release)
Yes, this has been solved for the next maintenance release.
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

ChartIt
Newbie
Newbie
Posts: 29
Joined: Tue Mar 13, 2007 12:00 am

Re: More custom axes with same min/max are not drawn equally!

Post by ChartIt » Sun Aug 29, 2010 1:39 am

Hi,

1:
With Min/Max of 0/4 and 0/400 and then divided by 10 shouldn't lead to any rounding errors,
but never mind, I'll live with it.

3:
I have only the amount of values in the chart corresponding to the chart width in pixels (approx. 700), and have already implemented all relevant parts from that article.
Furthermore the problem didn't show up with TeeChart v7.

Any news about that maintenance release?

Regards

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

Re: More custom axes with same min/max are not drawn equally!

Post by Yeray » Mon Aug 30, 2010 3:27 pm

Hi ChartIt,

We are working on the next maintenance so it can be published asap.
The flickering problem you are suffering may also be fixed with the same bugfix that solved the repainting problem mentioned just above. If you want, you could send us a simple example project we can run as-is to reproduce the problem here and we'll confirm you if it has been solved in the actual sources or not.
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

ChartIt
Newbie
Newbie
Posts: 29
Joined: Tue Mar 13, 2007 12:00 am

Re: More custom axes with same min/max are not drawn equally!

Post by ChartIt » Mon Sep 06, 2010 5:14 am

Hi,

I've found out that the flickering occurs after saving the chart as bitmap (SaveToBitmapFile).
See enclosed test program:
1:
Press btnStart - no flickering occurs.
2:
Press btnStop.
3:
Press btnSaveBmp.
4:
Press btnStart - flickering occurs.
Attachments
Project1.zip
(426.68 KiB) Downloaded 527 times

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

Re: More custom axes with same min/max are not drawn equally!

Post by Yeray » Tue Sep 07, 2010 3:29 pm

Hi ChartIt,

Yes, I can confirm that it should be solved with the next maintenance release. I could reproduce the flickering with the first v2010 and not with the actual sources.
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

ChartIt
Newbie
Newbie
Posts: 29
Joined: Tue Mar 13, 2007 12:00 am

Re: More custom axes with same min/max are not drawn equally!

Post by ChartIt » Wed Sep 08, 2010 12:37 am

OK, thanks.

Do you have a work around for my current version??

Narcís
Site Admin
Site Admin
Posts: 14730
Joined: Mon Jun 09, 2003 4:00 am
Location: Banyoles, Catalonia
Contact:

Re: More custom axes with same min/max are not drawn equally!

Post by Narcís » Wed Sep 08, 2010 11:59 am

Hi ChartIt,

I can't think of a workaround for now but a "non-stable" pre-release version will be published imminently.
Best Regards,
Narcís Calvet / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

Post Reply