src/chart/sunburst/sunburstLayout.js
function (node, startAngle) {
            if (!node) {
                return;
            }

            var endAngle = startAngle;

            // Render self
            if (node !== virtualRoot) {
                // Tree node is virtual, so it doesn't need to be drawn
                var value = node.getValue();

                var angle = (sum === 0 && stillShowZeroSum)
                    ? unitRadian : (value * unitRadian);
                if (angle < minAngle) {
                    angle = minAngle;
                    restAngle -= minAngle;
                }
                else {
                    valueSumLargerThanMinAngle += value;
                }

                endAngle = startAngle + dir * angle;

                var depth = node.depth - rootDepth
                    - (renderRollupNode ? -1 : 1);
                var rStart = r0 + rPerLevel * depth;
                var rEnd = r0 + rPerLevel * (depth + 1);

                var itemModel = node.getModel();
                if (itemModel.get('r0') != null) {
                    rStart = parsePercent(itemModel.get('r0'), size / 2);
                }
                if (itemModel.get('r') != null) {
                    rEnd = parsePercent(itemModel.get('r'), size / 2);
                }

                node.setLayout({
                    angle: angle,
                    startAngle: startAngle,
                    endAngle: endAngle,
                    clockwise: clockwise,
                    cx: cx,
                    cy: cy,
                    r0: rStart,
                    r: rEnd
                });
            }

            // Render children
            if (node.children && node.children.length) {
                // currentAngle = startAngle;
                var siblingAngle = 0;
                zrUtil.each(node.children, function (node) {
                    siblingAngle += renderNode(node, startAngle + siblingAngle);
                });
            }

            return endAngle - startAngle;
        }
function (node, startAngle) {
            if (!node) {
                return;
            }

            var endAngle = startAngle;

            // Render self
            if (node !== virtualRoot) {
                // Tree node is virtual, so it doesn't need to be drawn
                var value = node.getValue();

                var angle = (sum === 0 && stillShowZeroSum)
                    ? unitRadian : (value * unitRadian);
                if (angle < minAngle) {
                    angle = minAngle;
                    restAngle -= minAngle;
                }
                else {
                    valueSumLargerThanMinAngle += value;
                }

                endAngle = startAngle + dir * angle;

                var depth = node.depth - rootDepth
                    - (renderRollupNode ? -1 : 1);
                var rStart = r0 + rPerLevel * depth;
                var rEnd = r0 + rPerLevel * (depth + 1);

                var itemModel = node.getModel();
                if (itemModel.get('r0') != null) {
                    rStart = parsePercent(itemModel.get('r0'), size / 2);
                }
                if (itemModel.get('r') != null) {
                    rEnd = parsePercent(itemModel.get('r'), size / 2);
                }

                node.setLayout({
                    angle: angle,
                    startAngle: startAngle,
                    endAngle: endAngle,
                    clockwise: clockwise,
                    cx: cx,
                    cy: cy,
                    r0: rStart,
                    r: rEnd
                });
            }

            // Render children
            if (node.children && node.children.length) {
                // currentAngle = startAngle;
                var siblingAngle = 0;
                zrUtil.each(node.children, function (node) {
                    siblingAngle += renderNode(node, startAngle + siblingAngle);
                });
            }

            return endAngle - startAngle;
        }
function ( node , startAngle ) { if ( ! node ) { return ; } var endAngle = startAngle ; // Render self if ( node !== virtualRoot ) { // Tree node is virtual, so it doesn't need to be drawn var value = node . getValue ( ) ; var angle = ( sum === 0 && stillShowZeroSum ) ? unitRadian : ( value * unitRadian ) ; if ( angle < minAngle ) { angle = minAngle ; restAngle -= minAngle ; } else { valueSumLargerThanMinAngle += value ; } endAngle = startAngle + dir * angle ; var depth = node . depth - rootDepth - ( renderRollupNode ? - 1 : 1 ) ; var rStart = r0 + rPerLevel * depth ; var rEnd = r0 + rPerLevel * ( depth + 1 ) ; var itemModel = node . getModel ( ) ; if ( itemModel . get ( 'r0' ) != null ) { rStart = parsePercent ( itemModel . get ( 'r0' ) , size / 2 ) ; } if ( itemModel . get ( 'r' ) != null ) { rEnd = parsePercent ( itemModel . get ( 'r' ) , size / 2 ) ; } node . setLayout ( { angle : angle , startAngle : startAngle , endAngle : endAngle , clockwise : clockwise , cx : cx , cy : cy , r0 : rStart , r : rEnd } ) ; } // Render children if ( node . children && node . children . length ) { // currentAngle = startAngle; var siblingAngle = 0 ; zrUtil . each ( node . children , function ( node ) { siblingAngle += renderNode ( node , startAngle + siblingAngle ) ; } ) ; } return endAngle - startAngle ; }
Render a tree
@return increased angle
Render a tree