Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I add a legend to an ASP.NET 3.5 chart control?

Is there a way to add a legend to the chart it creates? I have created a line chart and by default it has created different colors for the different y - axis data. I would like a legend on the side the displays what data goes with which line color.

Thank You.

like image 565
Greg McNulty Avatar asked Dec 16 '22 19:12

Greg McNulty


1 Answers

Your chart control can create a legend using the data series names simply by adding the following line:

chart.Legends.Add(new Legend("Default") { Docking = Docking.Right});
like image 52
Phil.Wheeler Avatar answered Dec 30 '22 00:12

Phil.Wheeler