private void drawChart() {
        levelMap.clear();
        for (int i = 0 ; i <= maxLevel ; i++) { levelMap.put(i, new ArrayList<>()); }
        root.stream().forEach(node -> levelMap.get(node.getDepth()).add(node));
        boolean         isInteractive      = isInteractive();
        double          ringStepSize       = size * 0.8 / maxLevel;
        double          ringRadiusStep     = ringStepSize * 0.5;
        double          barWidth           = isInteractive ? ringStepSize * 0.5 : ringStepSize * 0.49;
        double          textRadiusStep     = size * 0.4 / maxLevel;
        double          segmentStrokeWidth = ringStepSize * 0.01;
        Color           bkgColor           = getBackgroundColor();
        Color           textColor          = getTextColor();
        TextOrientation textOrientation    = getTextOrientation();
        double          maxTextWidth       = barWidth * 0.9;

        chartCtx.clearRect(0, 0, size, size);
        chartCtx.setFill(isInteractive ? Color.TRANSPARENT : bkgColor);
        chartCtx.fillRect(0, 0, size, size);

        chartCtx.setFont(Fonts.latoRegular(barWidth * 0.2));
        chartCtx.setTextBaseline(VPos.CENTER);
        chartCtx.setTextAlign(TextAlignment.CENTER);
        chartCtx.setLineCap(StrokeLineCap.BUTT);

        segments.clear();

        for (int level = 1 ; level <= maxLevel ; level++) {
            List<TreeNode<ChartData>> nodesAtLevel = levelMap.get(level);
            double         xy           = centerX - ringStepSize * level * 0.5;
            double         wh           = ringStepSize * level;
            double         outerRadius  = ringRadiusStep * level + barWidth * 0.5;
            double         innerRadius  = outerRadius - barWidth;

            double segmentStartAngle;
            double segmentEndAngle = 0;
            for (TreeNode<ChartData> node : nodesAtLevel) {
                ChartData segmentData  = node.getItem();
                double    segmentAngle = getParentAngle(node) * getPercentage(node);
                Color     segmentColor = getUseColorFromParent() ? node.getMyRoot().getItem().getFillColor() : segmentData.getFillColor();

                segmentStartAngle = 90 + segmentEndAngle;
                segmentEndAngle  -= segmentAngle;

                // Only draw if segment fill color is not TRANSPARENT
                if (!Color.TRANSPARENT.equals(segmentData.getFillColor())) {
                    double value = segmentData.getValue();

                    if (isInteractive) {
                        segments.add(createSegment(-segmentStartAngle, -segmentStartAngle + segmentAngle, innerRadius, outerRadius, segmentColor, bkgColor, node));
                    } else {
                        // Segment Fill
                        chartCtx.setLineWidth(barWidth);
                        chartCtx.setStroke(segmentColor);
                        chartCtx.strokeArc(xy, xy, wh, wh, segmentStartAngle, -segmentAngle, ArcType.OPEN);

                        // Segment Stroke
                        double radStart = Math.toRadians(segmentStartAngle);
                        double cosStart = Math.cos(radStart);
                        double sinStart = Math.sin(radStart);
                        double x1       = centerX + innerRadius * cosStart;
                        double y1       = centerY - innerRadius * sinStart;
                        double x2       = centerX + outerRadius * cosStart;
                        double y2       = centerY - outerRadius * sinStart;

                        chartCtx.setLineWidth(segmentStrokeWidth);
                        chartCtx.setStroke(bkgColor);
                        chartCtx.strokeLine(x1, y1, x2, y2);
                    }

                    // Visible Data
                    if (getVisibleData() != VisibleData.NONE && segmentAngle > textOrientation.getMaxAngle()) {
                        double radText    = Math.toRadians(segmentStartAngle - (segmentAngle * 0.5));
                        double cosText    = Math.cos(radText);
                        double sinText    = Math.sin(radText);
                        double textRadius = textRadiusStep * level;
                        double textX      = centerX + textRadius * cosText;
                        double textY      = centerY - textRadius * sinText;

                        chartCtx.setFill(getUseChartDataTextColor() ? segmentData.getTextColor() : textColor);

                        chartCtx.save();
                        chartCtx.translate(textX, textY);

                        rotateContextForText(chartCtx, segmentStartAngle, -(segmentAngle * 0.5), textOrientation);

                        switch (getVisibleData()) {
                            case VALUE:
                                chartCtx.fillText(String.format(Locale.US, formatString, value), 0, 0, maxTextWidth);
                                break;
                            case NAME:
                                chartCtx.fillText(segmentData.getName(), 0, 0, maxTextWidth);
                                break;
                            case NAME_VALUE:
                                chartCtx.fillText(String.join("", segmentData.getName(), " (", String.format(Locale.US, formatString, value),")"), 0, 0, maxTextWidth);
                                break;
                        }
                        chartCtx.restore();
                    }
                }
            }
        }

        segmentPane.getChildren().setAll(segments);
    }
Defines the root element of the tree
@param TREE
src/main/java/eu/hansolo/tilesfx/chart/SunburstChart.java