【问题标题】:R shiny gvisColumnChart passed options being ignoredR闪亮的gvisColumnChart传递的选项被忽略
【发布时间】:2014-02-07 17:11:24
【问题描述】:

我正在使用 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)

查看生成图的快照:

有什么想法吗?

【问题讨论】:

    标签: r shiny googlevis


    【解决方案1】:

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

    关于*Axis.gridlines.*,我不知道为什么它不起作用,但可能是因为对于条形图,vAxis.gridlines 选项仅支持连续轴,并且您有一个离散轴(您的数据类型是字符串)。 (条形图而不是柱形图,因为将 orientation 设置为 vertical "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-23
      • 1970-01-01
      • 2014-07-06
      • 1970-01-01
      • 2017-02-28
      • 2019-09-27
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多