[英]Jquery Flot bar chart not showing correct values
我正在使用jquery flot創建條形圖。我已經使用orderBars插件來獲取單個條形圖。我的代碼如下,
var data2 = [
{
label: "Product 1",
data: [["1","3"],["2","3"],["3","5"],["4","8"],["5","9"]],
bars: {
show: true,
barWidth: 0.1,
fill: true,
lineWidth: 1,
order: 1,
fillColor: "#AA4643"
},
color: "#AA4643"
},
{
label: "Product 2",
data: [["1","3"],["2","3"],["3","3"],["4","1"],["5","3"]],
bars: {
show: true,
barWidth: 0.1,
fill: true,
lineWidth: 1,
order: 2,
fillColor: "#89A54E"
},
color: "#89A54E"
},
{
label: "Product 3",
data: [["1","40"],["2","3"],["3","3"],["4","7"],["5","3"]],
bars: {
show: true,
barWidth: 0.1,
fill: true,
lineWidth: 1,
order: 3,
fillColor: "#4572A7"
},
color: "#4572A7"
},
];
$.plot($("#placeholder"), data2, {
xaxis: {
min: 1,
max: 5,
mode: "categories",
tickSize: [['1',"TTE"],['2',"SEBP"],['3',"LSS"],['4',"TMBP"],['5',"MPI"]],
},
yaxis: {
axisLabel: 'Value',
axisLabelUseCanvas: true,
axisLabelFontSizePixels: 12,
axisLabelFontFamily: 'Verdana, Arial, Helvetica, Tahoma, sans-serif',
axisLabelPadding: 5
},
grid: {
hoverable: true,
clickable: false,
borderWidth: 1
},
legend: {
labelBoxBorderColor: "none",
position: "right"
},
series: {
shadowSize: 1
}
});
});
我將圖表顯示為空白
和x軸顯示錯誤為2,3,4,5,-0.16。任何人都可以幫助...
將x軸選項更改為
xaxis: {
min: -0.5,
max: 4.5,
mode: "categories",
ticks: [['0',"TTE"],['1',"SEBP"],['2',"LSS"],['3',"TMBP"],['4',"MPI"]]
},
您將ticks
數組命名錯誤,壁虱從零開始(而不是從一開始),並且需要更大的限制,以便顯示所有條形圖。
看到這個小提琴: http : //jsfiddle.net/y9newLmz/2/
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.