By inhyuk son - Friday, March 4, 2011
Hi~
Is there a way to set the chart border color?
thank you.
|
By Nevron Support - Friday, March 4, 2011
You can set the border color for both the chart control and the chart itself. Please let us know which border do you need to change.
|
By inhyuk son - Monday, March 7, 2011
Hi~ I want to change the border color of chart control. Thanks a lot.
|
By Nevron Support - Tuesday, March 8, 2011
Hi Inhyuk,
You have to touch the inner border color of the control frame:
NStandardFrameStyle frame = nChartControl1.BackgroundStyle.FrameStyle as NStandardFrameStyle; frame.InnerBorderColor = Color.Cyan;
|
By Syrhey Karol' - Monday, January 30, 2012
Hi!
I know how to draw a frame around a chart control and around a chart. Is it possible to draw a frame around a chart greed? Like the red square in the attach.
Best Regards, Zonder.
|
By Nevron Support - Wednesday, February 1, 2012
Hi Zonder, Try using the border style of the back wall: chart.Wall( ChartWallType.Back).BorderStyle.Color = Color.Black;
|
By Syrhey Karol' - Thursday, February 2, 2012
Hi Guys!
Thank you very much! It works perfect
Best Regards, Zonder
|
By Syrhey Karol' - Friday, February 3, 2012
Hi, Guys!
I am sorry. But there is a problem with drawing ‘Grid Border’ using ‘Back Wall Border’ 1) If I hide grid lines all works fine. 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;
// Hide grid lines chart.Axis(StandardAxis.PrimaryX).ScaleConfigurator.MajorGridStyle.SetShowAtWall(ChartWallType.Back, false); chart.Axis(StandardAxis.PrimaryY).ScaleConfigurator.MajorGridStyle.SetShowAtWall(ChartWallType.Back, false);
And you can see the result at picture gridBorder1.
2) But I need to have greed line enabled. 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);
And as a result the latest grid line overlaps grid border line. You can see the result at picture gridBorder2. Do you know another way how to draw grid border?
Best Regards, Zonder.
|
By Nevron Support - Monday, February 6, 2012
Hi Zonder, One way to workaround this is to use the custom painting feature (All Examples\Custom Painting). That way you'll be able to write on top of every chart element...
|
By Syrhey Karol' - Wednesday, February 8, 2012
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.
|
By Syrhey Karol' - Tuesday, February 21, 2012
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.
|
|