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
2090
XamDataChart: Get Selected Column and change color of selected column
posted

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://ko.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 ViewModel

Thanks in advance

Niko