private renderLegend()

in src/gantt.ts [1433:1460]


    private renderLegend(): void {
        if (!this.viewModel.legendData) {
            return;
        }

        let position: LegendPosition = this.viewModel.settings.legend.show
            ? LegendPosition[this.viewModel.settings.legend.position]
            : LegendPosition.None;

        this.legend.changeOrientation(position);
        this.legend.drawLegend(this.viewModel.legendData, _.clone(this.viewport));
        LegendModule.positionChartArea(this.ganttDiv, this.legend);

        switch (this.legend.getOrientation()) {
            case LegendPosition.Left:
            case LegendPosition.LeftCenter:
            case LegendPosition.Right:
            case LegendPosition.RightCenter:
                this.viewport.width -= this.legend.getMargins().width;
                break;
            case LegendPosition.Top:
            case LegendPosition.TopCenter:
            case LegendPosition.Bottom:
            case LegendPosition.BottomCenter:
                this.viewport.height -= this.legend.getMargins().height;
                break;
        }
    }