src/chart/treemap/treemapLayout.js
function initChildren(node, nodeModel, totalArea, options, hideChildren, depth) {
    var viewChildren = node.children || [];
    var orderBy = options.sort;
    orderBy !== 'asc' && orderBy !== 'desc' && (orderBy = null);

    var overLeafDepth = options.leafDepth != null && options.leafDepth <= depth;

    // leafDepth has higher priority.
    if (hideChildren && !overLeafDepth) {
        return (node.viewChildren = []);
    }

    // Sort children, order by desc.
    viewChildren = zrUtil.filter(viewChildren, function (child) {
        return !child.isRemoved();
    });

    sort(viewChildren, orderBy);

    var info = statistic(nodeModel, viewChildren, orderBy);

    if (info.sum === 0) {
        return (node.viewChildren = []);
    }

    info.sum = filterByThreshold(nodeModel, totalArea, info.sum, orderBy, viewChildren);

    if (info.sum === 0) {
        return (node.viewChildren = []);
    }

    // Set area to each child.
    for (var i = 0, len = viewChildren.length; i < len; i++) {
        var area = viewChildren[i].getValue() / info.sum * totalArea;
        // Do not use setLayout({...}, true), because it is needed to clear last layout.
        viewChildren[i].setLayout({area: area});
    }

    if (overLeafDepth) {
        viewChildren.length && node.setLayout({isLeafRoot: true}, true);
        viewChildren.length = 0;
    }

    node.viewChildren = viewChildren;
    node.setLayout({dataExtent: info.dataExtent}, true);

    return viewChildren;
}
function initChildren(node, nodeModel, totalArea, options, hideChildren, depth) {
    var viewChildren = node.children || [];
    var orderBy = options.sort;
    orderBy !== 'asc' && orderBy !== 'desc' && (orderBy = null);

    var overLeafDepth = options.leafDepth != null && options.leafDepth <= depth;

    // leafDepth has higher priority.
    if (hideChildren && !overLeafDepth) {
        return (node.viewChildren = []);
    }

    // Sort children, order by desc.
    viewChildren = zrUtil.filter(viewChildren, function (child) {
        return !child.isRemoved();
    });

    sort(viewChildren, orderBy);

    var info = statistic(nodeModel, viewChildren, orderBy);

    if (info.sum === 0) {
        return (node.viewChildren = []);
    }

    info.sum = filterByThreshold(nodeModel, totalArea, info.sum, orderBy, viewChildren);

    if (info.sum === 0) {
        return (node.viewChildren = []);
    }

    // Set area to each child.
    for (var i = 0, len = viewChildren.length; i < len; i++) {
        var area = viewChildren[i].getValue() / info.sum * totalArea;
        // Do not use setLayout({...}, true), because it is needed to clear last layout.
        viewChildren[i].setLayout({area: area});
    }

    if (overLeafDepth) {
        viewChildren.length && node.setLayout({isLeafRoot: true}, true);
        viewChildren.length = 0;
    }

    node.viewChildren = viewChildren;
    node.setLayout({dataExtent: info.dataExtent}, true);

    return viewChildren;
}
function initChildren ( node , nodeModel , totalArea , options , hideChildren , depth ) { var viewChildren = node . children || [ ] ; var orderBy = options . sort ; orderBy !== 'asc' && orderBy !== 'desc' && ( orderBy = null ) ; var overLeafDepth = options . leafDepth != null && options . leafDepth <= depth ; // leafDepth has higher priority. if ( hideChildren && ! overLeafDepth ) { return ( node . viewChildren = [ ] ) ; } // Sort children, order by desc. viewChildren = zrUtil . filter ( viewChildren , function ( child ) { return ! child . isRemoved ( ) ; } ) ; sort ( viewChildren , orderBy ) ; var info = statistic ( nodeModel , viewChildren , orderBy ) ; if ( info . sum === 0 ) { return ( node . viewChildren = [ ] ) ; } info . sum = filterByThreshold ( nodeModel , totalArea , info . sum , orderBy , viewChildren ) ; if ( info . sum === 0 ) { return ( node . viewChildren = [ ] ) ; } // Set area to each child. for ( var i = 0 , len = viewChildren . length ; i < len ; i ++ ) { var area = viewChildren [ i ] . getValue ( ) / info . sum * totalArea ; // Do not use setLayout({...}, true), because it is needed to clear last layout. viewChildren [ i ] . setLayout ( { area : area } ) ; } if ( overLeafDepth ) { viewChildren . length && node . setLayout ( { isLeafRoot : true } , true ) ; viewChildren . length = 0 ; } node . viewChildren = viewChildren ; node . setLayout ( { dataExtent : info . dataExtent } , true ) ; return viewChildren ; }
Set area to each child, and calculate data extent for visual coding.
Set area to each child and calculate data extent for visual coding .