Skip to content

Commit

Permalink
Merge pull request #142 from SyncfusionExamples/261707-Legend-XlsIO
Browse files Browse the repository at this point in the history
261707 - Add code snippet for setting background color of the legend
  • Loading branch information
Mohan2401 authored Oct 30, 2024
2 parents 4155bd2 + c94dff4 commit c444146
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion Create and Edit Charts/Legend/.NET/Legend/Legend/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -35,14 +35,17 @@ public static void Main(string[] args)
//Set the color
chart.Legend.TextArea.Color = ExcelKnownColors.Pink;

//Set the background color
chart.Legend.FrameFormat.Fill.ForeColorIndex = ExcelKnownColors.Yellow;

//Set the font
chart.Legend.TextArea.Bold = true;
chart.Legend.TextArea.FontName = "Times New Roman";
chart.Legend.TextArea.Size = 10;
chart.Legend.TextArea.Strikethrough = false;

//Remove the legend
chart.Legend.LegendEntries[0].IsDeleted = true;
chart.Legend.LegendEntries[0].Delete();

//Set Legend without overlapping the chart
chart.Legend.IncludeInLayout = true;
Expand Down

0 comments on commit c444146

Please sign in to comment.