Chart Control Border Color


Author
Message
Syrhey Karol'
Syrhey Karol'
Forum Member (27 reputation)Forum Member (27 reputation)Forum Member (27 reputation)Forum Member (27 reputation)Forum Member (27 reputation)Forum Member (27 reputation)Forum Member (27 reputation)Forum Member (27 reputation)Forum Member (27 reputation)
Group: Forum Members
Posts: 21, Visits: 74
Hi Guys!

Maybe this trick helps someone.

I’ve found more elegant way how to draw the border around grid.
We draw the border with back wall border style color. But grid overlaps it.
So let’s change opacity of grid color!
By default grid has light gray color. If we set grid color to black and set opacity to 44 we’ll get exactly the same color like light gray!
And border became visible because of grid is transparent.
Here is the code:

NCartesianChart chart = (NCartesianChart)nChartControl1.Charts[0];

NBarSeries bar = new NBarSeries();
bar.Values.Add(10);
bar.Values.Add(21);
chart.Series.Add(bar);

// Grid Border
NChartWall backWall = chart.Wall(ChartWallType.Back);
backWall.BorderStyle.Color = Color.Black;


// Show grid lines
chart.Axis(StandardAxis.PrimaryX).ScaleConfigurator.MajorGridStyle.SetShowAtWall(ChartWallType.Back, true);
chart.Axis(StandardAxis.PrimaryY).ScaleConfigurator.MajorGridStyle.SetShowAtWall(ChartWallType.Back, true);

//set grid color
Color gridColor = Color.FromArgb(44, Color.Black);
chart.Axis(StandardAxis.PrimaryX).ScaleConfigurator.MajorGridStyle.LineStyle.Color = gridColor;
chart.Axis(StandardAxis.PrimaryY).ScaleConfigurator.MajorGridStyle.LineStyle.Color = gridColor;


Anyway it’d be nice to have kind of ZOrder property for backWall.BorderStyle object or something like that.

Best Regards,
Zonder.

GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Similar Topics

Reading This Topic

Login

Explore
Messages
Mentions
Search