Hide chart legends

Skip Navigation LinksHome  /  Support  /  Forums  /  DynamicPDF Generator for .NET (v4)  /  Hide chart legends

DynamicPDF Generator for .NET (v4) Forum

 May 05 2010 3:51 PM
How can you hide the legend that is automatically created on charts (specifically, I'm using IndexedLineSeries encase that makes a difference)?
 May 05 2010 4:02 PM
Posted by a ceTe Software moderator
Hello,

Yes, you can hide the legend labels without any problem. You will have to set the Visible property of the legend to false as shown below:

   MyChart.Legends(0).Visible = False

Thanks,
ceTe Software Support Team
 May 06 2010 9:29 AM
When I do that it fails saying:
CS0118: 'ceTe.DynamicPDF.PageElements.Charting.Chart.Legends' is a 'property' but is used like a 'method'

I've tried Legends.Item(0) which fails saying that Legends has no definition for "Item"

I've also tried Legend(0), but that fails because Chart has no definition for "Legend"

Thoughts?
 May 06 2010 12:38 PM
Posted by a ceTe Software moderator
Hello,

The code we have given in the above forum is for VB.NET. It should work fine if you are using it in VB.NET. Below is the code for C# and Vb.NET.

C# Code:
chart.Legends[0].Visible = false;

Vb.NET Code:
MyChart.Legends(0).Visible = False

Please make sure that you are importing all the necessary namespaces.
ceTe.DynamicPDF.PageElements.Charting
ceTe.DynamicPDF.PageElements.Charting.Axes
ceTe.DynamicPDF.PageElements.Charting.Series

Thanks,
ceTe Software Support Team.
 May 06 2010 1:21 PM
That'd be why - I'm in C#. Thanks!

All times are US Eastern Standard time. The time now is 4:39 AM.