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;
Create New Y Axis
Moderator: Queue Moderators
Re: Create New Y Axis
Do you mean the "ScaleNibs"? The small handles at the ends of the axis?
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.
Code: Select all
axis2.ScaleNibs.Color = yaxis.ScaleNibs.Color;