HI,
I have created few charts using XamWebChart, and using DataItemMouseLeftButtonUp property to fire click event on the DataPoint. It does not firing the event for Line Chart. Its working fine for Column Chart. How am i suppose to get this click event work on the Line Chart Datapoints ?
Im using XamWebChart.v10.3.
Thanks in advance.
Hi Marisa,
Thanks for your kind help.
I have gone through Graham's code and i managed to solve my problem.
Following is the modification which i have made to my code. (FYI im using same event handler for line series and column series)
private void dataChart_Selected(object sender, DataItemMouseEventArgs e) { string value = string.Empty; string label = string.Empty; if (e.Element as ColumnChartDataPointTemplate != null) { ColumnChartDataPointTemplate dataPointTemplate = (ColumnChartDataPointTemplate)e.Element; if (dataPointTemplate != null) { value = dataPointTemplate.DataPoint.Value.ToString(); label = dataPointTemplate.DataPoint.Label.ToString(); } } else if (e.Element as Shape != null) { Shape s = e.Element as Shape; if (s != null && s.Tag != null && s.Tag is Dictionary<Type, object>) { Dictionary<Type, object> dict = (Dictionary<Type, object>)s.Tag; label = ((DataPoint)dict[typeof(DataPoint)]).Label.ToString(); value = ((DataPoint)dict[typeof(DataPoint)]).Value.ToString(); } } if ((label.Length > 0) && (value.Length > 0)) { MessageBox.Show("Selected Value : " + value, label, MessageBoxButton.OK); } }
Once again, many thanks for your help.
Best Regards
Hi,
I scoured through some older forum posts, and found this one:
http://community.infragistics.com/forums/p/36069/210089.aspx#
I believe the code that Graham suggests is exactly what you are looking for (however, it is a bit more complicated than the code for the simple ColumnChartDataPointTemplate).
Hope this helps,
Marisa
Thanks for your reply.
I have attached the .xaml and .cs files. Please help me to look into Line Chart DataPoint Click event.
Below is what i am trying to achieve :
1) need to plot 3 charts to display different set of data.
2) user may able to click any charts by date, to view detailed view in datagrid.
Problem:
need an event which fires when the user click on the charts datapoint. (if this is very complicated, can we fire any event when user click the Label instead ?)
Looking forward for any solution.
Cheers.
Hi jojo4122,
I am unable to reproduce the issue you are seeing with a simple application of my own. Would you mind attaching a sample of the issue you are experiencing along with any steps to reproduce it? This way I'll be better able to assist you.
Thak you,