Hi @Alvord, Timothy, Welcome to Microsoft Q&A,
You can easily add a legend to your chart. But you need to customize the text you need. You need to write a function for the text you need to appear, and then assign it.
// Add a new legend
Legend customLegend = new Legend("CustomLegend");
chart1.Legends.Add(customLegend);
// Create a custom legend item
LegendItem legendItem = new LegendItem();
legendItem.Name = "CustomLabel";
legendItem.Color = Color.Red; // Set the color
legendItem.BorderColor = Color.Black;
legendItem.BorderWidth = 1;
legendItem.MarkerStyle = MarkerStyle.Circle;
legendItem.MarkerSize = 10;
legendItem.MarkerColor = Color.Red;
legendItem.Cells.Add(LegendCellType.Text, "xxxx", ContentAlignment.MiddleLeft);
// Add the legend item to the legend
customLegend.CustomItems.Add(legendItem);
Best Regards,
Jiale
If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.