Question

I am using googleVis to plot a vertical columnchart in a shiny server. It seems like passing gvisColumnChart options works for some, but not others. For example, all the *Axis.gridlines.* options below are blisfully ignored, while other like fontSize are correct.

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)

See snapshot of a produced plot: enter image description here

Any ideas?

Was it helpful?

Solution

The option colors="['orange','blue','green','red']" don't work because you plot only one yvar. If you specify 4 colors, it's for 4 distincts yvar.

Concerning the *Axis.gridlines.*, I don't know why it doesn't work, but maybe because that for a Barchart the vAxis.gridlines option is only supported for a continuous axis, and you have a discrete one (your data type is string). (Barchart and not Columnchart because set orientation to 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

Though the hAxis.gridlines options should work because there is no restrictions on it...

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top