Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
332
How to get bind data item from the clicked column element of Column chart.
posted

I am using XamWebChart Column Chart of Silverlight controls v 10.2. Here on user click on column of column chart i want to get the bind item of the column. I tried DataItemMouseLeftButtonDown event by following post from infragistics forum:

https://es.infragistics.com/community/forums/f/retired-products-and-controls/36069/how-to-get-the-datapoint-value-in-line-splinearea-doughnut-charts/210089#210089

https://es.infragistics.com/community/forums/f/retired-products-and-controls/41956/xamwebchart-line-chart-tooltipdate-value-and-performance-issue/235429#235429

But still didnot get the sucess. on DataItemMouseLeftButtonDown event e. element is of type "ColumnChartDataPointTemplate" and "(e.element as ColumnChartDataPointTemplate).Tag always return null.

Also (e.Element as ColumnChartDataPointTemplate).PointIndex always return 0 instead of clicked item index.

Please help me for the same.

  • 1134
    posted

    Hi jainnitin,

    Since you are using a Column Chart, you should simply be able to do this on your MouseLeftButtonDown event:

    private void Chart1_DataItemMouseLeftButtonDown(object sender, Infragistics.Silverlight.Chart.DataItemMouseEventArgs e)
            {
                DataPointTemplate shape = e.Element as DataPointTemplate;
    
                if (shape != null)
                {
                    DataPoint point = shape.DataPoint;
                }
            }
    
    Hopefully this is what you are trying to achieve.
    
    
    -Marisa