Hello
I followed this guide to create a stacked chart with an OlapXAxis: http://help.infragistics.com/Help/Doc/WPF/2014.1/CLR4.0/html/xamDataChart_Customizing_Series_When_Used_With_Multi-Dimensional_Data_(OLAP_Data)_(xamDataChart).html
I subscribed to the MouseDoubleClick event, in where I want to get the clicked series. I am able to find the StackedColumnSeries, but not the exact sub-series (StackedColumnSeries has as Series collection). What I need is to get the same text the tooltip shows, to use in a drilldown.
Do you know if that is possible?
Hello logimatic,
In order to get the exact sub-series from the XamDataChart.MouseDoubleClick event, I would recommend that you utilize the e.OriginalSource property, where e is the event arguments of your event. If you double click on one of the columns of your StackedColumnSeries, this should return the Rectangle element that makes up those columns. The data context of this Rectangle will be an element of the type Infragistics.Controls.Charts.DataContext. This DataContext element has a Series property that can return the ColumnFragment that makes up your sub-series in this case.
Unfortunately, it does not appear that the values can really be publically attained from the ColumnFragment in this case, and so I would recommend delving into the private API of the ColumnFragment, using reflection to get the value of its ValueColumn property, and getting the "Values" property from the value of the ValueColumn. This should return a List<double>.
It so happens that the index minus 1 of the Rectangles on the drawing canvas corresponds to the indices of this List<double> retrieved from the ValueColumn. You can retrieve this Canvas from the RootCanvas property of the ColumnFragment mentioned above and use it's Children.IndexOf method to find the index of the Rectangle e.OriginalSource that you had double-clicked. Doing this will allow you to get the value that the Rectangle represents, and using the code from our website, it appears that the ColumnFragment's Title will be your actual underlying value member path. Assuming you are using ShowDefaultTooltip = true on your StackedFragmentSeries elements, this should be all you need to get the tooltip that shows on each of these columns.
I have attached a sample project to demonstrate the above. I hope this helps.
Please let me know if you have any other questions or concerns on this matter.
Sincerely,AndrewAssociate Developer
Hi Andrew
Thanks for your help, this works fine.
However I need the same thing with the types: StackedAreaSeries, StackedLineSeries and StackedSplineSeries(). Here the OriginalSource is Windows.Shape.Path and the DataContext property is null. Do you have any idea?
To be a little more specific, I just need the vertical index and I can get the info I need.
For the columns i can get it this way:
ColumnFragment fragment = context.Series as ColumnFragment;
var index = fragment.Index;
But I cannot figure out how to get it from a Path?
In order to get up to the "fragment" that exists for the StackedAreaSeries, StackedLineSeries, and StackedSplineSeries, I would recommend using the Infragistics.Windows.Utilities class to get up to the corresponding AreaFragment, LineFragment, or SplineFragment, respectively. This class has a static GetAncestorFromType method that you can use to traverse the ancestral visual tree of your path and get its parent fragment type. For example, you could do something like the following to get an AreaFragment:
AreaFragment fragment = Utilities.GetDescendantFromType(path, typeof(AreaFragment), false) as AreaFragment;
I hope this helps. Please let me know if you have any other questions or concerns on this matter.