Discussion board where members can learn more about Integration, Extensions and API’s for Qlik Sense.
I am trying to retrieve the following information of any type of visuals in .Net SDK.
For example, if there is a bar chart, I would like to retrieve
I am trying to retrieve measure and dimension information using DimensionInfo and MeasureInfo properties. But those are returning the object details instead of the actual values.
Note: Measures and Dimensions are not defined in Hyper cube in my case. I am able to retrieve the data in the chart using DataPages.First().Matrix.ToDictionary(row => row.ElementAt(0).Text, row => row.ElementAt(1).Num) but need the above mentioned additional properties as well.
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
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.