Profile Picture

Hide single legend item

Posted By Daniel Csimszi 6 Years Ago
Author
Message
Daniel Csimszi
Question Posted 6 Years Ago
View Quick Profile
Forum Guru

Forum Guru (50 reputation)Forum Guru (50 reputation)Forum Guru (50 reputation)Forum Guru (50 reputation)Forum Guru (50 reputation)Forum Guru (50 reputation)Forum Guru (50 reputation)Forum Guru (50 reputation)Forum Guru (50 reputation)

Group: Forum Members
Last Active: 5 Years Ago
Posts: 61, Visits: 35
I am trying to hide legend items one by one.
Is this possible?

I thought I would identify my legend item and then just call a hide function or change a visible attribute but there are not anything like that.

NLegendItemCellData legend = (NLegendItemCellData)m_Legend.Data.Items[index];
legend.Visible = false ??

Nevron Support
Posted 6 Years Ago
View Quick Profile
Supreme Being

Supreme Being (4,063 reputation)Supreme Being (4,063 reputation)Supreme Being (4,063 reputation)Supreme Being (4,063 reputation)Supreme Being (4,063 reputation)Supreme Being (4,063 reputation)Supreme Being (4,063 reputation)Supreme Being (4,063 reputation)Supreme Being (4,063 reputation)

Group: Forum Members
Last Active: 1 days ago @ 7:47 AM
Posts: 2,945, Visits: 3,303
Hi Daniel,

In order to hide legend item you need to remove them from the legend items array - note that in this case the legend must be operating in Manual mode. Let us know if you meet any problems or have any questions.


Best Regards,
Nevron Support Team



Daniel Csimszi
Posted 6 Years Ago
View Quick Profile
Forum Guru

Forum Guru (50 reputation)Forum Guru (50 reputation)Forum Guru (50 reputation)Forum Guru (50 reputation)Forum Guru (50 reputation)Forum Guru (50 reputation)Forum Guru (50 reputation)Forum Guru (50 reputation)Forum Guru (50 reputation)

Group: Forum Members
Last Active: 5 Years Ago
Posts: 61, Visits: 35
Hi

Thank you for your reply, unfortunately this will not satisfy my solution.
I use the legends to manipulate the graphs. If the user right click the legend of a graph they can change the colour of it line thickness etc.

The legend hiding is to solve an export issue.

When they import data from different data sources it is possible that one graph (line) builds up from more input as they got imported from daily data for a 1 week graph. That means the legend should be the same just displaying the graphs name and colour but it has 7 legends instead of one.

After all the formatting done the user wants to export the graph as an image where it should not have all the unnecessary legends. The reason why I do not want to delete them is because if the user realize they still need to do changes on the removed legend's graph then they wont be able.

If it is impossible to hide them I can make something more difficult with storing the deleted legends etc. I just thought I will go for the easy if solution if it is exists



Nevron Support
Posted 6 Years Ago
View Quick Profile
Supreme Being

Supreme Being (4,063 reputation)Supreme Being (4,063 reputation)Supreme Being (4,063 reputation)Supreme Being (4,063 reputation)Supreme Being (4,063 reputation)Supreme Being (4,063 reputation)Supreme Being (4,063 reputation)Supreme Being (4,063 reputation)Supreme Being (4,063 reputation)

Group: Forum Members
Last Active: 1 days ago @ 7:47 AM
Posts: 2,945, Visits: 3,303
Hi Daniel,

You can simply hide the legends:
 legend.VisibilityMode = VisibilityMode.Collapse;

Will that work?



Best Regards,
Nevron Support Team



Daniel Csimszi
Posted 6 Years Ago
View Quick Profile
Forum Guru

Forum Guru (50 reputation)Forum Guru (50 reputation)Forum Guru (50 reputation)Forum Guru (50 reputation)Forum Guru (50 reputation)Forum Guru (50 reputation)Forum Guru (50 reputation)Forum Guru (50 reputation)Forum Guru (50 reputation)

Group: Forum Members
Last Active: 5 Years Ago
Posts: 61, Visits: 35
Thanks for the suggestion, the problem is that it hides all the legends.
Instead of this:
m_Legend.VisibilityMode = VisibilityMode.Collapse;

I would need something like this:
NLegendItemCellData legend = (NLegendItemCellData)m_Legend.Data.Items[index]
legend.VisibilityMode = VisibilityMode.Collapse;


Nevron Support
Posted 6 Years Ago
View Quick Profile
Supreme Being

Supreme Being (4,063 reputation)Supreme Being (4,063 reputation)Supreme Being (4,063 reputation)Supreme Being (4,063 reputation)Supreme Being (4,063 reputation)Supreme Being (4,063 reputation)Supreme Being (4,063 reputation)Supreme Being (4,063 reputation)Supreme Being (4,063 reputation)

Group: Forum Members
Last Active: 1 days ago @ 7:47 AM
Posts: 2,945, Visits: 3,303

Hi Daniel,

There is no way to hide legend data items individually. You can control whether certain series output information to the legend using the series legend object attached to them - for example:

series.Legend.Mode = SeriesLegendMode.None;

Disables the output of the series on the legend.



Best Regards,
Nevron Support Team



Daniel Csimszi
Posted 6 Years Ago
View Quick Profile
Forum Guru

Forum Guru (50 reputation)Forum Guru (50 reputation)Forum Guru (50 reputation)Forum Guru (50 reputation)Forum Guru (50 reputation)Forum Guru (50 reputation)Forum Guru (50 reputation)Forum Guru (50 reputation)Forum Guru (50 reputation)

Group: Forum Members
Last Active: 5 Years Ago
Posts: 61, Visits: 35
Thank you for your help.

Unfortunately the attribute change you have mentioned did not do what I needed, I tried to refresh the graph as well but nothing changed visually(legend still there). 

I ended up just removing the legends. It is more complicated then just hide them as I needed 2 more lists to store all the legends for graph indexes and the removed legends with their location index if they need to be put back.That also meant I needed to address the graphs and the legends using 2 different indexes as they changed after removing a legend.



Similar Topics


Reading This Topic