mages / googleVis

Interface between R and the Google Chart Tools
https://mages.github.io/googleVis/
360 stars 155 forks source link

Can Not Edit the Legend Text Color of Some Charts #58

Closed dwy904 closed 7 years ago

dwy904 commented 7 years ago

I am not able to edit the legend text color on the following graph (black is the default color):

  1. gvisBarChart
  2. gvisPieChart

Once I change my background into some darker colors, some of the texts will become invisible. However, I am not able to change the color of those text.

mages commented 7 years ago

Here is an example which does just that:

library(googleVis)
df=data.frame(country=c("US", "GB", "BR"), 
              val=c(10,13,14))
barch <-  gvisBarChart(df, xvar="country", yvar="val",
                        options=list(
                          title="Hello World",
                          titleTextStyle="{color:'red', 
                          fontName:'Courier', 
                          fontSize:16}",                         
                          backgroundColor="#D3D3D3",                          
                          hAxis="{gridlines:{color:'red', count:3}}",
                          hAxis="{title:'Country', titleTextStyle:{color:'red'}}",
                          legend="{position:'bottom', textStyle:{color:'blue'}}",
                          width=500,
                          height=300                         
                        ))
plot(barch)

screenshot