Hello,
is it possible to have a fixed pixel interval (say 150px) between horizontal major ticks? If the user resizes the form (and the chart within), labels are rearranged and sometimes look odd.
My goal is to place a label at each major tick every 150 pixels, so resizing the chart does not make the labels jump.
Regards,
Guido
TeeChart 8.05: Fixed pixel interval between major ticks
Re: TeeChart 8.05: Fixed pixel interval between major ticks
Hello Guido,
I have made a simple example for you using OnGetAxesLabels:
In code you can see values are in determinate range that you can adjust as you want. Please could you tell us if previous code behave as you expected?
I hope will helps.
Thanks,
I have made a simple example for you using OnGetAxesLabels:
Code: Select all
var
Form1: TForm1;
AntValue:Integer;
implementation
{$R *.dfm}
uses Series;
procedure TForm1.FormCreate(Sender: TObject);
var Series1:TLineSeries;
i:Integer;
begin
AntValue:=0;
Series1 := TLineSeries.Create(self);
Chart1.AddSeries(Series1);
Chart1.Align:=alClient;
For i:=0 to 10 do
Series1.AddXY(i,Random(100),IntToStr(i));
end;
procedure TForm1.Chart1GetAxisLabel(Sender: TChartAxis;
Series: TChartSeries; ValueIndex: Integer; var LabelText: String);
var Value:Integer;
begin
If ValueIndex<>-1 then
begin
If Sender = Chart1.Axes.Bottom then
begin
Value := Chart1.Axes.Bottom.CalcXPosValue(ValueIndex);
If (Value-AntValue>100) and (Value-AntValue<=150) then
LabelText:= 'XValue'+IntToStr(Value);
AntValue:=Value;
end;
end;
end;
I hope will helps.
Thanks,
Best Regards,
Sandra Pazos / Development & Support Steema Software Avinguda Montilivi 33, 17003 Girona, Catalonia Tel: 34 972 218 797 http://www.steema.com |
Instructions - How to post in this forum |