Hi Steve,
1. How do I programattically tie the colour passed to the Row Add function to the colour assigned to the pie chart segment. I suppose what I am asking here is how after I have added the Data Point to my series can I retrieve the colour that has been assigned to that segment. Alternatively, how do I force a colour to a segment as I add it, which would achieve the same thing?
That depends on how you assign colors to the pie:
1. If you don't assign colors explicitly (using the pie.FillStyles collection) the color of the pie is the value of the pieSeries.FillStyle property.
2. If you assign the colors to the pie using a style sheet then the stylesheet must be applied before you can get the fill style of the of the pie.
The following code shows how to create a pie chart with three slices (red, green, blue):
NPieChart pieChart = new NPieChart();
NPieSeries pieSeries = new NPieSeries();
pieSeries.Values.Add(10);
pieSeries.FillStyles[0] = new NColorFillStyle(Color.Red);
pieSeries.Values.Add(20);
pieSeries.FillStyles[1] = new NColorFillStyle(Color.Green);
pieSeries.Values.Add(30);
pieSeries.FillStyles[2] = new NColorFillStyle(Color.Blue);
pieChart.Series.Add(pieSeries);
nChartControl1.Panels.Add(pieChart);
You can later retrieve the fill style usings the FillStyles collection:
// get the fill style of the second slice
NFillStyle fillStyle = (NFillStyle)pieSeries.FillStyles[1];
In order to assing that fill to the marker fill you'll have to clone it:
data.MarkFillStyle = (NFillStyle)fillStyle.Clone();
2. How do I suppress some/all of the Grid Lines displayed in the legend ?
The following code shows how to suppress all borders:
// inner grid lines
legend.VerticalBorderStyle.Width = new NLength(0);
legend.HorizontalBorderStyle.Width = new NLength(0);
// outer border
legend.OuterLeftBorderStyle.Width = new NLength(0);
legend.OuterTopBorderStyle.Width = new NLength(0);
legend.OuterRightBorderStyle.Width = new NLength(0);
legend.OuterBottomBorderStyle.Width = new NLength(0);
Hope this helps - let us know if you meet any problems.
Best Regards,
Nevron Support Team