It sounds to me like your bar chart uses master measures and dimensions, so you need to lookup the id used for referencing them in the hypercube and look up the corresponding definitions among the master objects. So once you have you've gotten the ID from the hypercube, you can get a dimension object from the app using this method:
Once you have used this method, you can inspect the properties of the returned object to find the definition.
You might also want to have a look at these two methods for accessing the lists of all master measures and dimensions:
Once you have those list objects you can access the information from the layout like this:
var layout = await list.GetLayoutAsync(); var listItems = layout.As<DimensionListLayout>().DimensionList.Items; var allMasterDimensionIds = listItems.Select(container => container.Info.Id);
Actually I am new to QlikSense, so I've a very little understanding of Hypercubes. But based on what I read, all the dimensions and measures that are created in the visuals will be in hypercube.
I've gone through some public examples given in the Qlik website and able to get the dimensions and measures of the charts using the below piece of code.
I am calling the Print method with the required parameters.
Print(thePieChart.Properties.HyperCubeDef, thePieChart.Title, app);
Is it the best way? Also how can I retrieve other properties like
- Bar chart - color properties (which color mode is used)
- Bar chart layout - Vertical or Horizontal
- Sorting - Asc or Desc.
A hypercube is the main structure for used by Qlik Sense for handling filtering of data. A list object is sort of a special case hypercube with just one dimension and no measures.
To look at the details of properties used explicitly for bar charts, you need to inspect the client specific properties for that type of visualization. This example gives a high level view of how to do that:
In particular, have a look at the type switch used in the last method in this file:
If a generic object is a bar chart, then you can access its properties like this:
var barChart = theGenericObject as Barchart;
And once you have done that you can access it's definition through the "Properties" property. So to inspect the color definition, you could for instance do like this:
var color = barChart.Properties.Color;
You might want to check out this class that encapsulates the bar chart properties: BarchartProperties Class
The vertical/horizontal behavior can similarly be inspected through the "Orientation" property of BarchartProperties, but the sorting order is a concept used by the hypercube, so you have to go all the way into the definitions of the individual dimensions to inspect sort configurations.