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. Image for the cookie policy date
close icon

Resizing

Hello,

i created a table in which the size will be automatically adjusted if I check or uncheck an item at the chart-legend.
How do I do that?

Best regards

Daniel

6 Replies

DR Daniel Rottschäfer February 19, 2010 11:53 AM UTC

I have a additional question:

How do i get the max value from the x- and y-axis?


SG Senthil Ganesh K Syncfusion Team February 19, 2010 12:26 PM UTC

Hi Daniel,

Thanks for showing interest on Syncfusion products.

The below code is used to check all the legend items in the chart legend by setting to true.
To uncheck set it to false.
this.chartControl1.Legend.VisibleCheckBox = true;

The below code is to check each legend item individually by setting to true.
To uncheck set it to false.
this.chartControl1.Legend.Items[0].VisibleCheckBox=true;

The below code is to find the max value for X axis and Y axis.

this.chartControl1.PrimaryXAxis.VisibleRange.Max
this.chartControl1.PrimaryYAxis.VisibleRange.Max

Please let me know if this helps.

Regards,
Senthil Ganesh K.


DR Daniel Rottschäfer February 22, 2010 08:06 AM UTC

I had something else in my mind when i asked the questions.

I want the chart automatically to resize if i uncheck an legend item. The Max X- and Y-Axis Values should be the max Value of the shown series.

How can i do that?

And how do i get the maxvalue of any series without counting themselves when filling the data?


SG Senthil Ganesh K Syncfusion Team February 22, 2010 01:29 PM UTC

Hi Daniel,

The chart resizing can be done by using the legend items Checked changed event.
Below mentioned example code will perform the resizing of the chart control.

Example code:

this.chartControl1.Legend.Items[0].CheckedChanged += new EventHandler(Form1_CheckedChanged);

void Form1_CheckedChanged(object sender, EventArgs e)
{
if (this.chartControl1.Legend.Items[0].IsChecked)
{
this.chartControl1.Width = 700;
this.chartControl1.Height = 700;
}
else
{
this.chartControl1.Height = 200;
this.chartControl1.Width = 600;
}
}


The max value for the shown series can be found out by using the below code snippet without counting the data.

Code snippet:

this.chartControl1.Series[0].Summary.MaxX
this.chartControl1.Series[0].Summary.MaxY


The below mentioned code snippet is to set the max value of the given series to the max X and Y values of the axes.

Code Snippet:

this.chartControl1.PrimaryXAxis.Range.Max = this.chartControl1.Series[0].Summary.MaxX;
this.chartControl1.PrimaryYAxis.Range.Max = this.chartControl1.Series[0].Summary.MaxY;


Please let me know if this meets your requirement.

Regards,
Senthil Ganesh K.


DR Daniel Rottschäfer February 23, 2010 10:37 AM UTC

Thank you for your help.


SG Senthil Ganesh K Syncfusion Team February 24, 2010 02:59 PM UTC

Hi Daniel,

Thanks for using syncfusion products.

We are happy to assist you.

Regards,
Senthil Ganesh K.

Loader.
Live Chat Icon For mobile
Up arrow icon