Hello,
in my app I am using a stacked bar chart to show the utilization of a resource over time. When the user clicks on one column I would like to show him this order which are part of this column. For this purpose I have used the following posting: https://es.infragistics.com/community/forums/p/50226/264216.aspx#264216
1. It works fine, but raises some warnings about Series.Chart which should be replaced by SeriesViewer - but this one does not have a property Axes.
private void FilterPPAs(object sender, System.Windows.Input.MouseButtonEventArgs e) { var s = this.Auslastung.Series.FirstOrDefault(); if (s == null) { return; } var position = e.GetPosition(s); var x = s.Chart.Axes.OfType<CategoryXAxis>().First(); var y = s.Chart.Axes.OfType<NumericYAxis>().First(); var viewport = new Rect(0, 0, x.ActualWidth, y.ActualHeight); var window = s.Chart.WindowRect; var unscaledX = x.GetUnscaledValue(position.X, new ScalerParams(window, viewport, false)); int currentColumn = (int)Math.Floor(unscaledX);2. Is there already a better way to get the current selected column to the ViewModel in order to filter some data?3. How can I change the color of the selected column until the filter is cleared again? The Hover Interaction examples from the Infragistics Sample Browser are not meeting this requirment. I am looking for a kind color switching for two states:a) Not selected -> regular color b) Selected -> different color, to be set and changed in the ViewModelThanks in advanceNiko
Hi Nikolaus,
We marked that Chart property as obsolete which is why you see that warning. SeriesViewer should be the correct property to use although you will need to cast it to a XamDataChart if you want to access the Axis collection. Alternatively, and easier in my opinion, I would just use your Auslastung property which is the name of your XamDataChart right?
As far as a better way to find out which column was clicked, you can handle the SeriesMouseLeftButtonDown event and this will tell you what data item was clicked which you can then get the index of from your data. This index should correlate with the column in the chart.
For changing the column color based on selection, this is a bit tricky because the brush color of the Rectangle elements are set by the control every refresh so whatever you set it too it will be overridden on the next refresh. There is a RefreshCompleted event that fires after the refresh so it would be a good place to change the color but let me try and see if there is a way to make this work through the view model. I will update you with my findings when I have completed my investigation.
Hello Rob,
thanks for the info regarding SeriesMouseLeftButtonDown. I understand now why I did not see this event: In the XAML Designer its not in the list of events.
I am looking forward for your research about coloring the currently selected column bar.
Niko