Page 1 of 2
Logarithmic scale issue
Posted: Wed Feb 10, 2010 12:08 pm
by 10055200
Hi,
I was using Teechart v7 so far but now we bought version 8.
I have some charts with logarithmic bottom axis (choose between log or lin) and in version 7 I set Logarithmic to true and if I delete all BottomAxis.Items (clear) and set increment to 0 everything works ok. Now in version 8 this doesn't work anymore.
On zoom/undo zoom I am redrawing scale using code (RedrawGrid on Zoom/UndoZoom)
Code: Select all
with Chart.BottomAxis do
begin
tmpIncrement := Abs(Minimum - Maximum)/10;
Items.Clear;
tmpValue:=Minimum;
while tmpValue <= Maximum do
begin
with Items.Add(tmpValue) do
begin
Text := Format('%5.2f' ,[tmpValue]);
Font.Color := clSilver;
end;
tmpValue:=tmpValue+tmpIncrement;
end;
if FFFTXScaleType = atLog then
Items.Clear;
end;
with Chart.LeftAxis do
begin
tmpIncrement := Abs(Minimum - Maximum)/10;
Items.Clear;
tmpValue:=Minimum;
while tmpValue <= Maximum do
begin
with Items.Add(tmpValue) do
begin
Text := Format('%5.2f' ,[tmpValue]);
Font.Color := clSilver;
end;
tmpValue:=tmpValue+tmpIncrement;
end;
end;
and set axis props (on Log axis set):
Code: Select all
Title.Caption := 'Frequency (Hz)';
Logarithmic := true;
MinorTickCount := 8;
MinorGrid.Visible := true;
MinorGrid.Style := psDot;
MinorGrid.Color := clGray;
Grid.Style := psDot;
AxisValuesFormat := '00e-0';
LabelsExponent := true;
FMin := 0;
FMax := 1e6;
SetMinMax(FMin, FMax);
Increment := 0;
This two parts of code works ok with TeeChart version 7 but not with version 8. What should I change to work it with 8? I tried several things but without success.
Thank you for your help.
Re: Logarithmic scale issue
Posted: Wed Feb 10, 2010 12:09 pm
by 10055200
Question is about proper way to redraw logarithmic grid.
Re: Logarithmic scale issue
Posted: Wed Feb 10, 2010 2:32 pm
by narcis
Hi PoLabs,
Axes grid and labels are calculated automatically every time the chart is repainted: after zooming, after scrolling, after unzooming, after adding new values, after changing some chart objects properties, etc. You can also customise labels using OnGetAxisLabel and OnGetNextAxisLabel event. You'll find some examples of this in tutorial 4. Tutorials can be found at TeeChart's program group.
I'm not sure about which is the problem you are having. Could you please attach a simple example project we can run "as-is" to reproduce the problem here?
Thanks in advance.
Re: Logarithmic scale issue
Posted: Wed Feb 10, 2010 3:58 pm
by 10055200
Hi,
Here are attached some videos:
Control with TeeChart 7:
http://www.sekopt.si/temp/teechart7.avi
and again same video with control and TeeChart 8:
http://www.sekopt.si/temp/teechart8.avi
You will notice the difference in bottom axis. Grid on second video(TeeChart
is not visible for bottom axis although the source code is the same as for fist video (TeeChar 7).
So my question are there any differences between version 7 and version 8 regarding axis properties. I am trying to show grid but without succes (if I use code which I used for version 7).
Best regards,
PoLabs
Re: Logarithmic scale issue
Posted: Wed Feb 10, 2010 6:57 pm
by narcis
Hi PoLabs,
Thanks for the videos. I see which the problem is now. Would you be so kind to arrange a simple example project with which we can reproduce the problem here so that we can debug it and try to find a solution to it?
Thanks in advance.
Re: Logarithmic scale issue
Posted: Thu Feb 11, 2010 9:33 am
by 10055200
Hi,
I made an example which does exactly what I do in my original code.
First example was built with Codegear Delphi 2007 and TeeChart v7
Link:
http://www.sekopt.si/temp/TeeChartTestv7.rar
Second example was built with Embarcadero Delphi 2010 and TeeChart v8
Link:
http://www.sekopt.si/temp/TeeChartTestv8.rar
You will see the difference in programs when you will switch between bottom axis type from Linear to Logarithmic. (although the code is the same for both cases)
Thanks for help,
Best regards,
PoLabs
Re: Logarithmic scale issue
Posted: Thu Feb 11, 2010 11:15 am
by narcis
Hi PoLabs,
Thanks for the example projects. I think that it worked in v7 because of a bug in v7
It works fine in both version implementing RedrawGrid as shown below. That is removing all bottom axis related code. The problem is this:
Code: Select all
if (FLogarithmic) then
Items.Clear;
Which, for some unknown reason, in v7 doesn't remove bottom axis labels
but it does in v8. Therefore you don't see any logarithmic label in v8. Can you please check if code below works fine at your end?
Code: Select all
procedure TForm1.RedrawGrid;
var tmpIncrement, tmpValue: double;
AxisItem: TAxisItem;
Idx: integer;
begin
{ with Chart.Axes.Bottom do
begin
tmpIncrement := Abs(Minimum - Maximum)/10;
Items.Clear;
tmpValue:=Minimum;
while tmpValue <= Maximum do
begin
with Items.Add(tmpValue) do
begin
Text := Format('%5.2f' ,[tmpValue]);
Font.Color := clBlack;
end;
tmpValue:=tmpValue+tmpIncrement;
end;
if (FLogarithmic) then
Items.Clear;
end;
}
with Chart.Axes.Left do
begin
tmpIncrement := Abs(Minimum - Maximum)/10;
Items.Clear;
tmpValue:=Minimum;
while tmpValue <= Maximum do
begin
with Items.Add(tmpValue) do
begin
Text := Format('%5.2f' ,[tmpValue]);
Font.Color := clBlack;
end;
tmpValue:=tmpValue+tmpIncrement;
end;
end;
end;
Re: Logarithmic scale issue
Posted: Thu Feb 11, 2010 12:03 pm
by 10055200
This works for me but when the reason why I am using Redraw for bottom axis is becouse when I zoom or unzoom I always want to have 10 divisions on chart per bottom axis (always 10 vertical lines in grid).
How can I solve this?
Thanks,
PoLabs
Re: Logarithmic scale issue
Posted: Thu Feb 11, 2010 2:03 pm
by 10055200
Actually I want the same effect like in version 7.
Best regards,
PoLabs
Re: Logarithmic scale issue
Posted: Thu Feb 11, 2010 3:19 pm
by narcis
Hi PoLabs,
I get the same behaviour using both versions as you can see in the video below (best viewed with Internet Explorer):
http://www.teechart.net/files/public/su ... s.swf.html
I also attach the v8 project I'm using. Are you using v8.06 VCL? Do you get the same behaviour at your end?
Thanks in advance.
Re: Logarithmic scale issue
Posted: Thu Feb 11, 2010 3:40 pm
by narcis
Hi PoLabs,
It seems there are some problems to visualize the flash video. If that occurs you can download an avi file here:
http://www.teechart.net/files/public/support/PoLabs.zip
Re: Logarithmic scale issue
Posted: Thu Feb 11, 2010 4:14 pm
by 10055200
Hi,
Thanks for reply. I have installed TeeChat Pro v8.06.60902 Win32 (with Delphi 2010 and 64bit Win7) and on other machine I have installed TeeChart Pro v7.12 win 32 (with Delphi 2007 and 32 bit WinXp). I was transfering sources fro Delphi 2007 to Delphi 2010 and the only differnece was in this issue with TeeChart V8 in Delphi 2010.
Best regards,
PoLabs
Re: Logarithmic scale issue
Posted: Thu Feb 11, 2010 4:16 pm
by narcis
Hi PoLabs,
Thanks for you feedback. So I assume the issue is solved now, right
Thanks in advance.
Re: Logarithmic scale issue
Posted: Thu Feb 11, 2010 4:22 pm
by 10055200
No I was just explaining my steps, the problem still persists. I will try to reinstall TeeChart, delete all dcus and rebuild.
I really don't know where is the problem.
Best regards,
PoLabs
Re: Logarithmic scale issue
Posted: Thu Feb 11, 2010 4:39 pm
by narcis
Hi PoLabs,
I also attach the *.exe files I compiled here. Do they work fine for you?
Please check that latest TeeChart version "Bin" and "Lib" folders are on top of the search path list at Project -> Options -> Directories/Conditionals.