Two Y axis

A forum dedicated to WPF version of LightningChart Ultimate.

Moderator: Queue Moderators

Post Reply
Norrbotten68
Posts: 4
Joined: Mon Sep 12, 2022 5:25 pm

Two Y axis

Post by Norrbotten68 » Mon Sep 12, 2022 5:33 pm

Hi
I will add second Y-axis ( to the right) to XY chart . if I use this
AxisY axisY = new AxisY(_chart.ViewXY); ;
axisY.SetRange(0, 20);
axisY.LabelsNumberFormat = "0";
axisY.AutoFormatLabels = false;
_chart.ViewXY.AxisLayout.YAxisAutoPlacement = YAxisAutoPlacement.AllLeft;


AxisY axisY2 = new AxisY(_chart.ViewXY);
axisY2.SetRange(0, 50);
axisY2.LabelsNumberFormat = "0";
axisY2.AutoFormatLabels = false;
_chart.ViewXY.AxisLayout.YAxisAutoPlacement = YAxisAutoPlacement.LeftThenRight;
I can only see first axis (the left one)
What do I do wrong?

ArctionKestutis
Posts: 552
Joined: Mon Mar 14, 2016 9:22 am

Re: Two Y axis

Post by ArctionKestutis » Tue Sep 13, 2022 1:09 pm

Didn't you forget to add Axis to the collection/list

Code: Select all

            chart.ViewXY.YAxes.Add(yAxis);
If you using non-bindable WPF edition or WinForms edition of LightningChart control, then there is always 1 pair of X- and Y-axis. Either you edit 1st YAxis and add 2nd YAxis, or you remove all old items from collection. For example,

Code: Select all

			while (chart.ViewXY.YAxes.Count > 0)
				chart.ViewXY.YAxes.RemoveAndDispose<AxisY>(0);

Post Reply