Recent

Author Topic: TAChart logaritmic scale labels  (Read 1590 times)

Marq01

  • New Member
  • *
  • Posts: 13
TAChart logaritmic scale labels
« on: December 14, 2015, 02:21:31 pm »
Hi,

I am trying to make a logarithmic x-axis with TChart.
I want to have the label format like 1.0E-9.
With the Marks-Format function I only get 1.0E-009 (format %1.0e).
Anyone a tip how to resolve this?
Thanks
Arnoud

wp

  • Hero Member
  • *****
  • Posts: 11923
Re: TAChart logaritmic scale labels
« Reply #1 on: December 14, 2015, 03:20:05 pm »
Use the OnMarkToText event of the axis which gives you more control of the mark formatting process:
Code: Pascal  [Select][+][-]
  1. procedure TForm1.Chart1AxisList0MarkToText(var AText: String; AMark: Double);
  2. begin
  3.   AText := FormatFloat('0.0E-0', AMark);       // AMark = 10.0 --> 1.0E1
  4.   // AText := FormatFloat('0.0E+0'. AMark);    //              --> 1.0E+1
  5.   // AText := FormatFloat('0.0E+00', AMark);   //              --> 1.0E+01
  6.   // AText := FormatFloat('0.00E+00', AMakr);  //              --> 1.00E+01
  7. end;

Marq01

  • New Member
  • *
  • Posts: 13
Re: TAChart logaritmic scale labels
« Reply #2 on: December 14, 2015, 07:26:11 pm »
Perfect,
Thanks for pointing out this method.

 

TinyPortal © 2005-2018