decimals on axis

TeeChart VCL for Borland/CodeGear/Embarcadero RAD Studio, Delphi and C++ Builder.
Post Reply
Werner
Newbie
Newbie
Posts: 46
Joined: Mon Aug 06, 2007 12:00 am

decimals on axis

Post by Werner » Mon May 21, 2012 11:47 am

Hi,

I use Tchart 8 professional.
I set the decimal to a fix one e.g LeftAxis.AxisValuesFormat:=0.0

If I zoom the axisvalue is always the same : for e.g. 1.1/1.1/1.1
So what can I do, that the format changes so that the last digit is different.
Example : I zoom -> the axis is 1.11/1.12/1.13
I zoom more the axis is 1.111/1.112/1.113 and so on

with best regards
Werner

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

Re: decimals on axis

Post by Yeray » Tue May 22, 2012 2:12 pm

Hi Werner,

By default, the AxisValuesFormat is '#.##0,###'. But you can change it as you want adding more decimals if you need them.
You even could calculate the string in the OnZoom event to add more or less decimals. It could be something similar to this:

Code: Select all

procedure TForm1.Chart1Zoom(Sender: TObject);
var Range: Double;
    i: Integer;
    valueFormat: String;
begin
  Range:=(Chart1.Axes.Bottom.Maximum-Chart1.Axes.Bottom.Minimum);
  Chart1.Draw;

  valueFormat:='#,##0.#';
  i:=1;
  while ((Range / Chart1.Axes.Bottom.Items.Count) * (i*10) < 1) do
  begin
    Inc(i);
    valueFormat:=valueFormat+'#';
  end;

  Chart1.Axes.Bottom.AxisValuesFormat:=valueFormat;
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

Post Reply