Jump to content
Software FX Community

Help with legend boxes


WizKid

Recommended Posts

Hello,

  I have a bar chart. It has the data set as follows. I am using VB.NET 2.0

  ID   Forum No. of Users

1   ABC   5

2   DEF   3

3   GHI   Null

4   JKL   Null

  I have each forum displayed in a different color in the bar chart. I also have the legend boxes enabled. But they show all the forum names

  irrespective of the data in the "No. of Users" column. I want the legend boxes to show up for only the first two forums which have non null

  values for "No. of users". Even though there are only two bars in the above chart but all legend boxes show up for all forums. How can I control

  the display of legend boxes based on the column values.

Also when there is no data in the chart how do i display a message in the chart saying "No data available"

 Thanks.....

Link to comment
Share on other sites

If you pass each Forum as a series to the chart (not sure whether you pass each forum as series or point), then you can hide the series in the legend as:LegendItemAttributes lia = new LegendItemAttributes();

chart1.LegendBox.ItemAttributes[chart1.Series, 1] = lia;  // this hides series with index 1 in the legendbox

lia.Visible =

false;

When no data is passed to the chart, the message 'No data available' will be automatically displayed. For example, if you do  chart1.Data.Clear(); this will display the message in place of the chart.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...