Layout

18 Nov 20171 minute to read

You can decide on the visual representation of nodes belonging to all the treemap levels using the ItemsLayoutMode property of the TreeMap.

There are four different TreeMap Layouts such as

  • Squarified Layout
  • SliceAndDiceAuto Layout
  • SliceAndDiceHorizontal Layout
  • SliceAndDiceVertical Layout

Squarified Layout

Squarified layout creates rectangles with best aspect ratio.

  • CSHTML
  • @(Html.EJ().TreeMap("treemap")
    
    		.DataSource(datasource)
    
    		.ColorValuePath("Growth")
    
    		.WeightValuePath("Population")               
    
    		.Levels(lv =>
    
    		{
    
    			lv.GroupPath("Continent")
    
    			  .GroupGap(5).Add();
    
    		})     
    
    		.ItemsLayoutMode("Squarified")           
    
    		.Render())

    SliceAndDiceAuto Layout

    SliceAndDiceAuto layout creates rectangles with high aspect ratio and displays them sorted both horizontally and vertically.

  • CSHTML
  • @(Html.EJ().TreeMap("treemap")
    
    		.ItemsLayoutMode("SliceAndDiceAuto ")
    
    		.Render())

    SliceAndDiceHorizontal Layout

    SliceAndDiceHorizontal layout creates rectangles with high aspect ratio and displays them sorted horizontally.

  • CSHTML
  • @(Html.EJ().TreeMap("treemap")
    
    		.ItemsLayoutMode("SliceAndDiceHorizontal ")
    
    		.Render())

    SliceAndDiceVertical Layout

    SliceAndDiceVertical layout creates rectangles with high aspect ratio and displays them sorted vertical.

  • CSHTML
  • @(Html.EJ().TreeMap("treemap")
    
    		.ItemsLayoutMode("SliceAndDiceVertical ")
    
    		.Render())