Layout in EJ 1 ASP.NET MVC TreeMap

18 Nov 2017 / 1 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())

    Layout_img1

    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())

    Layout_img2

    SliceAndDiceHorizontal Layout

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

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

    Layout_img3

    SliceAndDiceVertical Layout

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

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

    Layout_img4