2014-02-07 15 views
2

我正在使用googleVis在閃亮的服務器中繪製垂直柱狀圖。看起來像傳遞gvisColumnChart選項適用於某些人,但不適用於其他人。例如,以下所有*Axis.gridlines.*選項都被忽視,而其他像fontSize是正確的。R shiny gvisColumnChart傳遞的選項被忽略

library("googleVis") 
data = data.frame(fb_sample_id=sample(LETTERS, 10),value=rnorm(10)) 
A <- gvisColumnChart(data, options=list(legend="top", 
            xvar="fb_sample_id", 
            yvar="value", 
            orientation='vertical', 
            hAxis.gridlines.count=1, 
            vAxis.gridlines.count=100, 
            vAxis.gridlines.color="red", 
            hAxis.gridlines.color="blue", 
            fontSize=16, 
            width=300, 
            height=300, 
            colors="['orange','blue','green','red']" 
)) 
plot(A) 

所生產的情節見快照: enter image description here

任何想法?

回答

1

選項colors="['orange','blue','green','red']"不起作用,因爲您只繪製了一個yvar。如果您指定4種顏色,則適用於4種顏色yvar

關於*Axis.gridlines.*,我不知道它爲什麼不起作用,但可能是因爲對於條形圖vAxis.gridlines選項僅支持連續座標軸,並且您有一個離散的座標軸(您的數據類型是字符串)。 (條形圖,而不是柱狀圖,因爲設置爲orientationvertical"rotates the axes of the chart so that (for instance) a column chart becomes a bar chart")。

https://google-developers.appspot.com/chart/interactive/docs/gallery/barchart#Configuration_Options

雖然hAxis.gridlines選項應該工作,因爲那裏是它沒有任何限制......