"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.doughnutDefaults = {
    primaryLabel: {
        text: '',
        font: 'Arial',
        color: '#5e5e5e',
        size: 38,
        offsetFromCenter: 10
    },
    secondaryLabel: {
        text: '',
        font: 'Arial',
        color: '#b8b8b8',
        size: 9,
        offsetFromCenter: -12
    }
};
exports.doughnutLabel = {
    id: 'doughnut-label',
    drawlabel: function (chart, config) {
        var width = chart.width, height = chart.height, ctx = chart.ctx;
        ctx.fillStyle = config.color;
        ctx.font = config.size + "px " + config.font;
        var text = config.text;
        var textX = Math.round((width - ctx.measureText(text).width) / 2);
        var textY = height / 2 + config.offsetFromCenter;
        ctx.fillText(text, textX, textY);
    },
    beforeDraw: function (chart, easing) {
        var config = chart.options.plugins.doughnutLabel;
        if (!config) {
            return false;
        }
        var primaryLabel = config.primaryLabel, secondaryLabel = config.secondaryLabel;
        chart.ctx.textBaseline = 'middle';
        this.drawlabel(chart, primaryLabel);
        this.drawlabel(chart, secondaryLabel);
    }
};
