Page 1 of 1

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

Posted: Mon Aug 23, 2010 5:45 pm
by 9244525
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!

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

Posted: Tue Aug 24, 2010 2:55 pm
by yeray
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 12007 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.

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

Posted: Wed Aug 25, 2010 5:07 am
by 9244525
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

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

Posted: Wed Aug 25, 2010 3:33 pm
by yeray
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

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

Posted: Wed Aug 25, 2010 4:13 pm
by 9244525
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 :(

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

Posted: Fri Aug 27, 2010 3:11 pm
by yeray
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.

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

Posted: Sun Aug 29, 2010 1:39 am
by 9244525
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

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

Posted: Mon Aug 30, 2010 3:27 pm
by yeray
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.

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

Posted: Mon Sep 06, 2010 5:14 am
by 9244525
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.

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

Posted: Tue Sep 07, 2010 3:29 pm
by yeray
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.

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

Posted: Wed Sep 08, 2010 12:37 am
by 9244525
OK, thanks.

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

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

Posted: Wed Sep 08, 2010 11:59 am
by narcis
Hi ChartIt,

I can't think of a workaround for now but a "non-stable" pre-release version will be published imminently.