首页 > 解决方案 > 如何在X轴上设置比例?

问题描述

我尝试制作一些图表电池,但我在时间间隔方面遇到了一些问题。我有一些这样的代码

    var ctx = document.getElementById('myChart').getContext('2d');
    var chart = new Chart(ctx, {
    // The type of chart we want to create
        type: 'line',

    // The data for our dataset
        data: {
            labels: ["2018-04-26 00:10:00", "2018-04-26 00:15:00", "2018-04-26 01:10:00", "2018-04-26 01:40:00", "2018-04-26 01:5:00", "2018-04-26 01:55:00", "2018-04-26 02:10:00"],
            datasets: [{
                label: "My First dataset",
                data: [11.2, 11.6, 12.1, 12.1, 12.2, 12.4, 12.4],
            }]
    },

    // Configuration options go here
        options: {}
    });

我不知道如何设置间隔 30 分钟。如果有人有什么想法?

谢谢。

标签: javascriptcharts

解决方案


推荐阅读