ChartJs不会显示第三个错误,但是我可以看到有数据吗?

时间:2019-02-10 12:45:54

标签: javascript chart.js

所以,我不知道为什么我的第三个小节不显示?!
数据在那里,我可以在工具提示中看到它。

我想念什么?

enter image description here

var ctx = document.getElementById('chart_canvas').getContext('2d');

        var chart = new Chart(ctx, {
            // The type of chart we want to create
            type: 'bar',

            // The data for our dataset
            data: {
                labels: ["BTK", "Dubb", "Ej insmörjd cellplast", "El", "Fogspår/Ursparning", "Lyft", "Yta", "Svetsplåt", "Övrigt"],
                datasets: [
                    {
                        label: "SEK Fabrik",
                        backgroundColor: "rgba(255, 99, 132, 0.2)",
                        borderColor: "rgb(255, 99, 132)",
                        borderWidth: 1,
                        yAxisID: 'cost_side',
                        data: [result.BTK['cost']['local'], result.Dubb['cost']['local'], result['Ej insmörjd cellplast']['cost']['local'], result.El['cost']['local'], result['Fogspår/Ursparning']['cost']['local'], result.Lyft['cost']['local'], result.Yta['cost']['local'], result.Svetsplåt['cost']['local'], result['Övrigt (element, dörr, fönster, vikt m.m.)']['cost']['local']]
                    },
                    {
                        label: "SEK Montage",
                        backgroundColor: "rgba(54, 162, 235, 0.2)",
                        borderColor: "rgb(255, 99, 132)",
                        borderWidth: 1,
                        yAxisID: 'cost_side',
                        data: [result.BTK['cost']['extern'], result.Dubb['cost']['extern'], result['Ej insmörjd cellplast']['cost']['extern'], result.El['cost']['extern'], result['Fogspår/Ursparning']['cost']['extern'], result.Lyft['cost']['extern'], result.Yta['cost']['extern'], result.Svetsplåt['cost']['extern'], result['Övrigt (element, dörr, fönster, vikt m.m.)']['cost']['extern']]
                    },
                    {
                        label: "Tid",
                        backgroundColor: "rgba(255, 159, 64, 0.2)",
                        borderColor: "rgb(255, 159, 64)",
                        borderWidth: 1,
                        yAxisID: 'time_side',
                        data: [result.BTK['time'], result.Dubb['time'], result['Ej insmörjd cellplast']['time'], result.El['time'], result['Fogspår/Ursparning']['time'], result.Lyft['time'], result.Yta['time'], result.Svetsplåt['time'], result['Övrigt (element, dörr, fönster, vikt m.m.)']['time']]
                    }
                ]
            },
options: {
                resposive: true,
                tooltips: {
                    mode: 'index',
                    intersect: true
                },
                scales: {
                    yAxes: [{
                            type: 'linear',
                            stacked: true,
                            display: true,
                            ticks: {
                                suggestedMin: 0,    // minimum will be 0, unless there is a lower value.
                                // OR //
                                beginAtZero: true,   // minimum value will be 0.
                                suggestedMax: 2000,
                                autoSkip: false,
                            },
                            position: 'left',
                            id: 'cost_side'
                        },
                        {
                            type: 'linear',
                            display: true,
                            ticks: {
                                suggestedMin: 0,    // minimum will be 0, unless there is a lower value.
                                // OR //
                                beginAtZero: true,   // minimum value will be 0.
                                suggestedMax: 10,
                                autoSkip: false,
                            },
                            position: 'right',
                            id: 'time_side',
                            gridLines: {drawOnChartArea: false}
                        }

                    ],
                xAxes: [{
                    stacked: true
                }],
                },
                title: {
                    display: true,
                    text: "Kostnad "+chosenYear + " " + textMonth + " " + textWeek + " " + textDevice
                }
            }

0 个答案:

没有答案