How to display legend in asp:Chart control?

Posted by Sheonarayan under ASP.NET category on | Points: 40 | Views : 4760
To display Legends in asp:Chart control we can use Legends property of the asp:Chart control.

Chart1.Legends.Add(new System.Web.UI.DataVisualization.Charting.Legend());

Surprisingly there is no EnableLegend or ShowLegend property in the chart control that shows/hide legends, you will need to add a Legend object into the Legends collection to show the Legends in the asp:Chart control. The name of the asp:Series will be taken as the labels for the Legend.

Hope this helps.


Comments or Responses

Login to post response