2

我正在使用 googleVis 在闪亮的服务器中绘制垂直柱状图。似乎传递 gvisColumnChart 选项适用于某些人,但不适用于其他人。例如,*Axis.gridlines.*下面的所有选项都被忽略了,而其他类似的选项fontSize都是正确的。

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)

查看生成图的快照: 在此处输入图像描述

有任何想法吗?

4

1 回答 1

2

该选项colors="['orange','blue','green','red']"不起作用,因为您只绘制了一个yvar. 如果您指定 4 种颜色,则为 4 distincts yvar

关于*Axis.gridlines.*,我不知道为什么它不起作用,但可能是因为对于 Barchart,该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选项应该可以工作,因为它没有限制......

于 2014-02-08T11:31:29.470 回答