Javascript chart.js不';不要在折线图上显示元素

Javascript chart.js不';不要在折线图上显示元素,javascript,charts,chart.js,Javascript,Charts,Chart.js,我正在使用一个web应用程序,我需要显示一个包含服务器数据的绘图。我使用该库,但它不起作用,只显示以下内容: 我通过JSON加载数据,这就是我使用的代码 var labels = new Array(); var cpuLoad = new Array(); $(document).ready(function() { var cpuContext = document.getElementById("cpu").getContext("2d"); $.getJSON("/

我正在使用一个web应用程序,我需要显示一个包含服务器数据的绘图。我使用该库,但它不起作用,只显示以下内容:

我通过JSON加载数据,这就是我使用的代码

var labels = new Array();
var cpuLoad = new Array();

$(document).ready(function() 
{
    var cpuContext = document.getElementById("cpu").getContext("2d");

    $.getJSON("/pi/status/latest", function(data) 
    {
        $.each(data.response, function(index, status) 
        {
            labels.push(status.Status.fecha);
            cpuLoad.push(status.Status.cpu);
        });
    });

    var cpuData = 
    {
        labels: labels,
        datasets: [
        {
            label: "Carga CPU",
            fillColor: "rgba(220,220,220,0.2)",
            strokeColor: "rgba(220,220,220,1)",
            pointColor: "rgba(220,220,220,1)",
            pointStrokeColor: "#fff",
            pointHighlightFill: "#fff",
            pointHighlightStroke: "rgba(220,220,220,1)",
            data: cpuLoad
        }]
    };

    console.log(cpuData);

    var cpuChart = new Chart(cpuContext).Line(cpuData);
});
.getJSON代码工作得很好,但图形没有显示出来。 下面是我传递给chart.js的数据示例:

标签数组:

cpuLoad阵列:


您使用的是哪个版本的Chart.js?如果将类似的数组硬编码到数据集代码中,图表是否呈现?