Chart control : selecting Column

Hi,

is it possible to select 1 ore more series at run time inside the chartcontrol?
I'd like to let the user click 1 ore more series (ChartSeriesType.Column ) in order to  select them .

thank you

Davide





3 Replies

MK Muneesh Kumar G Syncfusion Team September 24, 2018 06:43 AM UTC

Hi Davide, 
 
Greetings from Syncfusion. We have analyzed your query. As of now, we are not having built-in support for selection and so we have achieved your requirement by using “ChartRegionClick” event as per the below code.  
 
[C#] 
Color SelectionColor = Color.OrangeRed; 
Color SeriesColor = Color.SeaGreen; 
public Form1() 
{             
    chart.ChartRegionClick += Chart_ChartRegionClick; 
}         
private void Chart_ChartRegionClick(object sender, ChartRegionMouseEventArgs e) 
    double X = Math.Round(chart.ChartArea.GetValueByPoint(e.Point).X); 
    for(int i = 0; i < series.Points.Count; i++) 
    { 
        if (i == X) 
        { 
            series.Styles[i].Interior = new Syncfusion.Drawing.BrushInfo(SelectionColor); 
        } 
        else 
        { 
            series.Styles[i].Interior = new Syncfusion.Drawing.BrushInfo(SeriesColor); 
        } 
    } 
    chart.Refresh(); 
 
In the above code, we have set the value of the clicked point, using “GetValueByPoint” method and set the different color (OrangeRed) for that particular point and redrawn the chart. Please find the below output while rendering the chart. 
 
Output for before selection. 
 
 
Output for after selection. 
 
 
We have prepared a sample based on this, please find the sample from the following location.  
 
Sample: chart-sample 
 
We have already logged feature request on this. Based on its priority and complexity this feature will be included in any out upcoming release.  
 
 
Please let us know if you have any queries.  
 
Thanks, 
Muneesh Kumar G 



DA Davide Azzaroni September 27, 2018 02:29 PM UTC

thank you

It solved the problem

Davide



SK Sanjith Kesavan Syncfusion Team September 28, 2018 06:13 AM UTC

Hi Davide, 

Thanks for your update. Please let us know if you have any queries. 

Thanks, 
Sanjith. 


Loader.
Up arrow icon