Qlik Community

Qlik Sense Integration, Extensions, & APIs

Discussion board where members can learn more about Integration, Extensions and API’s for Qlik Sense.

prabhuappu
Contributor II

Help Needed to Create Treemap using Qliksense SDK !!!

Hi All,

I'm trying to create Treemap using Qliksense SDK. I'm using the below code,

var LibraryDimension = application.CreateDimension("Dim2", new DimensionProperties { Dim = new NxLibraryDimensionDef { FieldDefs = new[] { "Year" } }, Title = "Dimension1 " });

var LibraryExpression = application.CreateMeasure("Sum(SalesAmount)", new MeasureProperties { Measure = new NxLibraryMeasureDef { Def = "Sum(SalesAmount)" }, Title = "Measure1" });

var treeChart = Sheet.CreateTreemap("MyNewChart", new TreemapProperties { Title = "MyBar" });

treeChart.SuspendLayout();

treeChart.Properties.HyperCubeDef = new Qlik.Sense.Client.Visualizations.VisualizationHyperCubeDef

{

  Dimensions = new List<HyperCubeDimensionDef>(){

  new HyperCubeDimensionDef(){

  LibraryId=LibraryDimension.Info.Id, IncludeElemValue=false, NullSuppression=true

  }

  },

  Measures = new List<HyperCubeMeasureDef>(){

  new HyperCubeMeasureDef(){

  LibraryId=LibraryExpression.Info.Id,

  }

  },

  InterColumnSortOrder = new[] {1, 0},

  InitialDataFetch = new List<NxPage> { new NxPage { Height = 10, Left = 0, Top = 0, Width = 2 } }.ToArray()

};

treeChart.ResumeLayout();

But i'm not getting the chart. I'm able to create other charts using the same code, just by changing the Createchart method.

Is there any Properties i'm missing for TreeMap?

Thanks in Advance

Prabhu Appu

1 Solution

Accepted Solutions
Not applicable

Re: Help Needed to Create Treemap using Qliksense SDK !!!

Hi Prabhu,

you have to set the NxHypercubeMode of the VizualizationHyperCubeDef. In your example it would be

                InterColumnSortOrder = new[] {1, 0},

                InitialDataFetch = new List<NxPage> {new NxPage {Height = 10, Left = 0, Top = 0, Width = 2}}.ToArray(),

                Mode = NxHypercubeMode.DATA_MODE_PIVOT_STACK

Best Regards,

Helene

2 Replies
Not applicable

Re: Help Needed to Create Treemap using Qliksense SDK !!!

Hi Prabhu,

you have to set the NxHypercubeMode of the VizualizationHyperCubeDef. In your example it would be

                InterColumnSortOrder = new[] {1, 0},

                InitialDataFetch = new List<NxPage> {new NxPage {Height = 10, Left = 0, Top = 0, Width = 2}}.ToArray(),

                Mode = NxHypercubeMode.DATA_MODE_PIVOT_STACK

Best Regards,

Helene

prabhuappu
Contributor II

Re: Help Needed to Create Treemap using Qliksense SDK !!!

Thanks Helene,

It is working now. And I need to set "AlwaysFullyExpanded=true" option. Otherwise it is not showing the Second dimension.

Regards,

Prabhu Appu

Community Browser