gpt4 book ai didi

javascript - Morris.js 查看完整日期和时间

转载 作者:行者123 更新时间:2023-12-03 10:08:59 28 4
gpt4 key购买 nike

我有一个问题,因为我做了后端的动态响应。我生成的代码是:

    new Morris.Line({
// ID of the element in which to draw the chart.
element: 'myfirstchart',
// Chart data records -- each entry in this array corresponds to a point on
// the chart.
data: [

{ year: '2015-05-13 14:47:56',
value: 18 }

{ year: '2015-05-13 00:07:22',
value: 21 }

{ year: '2015-05-12 00:07:22',
value: 23 }

{ year: '2015-05-11 17:14:49',
value: 22 }

{ year: '2015-05-11 00:07:31',
value: 22 }

{ year: '2015-05-10 17:59:56',
value: 26 }

{ year: '2015-05-10 06:02:49',
value: 27 }

{ year: '2015-05-10 04:46:30',
value: 888 }
],

xkey: 'year',
ykeys: ['value'],
labels: ['Value']
});

</script>

但我没有正确设置日期格式该怎么办?在xkey中默认接受什么格式呢?如果可能的话,我需要几天和一个月

最佳答案

试试这个:

new Morris.Line({

element: 'myfirstchart',

data: [

{ year: '2015-05-13 14:47:56',
value: 18 }

{ year: '2015-05-13 00:07:22',
value: 21 }

{ year: '2015-05-12 00:07:22',
value: 23 }

{ year: '2015-05-11 17:14:49',
value: 22 }

{ year: '2015-05-11 00:07:31',
value: 22 }

{ year: '2015-05-10 17:59:56',
value: 26 }

{ year: '2015-05-10 06:02:49',
value: 27 }

{ year: '2015-05-10 04:46:30',
value: 888 }
],

xkey: 'year',
ykeys: ['value'],
parseTime: false,
labels: ['Value'],
pointSize: 2,
hideHover: 'auto',
resize: true
});

关于javascript - Morris.js 查看完整日期和时间,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30224948/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com