1
我有一個折線圖(用flot chart創建),我想要國際化,爲此我需要xAxis標籤的多種語言。我的dataTick看起來像:如何在jquery.flot.js中爲xAxis只使用一個數組元素?
{
"itemTicks":
[
[24, ["help", "hilfe", "aider"]],
[3, ["card", "karte", "carte"]],
[9, ["english", "deutsch", "francaise"]]
]
}
目前它打印出eveything。 (所以像:help,hilfe,aider [用逗號分開]) 我可以在哪裏指定應該使用哪個元素/索引?我還希望用戶可以更改語言(例如,使用選擇框)並且標籤也應該更改。這已經適用於頁面的其餘部分,它與全局變量language
一起工作,我將其設置爲所需語言的索引。
我試圖設置在X軸格式化,這並沒有任何效果:
plot = $.plot($('#graph-bars'), series, {
...
xaxis: {
ticks: itemTicks,
autoscaleMargin: 0.02,
labelWidth: 300,
labelFormatter: function(label, series) {
return label[0];
}
},
...
});