Log scale on axis

TeeChart VCL for Borland/CodeGear/Embarcadero RAD Studio, Delphi and C++ Builder.
Post Reply
PoLabs
Newbie
Newbie
Posts: 28
Joined: Wed Jun 06, 2007 12:00 am

Log scale on axis

Post by PoLabs » Tue Sep 22, 2009 1:26 pm

Hi,

I would like to draw type of chart like BODE plot is.

See it here:
Image

I have problems with bottom axis. I set Log property to true but how can I achieve that lines would be like on attached pictures? I tried with Increment property but without success.

I would like to mark the same as on attached picture: 10^-1 1 10 10^2 etc... how can be done this?

Could you please help me.

Thank you very much.

Best regards,
Aljosa

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

Re: Log scale on axis

Post by Yeray » Tue Sep 22, 2009 2:46 pm

Hi Aljosa,

Try doing like following:

Code: Select all

  with Chart1.Axes.Bottom do
  begin
    Logarithmic := true;
    SetMinMax(1, 1000);
    MinorTickCount := 8;
    MinorGrid.Visible := true;
    MinorGrid.Style := psDot;
    MinorGrid.Color := clGray;
    Grid.Style := psDot;
    AxisValuesFormat := '00e-0';
    LabelsExponent := true;
  end;
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

PoLabs
Newbie
Newbie
Posts: 28
Joined: Wed Jun 06, 2007 12:00 am

Re: Log scale on axis

Post by PoLabs » Wed Sep 30, 2009 8:10 am

Hi,

i still have some problems. Your suggestion doesn't work for me. :( I attached picture of chart where I used your code.

Image

The green lines represent MinorGrid.

I used your code

Code: Select all

  with Chart.Axes.Bottom do
      begin
        SetMinMax(0, 1000);
        Increment := 10;                      // this is mine... i tried different values without succes
        Logarithmic := true;
        MinorTickCount := 8;
        MinorGrid.Visible := true;
        MinorGrid.Style := psDot;
        MinorGrid.Color := clGreen;
        Grid.Style := psDot;
        AxisValuesFormat := '00e-0';
        LabelsExponent := true;
      end;
Initialization part for my graph is:

Code: Select all

  with Chart do
  begin
    BottomAxis.Maximum := 1e6;
    BottomAxis.Minimum := 0;
    BottomAxis.PositionPercent := 0.0;
    BottomAxis.Increment := 100;
    BottomAxis.Labels := true;
    BottomAxis.LabelsOnAxis := true;
    BottomAxis.LabelsFont.Color := clWhite;
    BottomAxis.LabelsSize := 10;
    BottomAxis.Title.Caption := 'Frequency (Hz)';
    BottomAxis.Title.Font.Color := clWhite;
    BottomAxis.Title.Font.Style := [fsBold];

    LeftAxis.Maximum := 20;
    LeftAxis.Minimum := 0;
    LeftAxis.PositionPercent := 0.0;
    LeftAxis.Increment := 2;
    LeftAxis.Labels := true;
    LeftAxis.LabelsOnAxis := true;
    LeftAxis.LabelsFont.Color := clWhite;
    LeftAxis.LabelsSize := 10;
    LeftAxis.Title.Caption := 'Amplitude (V)';
    LeftAxis.Title.Angle := 90;
    LeftAxis.Title.Font.Color := clWhite;
    LeftAxis.Title.Font.Style := [fsBold];
end;
What am I doing wrong? Thanks for your help!

Best regards
Aljosa

PoLabs
Newbie
Newbie
Posts: 28
Joined: Wed Jun 06, 2007 12:00 am

Re: Log scale on axis

Post by PoLabs » Wed Sep 30, 2009 1:40 pm

I found out solution. Increment must be 0 and then is ok.

Best regards
Aljosa

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

Re: Log scale on axis

Post by Yeray » Thu Oct 01, 2009 8:30 am

Hi Aljosa,
PoLabs wrote:I found out solution. Increment must be 0 and then is ok.
I'm happy to hear that!
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

Post Reply