2013-08-18 105 views
1

以下是我的數據示例:
嗨,我第一次使用JQPlot,並在x軸上顯示月份名稱時出現卡住現象。如何在JQPlot的x軸上顯示月份名稱

var s1 = [[1, 782751.00], [2, 112592.00], [3, 1350924.00], [4, 648777.00], [5, 725266.00], [6, 358824.00]] 

var s2 = [[1, 16], [2, 20], [3, 22], [4, 20], [5, 21], [6, 10]] 

var ticks = [1,2,3,4,5,6,7,8] 

這裏,1,2,3 ......等表示月份的序列號(如在1月,2月...)

目前它顯示這些數字......但我需要它顯示爲一月,二月,三月,四月等..

我試着在查詢DATEPART(MONTH,CreatedDate) AS valueCONVERT(char(3), CreatedDate, 0)但隨後的圖形顯示不出來...有點幫助將非常感激。


好像它是非常簡單:| :)

做出改變來獲得

var ticks = ['January','February','March','April','May'......] 

查詢:

​​

回答

1

可以使用某種做JavaScript端翻譯 「的int月」 譯者:

//Ticks you actually have 
var ticks = [1,2,3,4,5,6,7,8]; 
//Translator array to do conversion from integer to month 
var translator = new Array("January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"); 

for(var i = 0; i < ticks.length; ++i){ 
ticks[i] = translator[i]; 
} 

Ticks現在包含["January", "February", "March", "April", "May", "June", "July", "August"]