如何从内部图表中删除标签

时间:2019-04-01 18:01:38

标签: javascript charts

我有一个问题,如何删除内部图表附近的标签“ 2”。请注意labels: ["", "2", ""]行。我在这里为标签设置值,并且为外部图表和内部图表都设置标签。

enter image description here

我只想给外部电话留个号码。

enter image description here

这是我对图表数据的配置:

var halfDonut = $(this).find('.js-donut-canvas').get(0);
var sectionLabel = $(this).data('label');
var percentOfFillingDonut = parseInt($(this).data('fill'));
var percentEmptyPieceOfDonut = 100 - percentOfFillingDonut;
var data = {
    labels: ['','2',''],
    datasets: [
        {
            data: [
                percentOfFillingDonut-0.5,
                1,
                percentEmptyPieceOfDonut-0.5,
            ],
            backgroundColor: [
                setGradient(halfDonut),
                "rgba(0, 0, 0, 1)",
                "#829996"
            ],
            "borderWidth": 0,
            hoverBackgroundColor: [
                setGradient(halfDonut),
                "rgba(0, 0, 0, 1)",
                "#829996"
            ],
            "hoverBorderWidth": 0
        },
        {
            "data": [
                percentOfFillingDonut-0.5,
                1,
                percentEmptyPieceOfDonut-0.5,
            ],
            "backgroundColor": [
                "rgba(0, 0, 0, 0)",
                "rgba(0, 0, 0, 1)",
                "rgba(0, 0, 0, 0)"
            ],
            "borderWidth": 0,
            "fill": false,
            "hoverBackgroundColor": [
                "rgba(0, 0, 0, 0)",
                "rgba(0, 0, 0, 1)",
                "rgba(0, 0, 0, 0)"
            ],
            "hoverBorderWidth": 0
        }
    ]
};

0 个答案:

没有答案