Hello,
I am investigating the possibility to have dual X scales on a plot (attached is an example), is this something that TChart supports?
Thank you very much for your time
Regards
Dual scale on plot
Dual scale on plot
- Attachments
-
- Screenshot_1.png (26.99 KiB) Viewed 7848 times
Re: Dual scale on plot
Hello,
One possibility could be to use both Horizontal axes (Top and Bottom) as in the following example:
Another similar possibility could be to use a SubAxis. Ie:
One possibility could be to use both Horizontal axes (Top and Bottom) as in the following example:
Code: Select all
procedure TForm1.Chart1GetAxisLabel(Sender: TChartAxis; Series: TChartSeries;
ValueIndex: Integer; var LabelText: string);
begin
if Sender = Chart1.Axes.Bottom then
begin
LabelText:= FormatFloat('#,##0', StrToFloatDef(LabelText, 0) / 10);
end;
end;
procedure TForm1.FormCreate(Sender: TObject);
begin
Chart1.View3D:=False;
Chart1.Legend.Visible:=False;
Chart1.MarginBottom:=10;
with Chart1.AddSeries(THorizLineSeries) as THorizLineSeries do
begin
FillSampleValues;
HorizAxis:=aBothHorizAxis;
end;
Chart1.Axes.Bottom.OtherSide:=True;
Chart1.Axes.Bottom.Grid.Visible:=False;
Chart1.Axes.Bottom.Ticks.Visible:=False;
Chart1.Axes.Bottom.MinorTicks.Visible:=False;
end;
Code: Select all
procedure TForm1.Chart1GetAxisLabel(Sender: TChartAxis; Series: TChartSeries;
ValueIndex: Integer; var LabelText: string);
begin
if Sender = Chart1.Axes.Top.SubAxes[0] then
begin
LabelText:= FormatFloat('#,##0.##', StrToFloatDef(LabelText, 0) / 10);
end;
end;
procedure TForm1.FormCreate(Sender: TObject);
begin
Chart1.View3D:=False;
Chart1.Legend.Visible:=False;
Chart1.MarginBottom:=10;
with Chart1.AddSeries(THorizLineSeries) as THorizLineSeries do
begin
FillSampleValues;
HorizAxis:=aTopAxis
end;
with Chart1.Axes.Top.SubAxes.Add do
begin
Axis.Visible:=False;
LabelsFont.Name:=Chart1.Axes.Top.LabelsFont.Name;
end;
end;
Best Regards,
Yeray Alonso Development & Support Steema Software Av. Montilivi 33, 17003 Girona, Catalonia (SP) | |
Please read our Bug Fixing Policy |
Re: Dual scale on plot
Hello Yeray,
Thank you very much for your prompt reply, I will definitely give it a try
Regards
John
Thank you very much for your prompt reply, I will definitely give it a try
Regards
John