chartjs中的多个标签与角度4上的堆积条形

时间:2017-12-28 00:09:51

标签: json angular chart.js

chart labels

我的问题是我必须为每个栏显示一个标签,但我不能,因为当我向json chartjs添加标签时添加新的空栏组 正如我在图片中所示,我正在使用叠条,我该怎么做?。

这是我的Json代码。

  PredialUrbano = {
    type: 'groupableBar',
    labels: ['Facturado','cobrado','ejemplo'],
    datasets: [
        {
            label: 'Facturado',
            data: [67.8],
            backgroundColor: '#3A3032',
            stack: 1
        }, {
            label: 'Exento',
            data: [20.7],
            backgroundColor: '#902528', 
            stack: 1
        },
        {
            label: 'Ley de ingresos',
            data: [20.7],
            backgroundColor: '#902528', 
            stack: 2
        },
        {
            label: 'Cobrado',
            data: [20.7],
            backgroundColor: '#3A3032', 
            stack: 3
        }
    ],
    options: {
        scales: {
            xAxes: [{ stacked: true }],
            yAxes: [{ stacked: true }]
        }
    },
};

0 个答案:

没有答案