Hi,
I have couple of questions regarding Legend style:
1. How to change Legend's box Border color?
2. How to change Font size of Legend items?
3. Is there any way to retrieve Legend width,height at runtime , currently it is NaN?
Regards
chart.ChartLegend.Line.FillFormat.SolidFillColor.Color = Color.Red;
for (int i = 0; i < chart.ChartLegend.EntryTextProperties.Length; i++)
{
chart.ChartLegend.EntryTextProperties[i].FontHeight = 20;
}
static void Main(string[] args)
{
var presentation = new Presentation();
var slide = presentation.Slides[0];
var chart = slide.Shapes.AppendChart(ChartType.ScatterStraightLinesAndMarkers, new RectangleF(50, 50, 500, 500), false);
chart.ChartLegend.Position = ChartLegendPositionType.TopRight;
chart.ChartLegend.Top = 100;
chart.ChartLegend.IsOverlay = true;
chart.ChartLegend.Fill.FillType = FillFormatType.Solid;
chart.ChartLegend.Fill.SolidColor.Color = Color.White;
chart.ChartLegend.Line.FillFormat.FillType = FillFormatType.Solid;
chart.ChartLegend.Line.FillFormat.SolidFillColor.Color = Color.Blue;
int count = 3;
chart.Series.SeriesLabel = chart.ChartData[0, 0, 0, count - 1];
for (int i = 0; i < count; i++)
{
chart.ChartData[0, i].Value = "Series" + i;
for (var j = 0; j < 10; j++)
{
chart.ChartData[j + 1, i].Value = i;
chart.ChartData[j + 1, count + i].Value = i + j + count;
}
chart.Series[i].YValues = chart.ChartData[1, i, 10, i];
chart.Series[i].XValues = chart.ChartData[1, count + i, 10, count + i];
}
for (int i = 0; i < chart.ChartLegend.EntryTextProperties.Length; i++)
{
chart.ChartLegend.EntryTextProperties[i].FontHeight = 10;
}
var width = chart.ChartLegend.Width; // <--------------- NaN here
presentation.SaveToFile("D://test.pptx", FileFormat.Pptx2013);
Process.Start("D://test.pptx");
}