gpt4 book ai didi

javascript - float 条形图刻度线不显示

转载 作者:行者123 更新时间:2023-11-28 21:17:09 24 4
gpt4 key购买 nike

我的数据:

var data5 = [
{ label: "my cat", data: [[1,10], [4,20], [7,30]], color: 'rgb(85, 96, 42)'},
{ label: "my job", data: [[2,30], [5,20], [8,30]], color: '#42215F'}
];

我的选择:

var type = {};
type[charttype] = {show: true};
type["xaxis"] = {ticks: [[1,"foo"], [2,"bar"], [4,"cat"], [5,"woo"], [7,"cookie"], [8,"yay"]]};

var chart_options = {};
chart_options["series"] = type;

然而,当我

var plot = $.plot($(div), data5, chart_options);

刻度仅显示为 1-9,而不是我给出的字符串。我做错了什么?

最佳答案

试试这个:

var data5 = [
{ label: "my cat", data: [[1,10], [4,20], [7,30]], color: 'rgb(85, 96, 42)'},
{ label: "my job", data: [[2,30], [5,20], [8,30]], color: '#42215F'}
];

var chart_options = {
series: {lines:{show: true}},
xaxis:{ticks: [[1,"foo"], [2,"bar"], [4,"cat"], [5,"woo"], [7,"cookie"], [8,"yay"] ]}
};

var plot = $.plot($('div'), data5, chart_options);

Demo

charttype 被替换为实际类型(线/点..)

xaxis 不应位于 series 对象内部,而应位于同一级别。

关于javascript - float 条形图刻度线不显示,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7276779/

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