0

我正在使用 js 和chart.js,我正在尝试标记我的 x 和 y 轴,无论我尝试哪个示例都不起作用,在我的代码中,有几个示例 1. 更改使用2 labels,更改使用 .. 如何命名我的 x 和 y ?labelaxes

var vtx = document.getElementById("nowChart").getContext("2d");

var myChart = new Chart(vtx, {
    type: 'line',
    labels: [{ xLabels: "Days" }, {yLabels:"Ways"} ],
    data: {
        datasets: [{
            label: 'IBM graph',
            data: mydata,
            showLine: true,
            pointBackgroundColor: "#00ff11",
            pointBorderWidth: 1,

        }]
    },
    options: {
        scales: {
            xAxes: [{
                type: 'linear',
                position: 'bottom',
                ticks: {
                    beginAtZero: true
                },
                label:"Days"

            }],
            yAxes: [{
                type: 'linear',
                position: 'left',
                stacked: true,
                ticks: {
                    beginAtZero: true
                },
                label: "Rays"
            }]
        }
    }
});
4

1 回答 1

0

你的配置看起来不对。查看 chart.js折线图示例,了解如何正确执行此操作。

于 2017-03-05T14:33:09.023 回答