We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

ChartControl Legend VisibleCheckBox value-chagend Event

Thread ID:

Created:

Updated:

Platform:

Replies:

57552 Mar 6,2007 04:10 PM UTC Mar 7,2007 05:11 PM UTC WinForms 3
loading
Tags: Chart
Administrator [Syncfusion]
Asked On March 6, 2007 04:10 PM UTC

Hi,
V4.4.0.51 & VS2003

When you set ChartControl's legend VisibleCheckBox=true, The legend displays a checkbox to for each series to let you click it to hide or display the series.

I want to know which events it fires when you check or uncheck this checkbox?

I want to display some information when a series hide or displays?

Thanks,

Lan

Administrator [Syncfusion]
Replied On March 7, 2007 09:42 AM UTC

>Hi,
V4.4.0.51 & VS2003

When you set ChartControl's legend VisibleCheckBox=true, The legend displays a checkbox to for each series to let you click it to hide or display the series.

I want to know which events it fires when you check or uncheck this checkbox?

I want to display some information when a series hide or displays?

Thanks,

Lan

Hi Lan,

I have the same problem.
At the moment the only way I've found is listen to the Legend.ControlAdded and Legend.ControlRemoved events: supposing that the "Control" of the arg is a CheckBox, I listen to its Click event...

---
Legend.ControlAdded += new ControlEventHandler(Legend_ControlAdded);
Legend.ControlRemoved += new ControlEventHandler(Legend_ControlRemoved);
---
...
---
private void Legend_ControlAdded(object sender, ControlEventArgs e)
{
e.Control.Click += new EventHandler(Control_Legend_Click);
}

private void Legend_ControlRemoved(object sender, ControlEventArgs e)
{
e.Control.Click -= new EventHandler(Control_Legend_Click);
}

private void Control_Legend_Click(object sender, EventArgs e)
{
_dataManager.RecalculateRanges();
}
---

It's ugly from a development point of view but at the moment is the only workaround I've found.
Also - this is wonderful :-) - everytime a click is done, if you have "N" series, you receive N ControlRemoved + N ControlAdded...

:-\

Other ideas?

Ramya R [Syncfusion]
Replied On March 7, 2007 09:50 AM UTC

Hi Lan,

Thanks for your interest in Essential Chart.

There is no special event that gets fired when the checked state of legend's checkbox is changed.

But you can do this by adding a checkbox to the form and positioning it within the legend instead of using the checkbox which appears when the Legend.VisibleCheckBox property is set to true. And under the CheckedChanged event of the added checkbox you can display informations you want when the series visibility is changed.

I have created a sample as per the above points and attached with this post.

You can download the sample from the below Webpage link,

http://websamples.syncfusion.com/samples/Chart.Windows/F57552/main.htm

Let me whether this helps you.

Thanks & Regards,
Ramya.

Administrator [Syncfusion]
Replied On March 7, 2007 05:11 PM UTC

Hi Ramya,
Thank you for help. Your solution solves my problem. I also would like to thank SiMoStro for helpful reponse and coding.

Moreover, your approach of Adding custom checkbox also solves the issue I posted on Feb.7 to you. Below is the issue link and message copy for your review.

Lan

******************************************

http://www.syncfusion.com/support/forums/message.aspx?&MessageID=55098


Hi,
I found I can use following code to display both line and shape.

this.chartControl1.Legend.RepresentationType = ChartLegendRepresentationType.Line;
this.chartControl1.Legend.ShowSymbol=true;

I've modified your sample and attached here for your review.

The problem is when the Checkbox displays, the shape disappeared. I am not sure if it is a bug in chart control? In my revised sample, you can see it by clicking the 'Display/Hide checkbox' to toggle to display or hide the checkbox.
Thanks for help.

Lan

Hi Lan,

I am happy to hear that you got the condition of displaying both line and shape.

Thanks a lot for the modified sample and code snippet.

With regard to checkbox issue, you are right it is a bug in ChartControl. Thanks for bringing this issue to our attention. I will forward this issue to our developers and let you the timeframe for the fix of this issue by next week.

Thank You for your patience and co-operation.

Regards,
Ramya.

***********************************************

CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

;