import { elem } from "@d3plus/dom";
/**
    Draws a title if this._title is defined.
    @private
*/ export default function() {
    var data = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : [];
    var text = this._title ? this._title(data) : false;
    var padding = this._titlePadding() ? this._padding : {
        top: 0,
        right: 0,
        bottom: 0,
        left: 0
    };
    var transform = {
        transform: "translate(".concat(this._margin.left + padding.left, ", ").concat(this._margin.top, ")")
    };
    var group = elem("g.d3plus-viz-title", {
        enter: transform,
        parent: this._select,
        duration: 0,
        update: transform
    }).node();
    this._titleClass.data(text ? [
        {
            text: text
        }
    ] : []).locale(this._locale).select(group).width(this._width - (this._margin.left + this._margin.right + padding.left + padding.right)).config(this._titleConfig).render();
    this._margin.top += text ? group.getBBox().height + this._titleConfig.padding * 2 : 0;
}
