我有以下javascript代码来创建条形图:
var data1 = [
{
label: user1_name,
data: user1_data,
bars: {
show: true,
fill: true,
lineWidth: 1,
order: 1,
fillColor: "#6783b7"
},
color: "#6783b7"
},
{
label: user2_name,
data: user2_data,
bars: {
show: true,
fill: true,
lineWidth: 2,
order: 2,
fillColor: "#4fcdb7"
},
color: "#4fcdb7"
},
];
$("#flot-bar").length && $.plot($("#flot-bar"), data1, {
xaxis: {
ticks: [ticks]
},
yaxis: {
},
grid: {
hoverable: true,
clickable: false,
borderWidth: 0
},
legend: {
labelBoxBorderColor: "none"
},
series: {
shadowSize: 1
},
tooltip: true,
})
其中user1_name = "Mette Kjerbye "
user1_data =
Array[4]
0: 1
1: 10
3: 0
length: 4
__proto__: Array[0]
user2_data =
Array[4]
0: 2
1: 9
3: 2
length: 4
ticks = [0, "Mette Kjerbye ", 1, "Kamilla Utoft Kristensen "]
现在这确实生成了一个图表,但它看起来有点奇怪:
如果您查看图片,您会看到X轴图例中只显示Mette Kjerbye
,并且两条距离很远。
有人可以告诉我在我的选项中缺少什么吗?