|
Group: Forum Members
Posts: 21,
Visits: 74
|
Hi Guys.
Custom painting approach doesn’t help here. Custom painted border doesn’t coincide with real grid border because of coordinate transformation from scale to view.
I’ve managed to draw a grid frame but with a trick method: I’ve added secondary axes and hide ticks and labels on them.
private void Form1_Load(object sender, EventArgs e) { _chart = (NCartesianChart)nChartControl1.Charts[0];
NBarSeries bar = new NBarSeries(); bar.Values.Add(10); bar.Values.Add(21); _chart.Series.Add(bar);
//add secondary axes NAxis secondaryXAxis = _chart.Axis(StandardAxis.SecondaryX); InitSecondaryAxis(ref secondaryXAxis);
NAxis secondaryYAxis = _chart.Axis(StandardAxis.SecondaryY); InitSecondaryAxis(ref secondaryYAxis); }
private void InitSecondaryAxis(ref NAxis axis) { //make axis visible in general axis.Visible = true; //make axis visible to provade it a fake interval axis.View = new NRangeAxisView(new NRange1DD(1, 2), true, true);
NLinearScaleConfigurator scale = new NLinearScaleConfigurator(); //switch off ticks and labels scale.InnerMajorTickStyle.Length = new NLength(0); scale.OuterMajorTickStyle.Length = new NLength(0); scale.AutoLabels = false;
//set axis color scale.RulerStyle.BorderStyle.Color = Color.Black;
axis.ScaleConfigurator = scale; }
Best Regards, Zonder.
|