Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/powershell/12.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
X轴带月份的Jquery Flot图表_Jquery_Flot - Fatal编程技术网

X轴带月份的Jquery Flot图表

X轴带月份的Jquery Flot图表,jquery,flot,Jquery,Flot,我有下面的代码来画图表。我想在X轴上显示月份/年份,但当我运行应用程序时,它只显示第一个月。我怎样才能给其他人看一个月 var data1 = [ [0, 4], [1, 8], [2, 5], [3, 10], [4, 4], [5, 16], [6, 5], [7, 11], [8, 6], [9, 11], [10, 30], [11, 10], [12, 13], [13, 4], [14, 3], [15, 3], [16, 6] ]; var

我有下面的代码来画图表。我想在X轴上显示月份/年份,但当我运行应用程序时,它只显示第一个月。我怎样才能给其他人看一个月

    var data1 = [
        [0, 4], [1, 8], [2, 5], [3, 10], [4, 4], [5, 16], [6, 5], [7, 11], [8, 6], [9, 11], [10, 30], [11, 10], [12, 13], [13, 4], [14, 3], [15, 3], [16, 6]
    ];
    var data2 = [
        [0, 1], [1, 0], [2, 2], [3, 0], [4, 1], [5, 3], [6, 1], [7, 5], [8, 2], [9, 3], [10, 2], [11, 1], [12, 0], [13, 2], [14, 8], [15, 0], [16, 0]
    ];
    $("#flot-dashboard-chart").length && $.plot($("#flot-dashboard-chart"), [
        data1, data2
    ],
            {
                series: {
                    lines: {
                        show: false,
                        fill: true
                    },
                    splines: {
                        show: true,
                        tension: 0.4,
                        lineWidth: 1,
                        fill: 0.4
                    },
                    points: {
                        radius: 0,
                        show: true
                    },
                    shadowSize: 2
                },
                grid: {
                    hoverable: true,
                    clickable: true,
                    tickColor: "#d5d5d5",
                    borderWidth: 1,
                    color: '#d5d5d5'
                },
                colors: ["#1ab394", "#464f88"],
                xaxis: {
                    mode: "time",                        
                    minTickSize: [1, "day"],
                    timeformat: "%b/%y"
                },
                yaxis: {
                    ticks: 4
                },
                tooltip: true
            }
    );
渲染图表

如果我从
xaxis
(即
xaxis:{},
)中删除所有选项,则在渲染的图表中,某些点会显示在X轴上

在xaxis上没有选项的渲染图表

执行以下任一操作:

xaxis:{滴答声:[[1,1月],[2,2月],[3,3月]}等等

或者尝试添加

axisLabel: "Date",
axisLabelUseCanvas: true,
axisLabelFontSizePixels: 12,
axisLabelFontFamily: 'Verdana, Arial',
axisLabelPadding: 10
阅读更多信息

执行以下任一操作:

xaxis:{滴答声:[[1,1月],[2,2月],[3,3月]}等等

或者尝试添加

axisLabel: "Date",
axisLabelUseCanvas: true,
axisLabelFontSizePixels: 12,
axisLabelFontFamily: 'Verdana, Arial',
axisLabelPadding: 10

阅读更多信息

@RachelGallen如果我清空xaxis中的所有选项,一些点会出现在渲染图表中,就像我在更新的问题中显示的那样。@RachelGallen如果我清空xaxis中的所有选项,一些点会出现在渲染图表中,就像我在更新的问题中显示的一样。以防万一你不想键入它:xaxis:{滴答声:[1,“一月],[2,“二月],[3,“三月],[4,“四月],[5,“五月],[6,“六月],[7,“七月],[8,”八月],[9,“九月],[10,”十月],[11,“十一月],[12,”十二月]}以防万一你不想键入它:xaxis:{滴答声:[1,“一月],[2,”二月],[3,“三月],[4,”四月],[5,“五月],[6,“六月”],[7,“七月”],[8,“八月”],[9,“九月”],[10,“十月”],[11,“十一月”],[12,“十二月”]}