2014-01-13 58 views
0

我正在使用graphael線圖。爲什麼以下數據會產生錯誤的圖表?

我有這樣的線以產生圖我

var lines = r.linechart(30, 30, 600, 440,[[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71]],[[0.03091,0.00461,0.0068,0.00144,0.00544,0.00035,0.00871,0.03117,0.02259,0.02623,0.01967,0.01967,0.00788,0.02217,0.0137,0.,0.01764,0.0131,0.00942,0.0076,0.01463,0.02882,0.02093,0.02502,0.01961,0.01551,0.02227,0.0164,0.0191,0.00774,0.03076,0.0281,0.01338,0.02763,0.02334,0.00557,0.00023,0.01523,0.0263,0.03077,0.02404,0.02492,0.01954,5E-05,0.02337,0.01715,0.02271,0.00815,0.01343,0.00985,0.01837,0.00749,0.02967,0.01156,0.0083,0.00209,0.01538,0.01348,0.01353,0.02163,0.00977,0.02401,0.01207,0.01485,0.02717,0.02327,0.00629,0.01195,0.03052,0.00812,0.01215,0.00241]], {nostroke: false, axis: "0 0 1 1", symbol: "circle", smooth: true }) 

但是,在上述數據中,進行graphael曲線圖中,在y軸時產生的曲線具有錯標籤。你能幫助我嗎?我昨天在這個東西卡住了...

至少有誰可以運行它,只是爲了告訴我他是否可以正常運行它?

回答

1

別擔心!你不是第一個到encounter this issue

我會建議將您的價值乘以10或100,這應該可以解決問題並且可以很容易地在圖表圖例中顯示。

例如:

data = [0.03091,0.00461,0.0068,0.00144,0.00544,0.00035,0.00871,0.03117,0.02259,0.02623,0.01967,0.01967,0.00788,0.02217,0.0137,0.,0.01764,0.0131,0.00942,0.0076,0.01463,0.02882,0.02093,0.02502,0.01961,0.01551,0.02227,0.0164,0.0191,0.00774,0.03076,0.0281,0.01338,0.02763,0.02334,0.00557,0.00023,0.01523,0.0263,0.03077,0.02404,0.02492,0.01954,5E-05,0.02337,0.01715,0.02271,0.00815,0.01343,0.00985,0.01837,0.00749,0.02967,0.01156,0.0083,0.00209,0.01538,0.01348,0.01353,0.02163,0.00977,0.02401,0.01207,0.01485,0.02717,0.02327,0.00629,0.01195,0.03052,0.00812,0.01215,0.00241]; 

data = data.map(function(x) { return x * 1000; }); 

r.linechart(30, 30, 600, 440,[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71],data, {nostroke: false, axis: "0 0 1 1", symbol: "circle", smooth: true }) 

這似乎解決辦法工作。

+0

非常感謝。說實話,這並不能解決我的問題,因爲當用戶在一個點上出現真正的價值時,以及在軸上......你能想出一些東西,這可以幫助我多一點那?比如說一種方式,我可以使用你的建議,但是當用戶懸停在一個點上以顯示它的1/1000的值時... –

+0

非常感謝朋友!我將你所說的話與我上面的評論結合起來,並取得成功!非常感謝! :) –

相關問題