## Properties

Name | Type | Default
--- | --- | ---
baseColor | String | '#C2EEFF'
Sets or gets the default color used when the `colorMode` property is set to `"autoColors"`.

#### Code example

Set the `baseColor` property.

    $("#jqxTreeMap").jqxTreeMap({baseColor: '#ff0000'});

Get the `baseColor` property.

    var baseColor = $('#jqxTreeMap').jqxTreeMap('baseColor');

Try it: baseColor is set to '#52CBFF'
colorRanges | Array | [ { color: '#aa9988', min: 0, max: 10 }, { color: '#ccbbcc', min: 11, max: 50 }, { color: '#000', min: 50, max: 100 } ];
Sets or gets the color ranges used when the `colorMode` property is set to `"rangeColors"`

#### Code examples

Set the `colorRanges` property.

    $('#jqxTreeMap').jqxTreeMap({ colorRanges:
    [
        { color: '#aa9988', min: 0,  max: 10  },
        { color: '#ccbbcc', min: 11, max: 50  },
        { color: '#000',    min: 50, max: 100 }
    ]
    });

Get the `colorRanges` property.

    var colorRanges = $('#jqxTreeMap').jqxTreeMap('colorRanges');

Try it: colorRanges is set to {x: 5, y: 0}
colorRange | Number | 100
Sets or gets the range in which the base colors can vary. The value is expected to be from 0 to 255.

#### Code example

Set the `colorRange` property.

    $("#jqxTreeMap").jqxTreeMap({colorRange: 120});

Get the `colorRange` property.

    var colorRange = $('#jqxTreeMap').jqxTreeMap('colorRange');

Try it: colorRange is set to 100
colorMode | String | 'parent'
Sets or gets the sectors rendering behavior. There are three different types of color mode:

- parent - a child sector inherits the color from its parent sector. Depending on the child value and the colorRange property the color varies.
- autoColors - automatic color generation based on the baseColor/colorRange and the value.
- rangeColors - the user can sets array of color ranges. Each color range has the properties min, max and color.

#### Code example

Set the `colorMode` property.

    $("#jqxTreeMap").jqxTreeMap({colorMode: 'rangeColors'});

Get the `colorMode` property.

    var colorMode = $('#jqxTreeMap').jqxTreeMap('colorMode');

Try it: colorMode is set to 'autoColors'
displayMember | String | ""
Sets or gets the `displayMember` property. The `displayMember` determines the name of an object property to display. The name is contained in the collection specified by the `source` property and the name is stored in the `label` field of each sector. The property is taken into account when the jqxTreeMap's `source` property points to jqxDataAdapter instance.

#### Code example

Set the `displayMember` property.

    $("#jqxTreeMap").jqxTreeMap({displayMember: 'firstName'});

Get the `displayMember` property.

    var displayMember = $('#jqxTreeMap').jqxTreeMap('displayMember');

Try it: displayMember is set to label
height | Number/String | 600
Sets or gets the jqxTreeMap's height.

#### Code examples

Set the `height` property.

    $('#jqxTreeMap').jqxTreeMap({height:"400px"});

Get the `height` property.

    var height = $('#jqxTreeMap').jqxTreeMap('height');

Try it: height is set to 300
hoverEnabled | Boolean | false
Sets or gets whether a sector will be outlined when the mouse cursor is over it.

#### Code examples

Set the `hoverEnabled` property.

    $('#jqxTreeMap').jqxTreeMap({ hoverEnabled: true });

Get the `hoverEnabled` property.

    var hoverEnabled = $('#jqxTreeMap').jqxTreeMap('hoverEnabled');

Try it: hoverEnabled is set to true
headerHeight | Number | 25
Sets or gets the height of the parent sector's header.

#### Code examples

Set the `headerHeight` property.

    $('#jqxTreeMap').jqxTreeMap({ headerHeight: 30 });

Get the `headerHeight` property.

    var headerHeight = $('#jqxTreeMap').jqxTreeMap('headerHeight');

Try it: headerHeight is set to 30
legendLabel | String | "Legend"
Sets or gets the Legend's label.

#### Code examples

Set the `legendLabel` property.

    $('#jqxTreeMap').jqxTreeMap({ legendLabel: "New Label" });

Get the `legendLabel` property.

    var legendLabel = $('#jqxTreeMap').jqxTreeMap('legendLabel');

Try it: legendLabel is set to 'Olympic medal count - London 2012'
legendPosition | Object | { x: 0, y: -5 }
Sets or gets the Legend's position. The `x` determines the X offset of the Legend from the left side of the jqxTreeMap. The `y` determines the Y offset of the Legend from the bottom side of jqxTreeMap.

#### Code example

Set the `legendPosition` property.

    $("#jqxTreeMap").jqxTreeMap({legendPosition: {x: 50, y: -50}});

Get the `legendPosition` property.

    var baseColor = $('#jqxTreeMap').jqxTreeMap('legendPosition');

Try it: legendPosition is set to {x: 5, y: 0}
legendScaleCallback | Object | null
Sets or gets a callback function which formats the values displayed in the jqxTreeMap's Legend.

#### Code examples

Set the `legendScaleCallback` property .

    $('#jqxTreeMap').jqxTreeMap({
        width: '600',
        height: '500',
        source: data,
        colorRange: 100,
        colorMode: 'autocolors',
        baseColor: '#52CBFF',
        legendScaleCallback: function (v) {
            v = v.toFixed(1);
            return v;
        },
        legendLabel: 'Olympic medal count - London 2012'
    });

Get the `legendScaleCallback` property.

    var legendScaleCallback = $('#jqxTreeMap').jqxTreeMap('legendScaleCallback ');

Try it: legendScaleCallback is set to a custom function
renderCallbacks | Object | null
Sets or gets callback function(s) which enable you to customize the rendering of any sector in the jqxTreeMap. To define a callback function for all sectors, use the "*" : function(sectorHtmlElement, sectorData) syntax. To define a callback function for a specific element, use its `label` value instead of "*".

#### Code example

Set the `renderCallbacks` property.

    $('#jqxTreeMap').jqxTreeMap({
        renderCallbacks: {
            '*': function (sectorHtmlElement, sectorData) {
                if (sectorData.data) {
                    sectorHtmlElement.jqxTooltip({
                        content: "content",
                        position: 'mouse',
                        autoHideDelay: 6000,
                        theme: theme
                    });
                } else if (sectorData.data === undefined) {
                    sectorHtmlElement.css({
                        backgroundColor: '#fff',
                        border: '1px solid #aaa'
                    });
                }
            }
        }
    });

Get the `renderCallbacks` property.

    var renderCallbacks = $('#jqxTreeMap').jqxTreeMap('renderCallbacks');

Try it: renderCallbacks is set to a custom function
selectionEnabled | Boolean | true
Sets or gets whether a sector will be outlined when it is clicked..

#### Code examples

Set the `selectionEnabled` property.

    $('#jqxTreeMap').jqxTreeMap({ selectionEnabled: false });

Get the `selectionEnabled` property.

    var selectionEnabled = $('#jqxTreeMap').jqxTreeMap('selectionEnabled');

Try it: selectionEnabled is set to false
showLegend | Boolean | true
Determines whether the jqxTreeMap's Legend is displayed. Legend is possible to be displayed when the `colorMode` property is set to `"autoColors"` or `"rangeColors"`.

#### Code examples

Set the `showLegend` property.

    $('#jqxTreeMap').jqxTreeMap({ showLegend: false });

Get the `enableHover` property.

    var showLegend = $('#jqxTreeMap').jqxTreeMap('showLegend');

Try it: showLegend is set to false
source | Object | null
Specifies the jqxTreeMap's data source. Use this property to populate the jqxTreeMap.

#### Code examples

Initialize a jqxTreeMap with the `source` property specified.

    var data = [
    {
        label: 'Drama',
        value: null,
        color: '#B3FAFF'
    },
    {
        label: 'Crime',
        value: null,
        color: '#95FF7A'
    },
    {
        label: 'Action',
        value: null,
        color: '#FFA3CE'
    },
    {
        label: 'Comedy',
        value: null,
        color: '#F1A3FF'
    },
    {
        label: 'The Shawshank Redemption',
        value: 15.4,
        parent: 'Drama',
        data: { description: "Two imprisoned men bond over a number of years, finding solace and eventual redemption through acts of common decency.", title: "The Shawshank Redemption (1994)" }
    },
    {
        label: 'Top Gun',
        value: 4,
        parent: 'Drama',
        data: { description: "As students at the Navy's elite fighter weapons school compete to be best in the class, one daring young flyer learns a few things from a civilian instructor that are not taught in the classroom.", title: "Top Gun (1986)" }
    },
    {
        label: 'The Master',
        value: 4.5,
        parent: 'Drama',
        data: { description: "A Naval veteran arrives home from war unsettled and uncertain of his future - until he is tantalized by The Cause and its charismatic leader.", title: "The Master (2012)" }
    },
    {
        label: 'Argo',
        value: 6.8,
        parent: 'Drama',
        data: { description: "A dramatization of the 1980 joint CIA-Canadian secret operation to extract six fugitive American diplomatic personnel out of revolutionary Iran.", title: "Argo (2012)" }
    },
    {
        label: 'Fight Club',
        value: 8.8,
        parent: 'Crime',
        data: { description: "An insomniac office worker looking for a way to change his life crosses paths with a devil-may-care soap maker and they form an underground fight club that evolves into something much, much more.", title: "Fight Club (1999)" }
    },
    {
        label: 'The Godfather',
        value: 11,
        parent: 'Crime',
        data: { description: "The aging patriarch of an organized crime dynasty transfers control of his clandestine empire to his reluctant son.", title: "The Godfather (1972)" }
    },
    {
        label: 'The Dark Knight',
        value: 8.9,
        parent: 'Action',
        data: { description: "When Batman, Gordon and Harvey Dent launch an assault on the mob, they let the clown out of the box, the Joker, bent on turning Gotham on itself and bringing any heroes down to his level.", title: "The Dark Knight (2008)" }
    },
    {
        label: 'Pulp Fiction',
        value: 6.0,
        parent: 'Crime',
        data: { description: "The lives of two mob hit men, a boxer, a gangster's wife, and a pair of diner bandits intertwine in four tales of violence and redemption.", title: "Pulp Fiction (1994)" }
    },
    {
        label: 'Forrest Gump',
        value: 8.7,
        parent: 'Drama',
        data: { description: "Forrest Gump, while not intelligent, has accidentally been present at many historic moments, but his true love, Jenny Curran, eludes him.", title: "Forrest Gump (1994)" }
    },
    {
        label: 'The Matrix',
        value: 8.7,
        parent: 'Action',
        data: { description: "A computer hacker learns from mysterious rebels about the true nature of his reality and his role in the war against its controllers.", title: "The Matrix (1999)" }
    },
    {
        label: '12 Angry Men',
        value: 7.9,
        parent: 'Drama',
        data: { description: "Twelve men must decide the fate of one when one juror objects to the jury's decision.", title: "12 Angry Men (TV 1997)" }
    },
    {
        label: 'Star Wars',
        value: 10.8,
        parent: 'Action',
        data: { description: "Luke Skywalker, a spirited farm boy, joins rebel forces to save Princess Leia from the evil Darth Vader, and the galaxy from the Empire's planet-destroying Death Star..", title: "Star Wars: Episode IV - A New Hope (1977)" }
    },
    {
        label: 'Inception',
        value: 9.8,
        parent: 'Action',
        data: { description: "A skilled extractor is offered a chance to regain his old life as payment for a task considered to be impossible.", title: "Inception (2010)" }
    },
    {
        label: 'Snatch.',
        value: 4.3,
        parent: 'Crime',
        data: { description: "Unscrupulous boxing promoters, violent bookmakers, a Russian gangster, incompetent amateur robbers, and supposedly Jewish jewelers fight to track down a priceless stolen diamond.", title: "Snatch (2000)" }
    },
    {
        label: 'Toy Story',
        value: 9.3,
        parent: 'Comedy',
        data: { description: "A cowboy doll is profoundly threatened and jealous when a new spaceman figure supplants him as top toy in a boy's room.", title: "Toy Story(2005)" }
    },
    {
        label: 'Skyfall',
        value: 7,
        parent: 'Crime',
        data: { description: "Bond's loyalty to M is tested when her past comes back to haunt her. Whilst MI6 comes under attack, 007 must track down and destroy the threat, no matter how personal the cost.", title: "Skyfall (2012)" }
    },
    {
        label: 'Parker',
        value: 5.6,
        parent: 'Crime',
        data: { description: "A thief with a unique code of professional ethics is double-crossed by his crew and left for dead. Assuming a new disguise and forming an unlikely alliance with a woman on the inside, he looks to hijack the score of the crew's latest heist.", title: "Parker (1994)" }
    },
    {
        label: 'District 9',
        value: 6.0,
        parent: 'Action',
        data: { description: "An extraterrestrial race forced to live in slum-like conditions on Earth suddenly finds a kindred spirit in a government agent who is exposed to their biotechnology.", title: "District 9 (2009)" }
    },
    {
        label: 'Stalag 17',
        value: 6.1,
        parent: 'Comedy',
        data: { description: "When two escaping American World War II prisoners are killed, the German POW camp barracks black marketeer, J.J. Sefton, is suspected of being an informer.", title: "Stalag 17 (1953)"}
    }
    ];

    var theme = "";

    $('#jqxTreeMap').jqxTreeMap({
        width: 600,
        height: 600,
        source: data,

        colorRange: 50,
        renderCallbacks: {
            '*': function (element, value) {
                if (value.data) {
                    element.jqxTooltip({
                        content: '<div><div style="font-weight: bold; max-width: 200px; font-family: verdana; font-size: 13px;">' + value.data.title + '</div><div style="width: 200px; font-family: verdana; font-size: 12px;">' + value.data.description + '</div></div>',
                        position: 'mouse',
                        autoHideDelay: 6000,
                        theme: theme
                    });
                } else if (value.data === undefined) {
                    element.css({
                        backgroundColor: '#fff',
                        border: '1px solid #aaa'
                    });
                }
            }
        }
    });
    });

Each item in the data source is required to have `label` and `value` fields. To create nested elements, you need to set the `parent` field to point to the `label` of another item. The `data` field enables you to store additional data associated to each treemap sector. By setting the `color` field you can determine the sector's background color.
In order to populate the jqxTreeMap through jqxDataAdapter, you need to set the "source" property of jqxTreeMap to point to an instance of jqxDataAdapter. The `label` and `value` fields of each treemap sector are determined by the `displayMember` and `valueMember` properties.

Initialize jqxTreeMap through jqxDataAdapter

    var source = {
        datatype: "tab",
        datafields: [
            { name: 'Year' },
            { name: 'HPI' },
            { name: 'BuildCost' },
            { name: 'Population' },
            { name: 'Rate' }
        ],
        url: '../sampledata/homeprices.txt'
    };

    var dataAdapter = new $.jqx.dataAdapter(source, { async: false, autoBind: true, loadError: function (xhr, status, error) { alert('Error loading "' + source.url + '" : ' + error); } });

    $('#jqxTreeMap').jqxTreeMap({
    width: '600',
    height: '500',
    source: dataAdapter,
    displayMember: 'Year',
    valueMember: 'Rate',
    colorMode: 'rangeColors',
    colorRanges: [
        { min: 0.02, max: 0.03, color: '#ff0300' },
        { min: 0.03, max: 0.04, color: '#fe2e00' },
        { min: 0.04, max: 0.05, color: '#fe3900' },
        { min: 0.05, max: 0.06, color: '#ff5400' },
        { min: 0.06, max: 0.07, color: '#fe7500' },
        { min: 0.07, max: 0.08, color: '#fe8200' },
        { min: 0.08, max: 0.09, color: '#ffed00' },
        { min: 0.09, max: 0.1, color: '#b8db00' },
        { min: 0.1, max: 0.11, color: '#7fbf00' },
        { min: 0.11, max: 0.12, color: '#50a600' },
        { min: 0.12, max: 0.15, color: '#008000' }
    ],
    legendScaleCallback: function (v) {
        return v;
    },
    renderCallbacks: {
        '*': function (element, data) {
                var content = '<div><div style="font-weight: bold; font-family: verdana; font-size: 13px;">Year: ' + data.record.Year + '</div>';        content += '<div style=" font-family: verdana; font-size: 12px;">HPI: ' + data.record.HPI + '</div>';        content += '<div style=" font-family: verdana; font-size: 12px;">Build Cost: ' + data.record.BuildCost + '</div>';        content += '<div style=" font-family: verdana; font-size: 12px;">Population: ' + data.record.Population + '</div>';        content += '<div style=" font-family: verdana; font-size: 12px;">Interest Rate: ' + data.record.Rate + '</div>';        content += '</div>';

            element.jqxTooltip({
                content: content,
                position: 'mouse',
                autoHideDelay: 6000
            });

        }
    },
    legendLabel: 'Interest Rate'
    });

Try it: source is set to data
theme | String | ''
Sets the widget's theme. jQWidgets uses a pair of css files - jqx.base.css and jqx.[theme name].css. The base stylesheet creates the styles related to the widget's layout like margin, padding, border-width, position. The second css file applies the widget's colors and backgrounds. The jqx.base.css should be included before the second CSS file. In order to set a theme, you need to do the following:

- Include the theme's CSS file after jqx.base.css.
  The following code example adds the 'energyblue' theme.

      <link rel="stylesheet" href="../../../../jqwidgets/styles/jqx.base.css" type="text/css" />
      <link rel="stylesheet" href="../../../../jqwidgets/styles/jqx.energyblue.css" type="text/css" />

- Set the widget's theme property to 'energyblue' when you initialize it.

Try it: theme is set to 'energyblue'
valueMember | String | ""
Sets or gets the `valueMember` property. The `valueMember` determines the name of an object property to set as a `value` of the treemap sectors. The name is contained in the collection specified by the `source` property. The property is taken into account when the jqxTreeMap's `source` property points to jqxDataAdapter instance.

#### Code example

Set the `valueMember` property.

    $("#jqxTreeMap").jqxTreeMap({valueMember: 'population'});

Get the `valueMember` property.

    var valueMember = $('#jqxTreeMap').jqxTreeMap('valueMember');

Try it: valueMember is set to value
width | Number/String | 600
Sets or gets the jqxTreeMap's width.

#### Code examples

Set the `width` property.

    $('#jqxTreeMap').jqxTreeMap({width:"200px"});

Get the `width` property.

    var width = $('#jqxTreeMap').jqxTreeMap('width');

Try it: width is set to 400

## Events

bindingComplete | Event |
This event is triggered when the jqxTreeMap's `source` property is set to point to jqxDataAdapter instance and the jqxDataAdapter's binding is finished.

#### Code examples

Bind to the `bindingComplete` event by type: jqxTreeMap. Note: Bind to that event before the widget's initialization. Otherwise, it is possible that the binding is already completed before you bind to it.

    $('#jqxTreeMap').on('bindingComplete', function (event) {

    });

Try it: Bind to the bindingComplete event by type: jqxTreeMap.

## Methods

destroy | Method |
Destroy the jqxTreeMap widget. The destroy method removes the jqxTreeMap widget from the web page.

Parameter | Type | Description
--- | --- | ---
None |  |

Return Value
None

#### Code example

Invoke the `destroy` method.

    $('#jqxTreeMap').jqxTreeMap('destroy');

Try it: destroy the jqxTreeMap.
render | Method |
Renders the jqxTreeMap widget.

Parameter | Type | Description
--- | --- | ---
None |  |

Return Value
None

#### Code example

Invoke the `render` method.

    $('#jqxTreeMap').jqxTreeMap('render');

Try it: renders the jqxTreeMap.