Nevron Forum

Cannot change pattern of major grid lines for SecondaryY axis

https://www.nevron.com/Forum/Topic8319.aspx

By Mikhail Kazakov - Monday, November 18, 2013

Hello,

It seems that setting NScaleConfigurator.MajorGridStyle.LineStyle.Pattern property for the "SecondaryY" axis does not work. Changing other properties, like NScaleConfigurator.MajorGridStyle.LineStyle.Color, works as expected. Also, the Pattern property behaves fine for the "PrimaryY" axis.

Is this a bug? Is there a way to make it work?

The following code snippet can be used to reproduce the behavior.


var chart = new NCartesianChart
{
BoundsMode = BoundsMode.Stretch,
Dock = DockStyle.Fill,
ContentAlignment = ContentAlignment.MiddleCenter,
Margins = new NMarginsL(5, 5, 5, 5)
};
nChartControl1.Charts.Add(chart);

chart.Axis(StandardAxis.PrimaryX).ScaleConfigurator = new NRangeTimelineScaleConfigurator
{
AutoDateTimeUnits = new NDateTimeUnit[] { NDateTimeUnit.Year, NDateTimeUnit.Month }
};

chart.Axis(StandardAxis.PrimaryY).Visible = false;

var yAxis = chart.Axis(StandardAxis.SecondaryY);
yAxis.Visible = true;
yAxis.ScaleConfigurator.MajorGridStyle.LineStyle.Pattern = LinePattern.Dash;

var line = (NLineSeries)chart.Series.Add(SeriesType.Line);
line.Values.FillRandom(new Random(), 8);
line.DisplayOnAxis(StandardAxis.SecondaryY, true);


Thanks,
Mikhail
By Nevron Support - Tuesday, November 19, 2013

Hi Mikhail,

The problem in this case is that the primary Y axis grid lines are drawn (they are not affected when you specify that the axis is not visible). To workaround this you also need to disable the primary axis grid lines;

chart.Axis(StandardAxis.PrimaryY).ScaleConfigurator.MajorGridStyle.LineStyle.Width = new NLength(0);