Create New Y Axis

A forum dedicated to WPF version of LightningChart Ultimate.

Moderator: Queue Moderators

Post Reply
srinin2k
Posts: 25
Joined: Thu Jun 18, 2015 9:22 pm

Create New Y Axis

Post by srinin2k » Wed Oct 28, 2015 5:16 pm

I want to add a secondary Y axis on right side. I want to inherit all the properties of first Y Axis i.e YAxes[0]. (Font, Color). How do I do that?

I wish you have a simple function like "Clone()"

I have one problem with manually settings attributes. The axis has some violet color at the top and the bottom edge of the axis. Need to know which property to set to make it like the other Y axis.
I use code like

var yaxis = Chart.ViewXY.YAxes[0];
AxisY axis2 = new AxisY(Chart.ViewXY, true);

axis2.Title.HorizontalAlign = YAxisTitleAlignmentHorizontal.Right;
axis2.Units.HorizontalAlign = YAxisTitleAlignmentHorizontal.Right;
axis2.Units.DistanceToAxis = 20;

axis2.MinorDivTickStyle.Visible = false;
axis2.Alignment = AlignmentHorizontal.Right;
axis2.MajorDivTickStyle.Alignment = Alignment.Far;
axis2.MinorDivTickStyle.Alignment = Alignment.Far;
axis2.AxisColor = yaxis.AxisColor;
axis2.MajorDivTickStyle.Color = yaxis.MajorDivTickStyle.Color;
axis2.LabelsColor = yaxis.LabelsColor;
axis2.Title.Color = yaxis.Title.Color;
axis2.GridStripColor = yaxis.GridStripColor;
axis2.MajorGrid.Color = yaxis.MajorGrid.Color;

axis2.Title.Font = yaxis.Title.Font;
axis2.Title.Shadow = yaxis.Title.Shadow;
axis2.LabelsFont = yaxis.LabelsFont;

axis2.AllowAutoYFit = true;

Chart.ViewXY.AxisLayout.YAxisAutoPlacement = YAxisAutoPlacement.LeftThenRight;

ahe
Posts: 51
Joined: Tue Aug 11, 2015 4:33 pm
Location: Düsseldorf, DE

Re: Create New Y Axis

Post by ahe » Thu Oct 29, 2015 8:31 am

Do you mean the "ScaleNibs"? The small handles at the ends of the axis?

Code: Select all

axis2.ScaleNibs.Color = yaxis.ScaleNibs.Color;
But I agree, for your use case a Clone() function or a copy constructor would be useful. I solved this by manually creating all axes (axisses?) to make sure they look the same.

Post Reply