Hello,
I'm trying to figure out how to resolve a particular UI glitch with Olap Axis in XamDataChart in developed application. Luckily, I have found a reproduction in official Infragistics WPF 2016.2 Samples Pack (downloaded from HERE). The described problem persists in package 2017.1.
If you open xamDataChart / Display / Olap Axis - Multiple Series Types, you will find a sample chart that should look like in an attachment "1. Olap Axis - initial". Now, I drag two more fields to "Columns" section - for instance Sales Date and Sales Region. The result is shown in the second attachment "2. Olap Axis - multiple columns". As you can see, initially set column "Car" has been hidden by horizontal scrollbar.
I would like to see all labels displayed, not only some part of them, I am OK with vertically shrinked chart. Does anyone have any tips on how could I achieve that?
Cheers!
Artur
Hello Artur,
I have reproduced the behavior that you are referring to, and to resolve it, I would recommend that you apply a new AxisLabelSettings element to the OlapXAxis.LabelSettings property. This AxisLabelSettings element has an Extent property that pushes the space for the labels upward in the OlapXAxis, effectively shrinking the chart, but creating more room for the labels. You can read further about configuring the XamDataChart axis label settings here: https://www.infragistics.com/help/wpf/datachart-axis-label-settings. The code snippet there is for the CategoryXAxis, but the OlapXAxis will work similarly.
I have been in discussion with our development teams on this matter, and they believe that this Extent property should automatically be applied if not explicitly set, and so I have logged a new development issue in our internal tracking systems for this issue. I have also created a private support case for you on this matter with an ID of CAS-186774-L7J2S9, which I will link to this new development issue so that you can track it and be notified when anything changes. I will update this support case with further information shortly, and you can access the support case after signing into your Infragistics account, here: https://www.infragistics.com/my-account/support-activity.
Please let me know if you have any other questions or concerns on this matter.
Sincerely,AndrewAssociate Developer
Hello Andrew,
The answer is surely helpful, but I would appreciate some more guidance.
I would like the height of the labels to adjust dynamically when user adds/removes selected columns. When I set the Extent property to fixed value, the height of labels panel is - obviously - fixed. I guess I need a binding, but I have no clue to which property of which element should I bind. So far I tried to bind to the OlapXAxis.Height, but it does not seem to work. In Live Visual Tree I see that element responsible for displaying the labels is OlapLabelPanelHorizontal, but I have no clue as to how should I access it without traversing the elements tree in code-behind.
Any clues?
Cheers,
I have been investigating into a way to dynamically push the labels up in this case, and to do this I would recommend that you continue with the AxisLabelSettings.Extent property, but dynamically assign a new Extent each time an expansion or addition happens. To do this, I would recommend starting by handling the ResultChanged event of the Olap data source that you are using. This event fires any time an expansion or column, row, measure, or filter addition happens, and so it is perfect for this case. The below will assume that you are using a FlatDataSource. If you are using a different Olap data source, the procedure would be the same, but the types may differ.
In the ResultChanged event handler, I would recommend looping through each element in your FlatDataSource's Columns or Rows collection, depending on what your OlapXAxis.OlapAxisSource property is set to. Each element in these collections will be of the type "FlatDataFilterViewModel." These FlatDataFilterViewModel elements have a FilterMembers collection that contains each of the FlatFilterMember elements that make up your Olap hierarchy. Each FlatFilterMember has a FilterMembers collection of its own, returning the child FlatFilterMembers, and each of them have a HasChildren property and an IsExpanded property. Using this information, I would recommend using a recursive loop to get a List of all of your currently expanded FlatFilterMembers shown by the FlatDataSource bound to your OlapXAxis.
Once you obtain all of the currently expanded FlatFilterMembers, it will be useful for you to know that each of these has a Member property returning an Infragistics.Olap.Base.Member element. This element has a "LevelDepth" property that determines how deep in the hierarchy it is. If you find the maximum of the LevelDepths, you can find out how far your hierarchical data source has been expanded for each column in that data source. Note, that this number is zero-based, and so you will want to increment the sum of these level depths by the Count of either the Columns or Rows of your Olap source, again, depending on the OlapXAxis.OlapAxisSource property value.
This incremented sum can determine the Extent that you should assign to the AxisLabelSettings of your OlapXAxis, since each of the "level's" cells has a default height of about 22 pixels. Knowing this, if you set the AxisLabelSettings.Extent to (22 * incremented sum), you should be able to keep the "label panel" just above the zoombar of the chart.
I have attached a sample project to demonstrate the above. I hope this helps you.
Thanks Andrew, that solved the case!