Need to show multiple X axis with different data

TeeChart for Microsoft Visual Studio .NET, Xamarin Studio (Android, iOS & Forms) & Monodevelop.
Post Reply
Newbie
Newbie
Posts: 2
Joined: Thu Jan 27, 2022 12:00 am

Need to show multiple X axis with different data

Post by » Wed May 18, 2022 9:17 am

Hello,
Greetings.

I got an assignment to display a chart which has a multiple X axes. It will show different data as pass it through a dataset. I tried to add sub-axes at bottom and but it is not showing attached labels on it. My first bottom (X) axis is perfect and I want to add more X axis to this chart. See pic.
MultiXAxes_Issue.png
MultiXAxes_Issue.png (308.54 KiB) Viewed 389 times
MultiXAxes_Issue1.png
MultiXAxes_Issue1.png (207.92 KiB) Viewed 389 times

Christopher
Guru
Posts: 1417
Joined: Fri Nov 15, 2002 12:00 am

Re: Need to show multiple X axis with different data

Post by Christopher » Fri May 20, 2022 12:38 pm

Hello,

apologies for the delay in response to this message.

There are several questions related to 'multiple axes' and 'multiple custom' which may be of help; there is also the .NET Framework Windows Forms sample which has a couple of demos on custom axes:
Screenshot from 2022-05-20 14-35-49.png
Screenshot from 2022-05-20 14-35-49.png (184.94 KiB) Viewed 359 times
Screenshot from 2022-05-20 14-36-02.png
Screenshot from 2022-05-20 14-36-02.png (225.4 KiB) Viewed 359 times
If you still require help, could you please consider producing a Minimal, Reproducible Example we can run here?
Best Regards,
Christopher Ireland / 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

Newbie
Newbie
Posts: 2
Joined: Thu Jan 27, 2022 12:00 am

Re: Need to show multiple X axis with different data

Post by » Wed May 25, 2022 10:36 am

Thank you for your response. Tried example shared by you but not getting as per our requirement. pls see below image.
MultiXAxes_Issue2.png
MultiXAxes_Issue2.png (400.1 KiB) Viewed 305 times
my code:

'line2
Y2 = (From p In dtMasterSales.Tables(1).AsEnumerable() Select p.Field(Of Single)(sTagColNm)).ToArray()
With line2
.Color = Drawing.Color.Red
.Title = "PIC101 (bar)"
.VertAxis = "Left"
.Add(dateIdx2, Y2)
.Labels = sLabels2
.XValues.DateTime = True
.Legend.Visible = False
.Visible = True
End With

Line2Min = 0
Line2Max = 3

line2.CustomVertAxis = AxsLine2
With AxsLine2
.AxisPen.Visible = True
.Increment = 1
.AxisPen.Color = line2.Color
.SetMinMax(Line2Min, Line2Max)
.Automatic = False
.PositionUnits = Steema.TeeChart.PositionUnits.Percent
.RelativePosition = 15
.Visible = True
.Grid.Visible = False
End With

tChart1.Axes.Custom.Add(AxsLine2)
tChart1(1).CustomVertAxis = AxsLine2

'------- Bottom axis code
Dim AxsLine4 As New Steema.TeeChart.Axis(True, False, tChart1.Chart)

With AxsLine4
.AxisPen.Visible = True
.Increment = 0
.AxisPen.Color = line2.Color
.Automatic = False
.PositionUnits = Steema.TeeChart.PositionUnits.Percent
.RelativePosition = 15
.Visible = True
.StartPosition = AxsLine2.RelativePosition
.EndPosition = 100 '- AxsLine2.RelativePosition
.Grid.Visible = False
.Labels.MultiLine = False
.Labels.Angle = 20
End With

tChart1.Axes.Custom.Add(AxsLine4)
tChart1(1).CustomHorizAxis = AxsLine4
line2.CustomHorizAxis = AxsLine4
line2.CustomHorizAxis.Visible = True

Christopher
Guru
Posts: 1417
Joined: Fri Nov 15, 2002 12:00 am

Re: Need to show multiple X axis with different data

Post by Christopher » Thu May 26, 2022 8:32 am

Hello,

please find attached a project demonstrating the use of multiple X axes, the code of which comes from one of the forum posts I suggested you to look at.
MultiAxes.zip
(14.9 KiB) Downloaded 24 times
Can you please modify this project to demonstrate the problem you are experiencing with multiple X axes so that I can reproduce it here?
Best Regards,
Christopher Ireland / 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

Post Reply