gpt4 book ai didi

morris.js - 以 Int 为 x 轴的折线图,而不是日期

转载 作者:行者123 更新时间:2023-12-04 02:45:32 26 4
gpt4 key购买 nike

我想显示一个图表,在 x 轴上显示整数而不是日期。

这是示例的 fiddle :

http://jsfiddle.net/cs3vigny/srmqcfjh/

new Morris.Line({
element: 'film-compare-chart',
data: [
{ week: 0, a: 2, b: 4, c: 5, d: 3, e: 3 },
{ week: 1, a: 2, b: 3, c: 6, d: 3, e: 3 },
{ week: 2, a: 3, b: 5, c: 4, d: 2, e: 2 },
{ week: 3, a: 3, b: 6, c: 6, d: 3, e: 4 },
{ week: 4, a: 4, b: 4, c: 5, d: 4, e: 2 },
{ week: 5, a: 4, b: 6, c: 6, d: 3, e: 2 },
{ week: 6, a: 4, b: 7, c: 8, d: 5, e: 2 },
{ week: 7, a: 3, b: 5, c: 6, d: 5, e: 4 },
{ week: 8, a: 4, b: 8, c: 6, d: 4, e: 3 },
{ week: 9, a: 6, b: 10, c: 8, d: 7, e: 5 },
{ week: 10, a: 5, b: 12, c: 13, d: 7, e: 4 },
{ week: 11, a: 6, b: 10, c: 10, d: 7, e: 4 },
{ week: 12, a: 9, b: 10, c: 10, d: 10, e: 6 },
{ week: 13, a: 11, b: 15, c: 16, d: 12, e: 9 },
{ week: 14, a: 14, b: 15, c: 14, d: 13, e: 10 },
{ week: 15, a: 14, b: 20, c: 17, d: 15, e: 11 },
{ week: 16, a: 18, b: 26, c: 22, d: 16, e: 15 },
{ week: 17, a: 19, b: 22, c: 22, d: 18, e: 13 },
{ week: 18, a: 19, b: 21, c: 25, d: 20, e: 16 },
{ week: 19, a: 26, b: 26, c: 33, d: 24, e: 21 },
{ week: 20, a: 26, b: 26, c: 31, d: 24, e: 21 },
{ week: 21, a: 24, b: 28, c: 41, d: 26, e: 22 },
{ week: 22, a: 33, b: 32, c: 40, d: 29, e: 28 },
{ week: 23, a: 34, b: 37, c: 51, d: 34, e: 32 }
],
xkey: 'week',
ykeys: ['a','b','c','d','e'],
labels: ['Cinderella (2015)', 'Maleficent', 'Oz: The Great and Powerful', 'Divergent', 'Big Hero 6']
});

无论如何,Morris.js 是否只在 x 轴上显示日期或可以更改?

最佳答案

尝试添加选项参数 parseTime:false .

关于morris.js - 以 Int 为 x 轴的折线图,而不是日期,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29420700/

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