How to prevent googleVis tag reduction?

I have googleVis charts in a brilliant app, but googleVis shortens the label on the horizontal axis by default when they are too long. How to prevent this behavior? The following example reproduces the behavior that I would like to prevent:

df=data.frame(country=c(paste(rep("very very long label", 1e+2)), "GB", "BR"), val1=c(10,13,14), val2=c(23,12,32)) Line <- gvisLineChart(df) plot(Line) 

Link to documentation here

+5
source share
1 answer

It is always difficult if you ask Google the same question. But I found one β€œtrick” to show x-shortcuts, here is my workaround:

Change the area of ​​the chart: the top β€œpad” will take up space from hAxis below. This is possible in R with the options parameter in the gvisLineChart() function.

 Line <- gvisLineChart(df, options = list(chartArea = "{'width': '82%', height: '60%', top: '9%', right: '3%', bottom: '90'}")) plot(Line) 

Of course, you have to adjust the values ​​to suit your needs. Perhaps this approach will help you.

+3
source

Source: https://habr.com/ru/post/1257626/


All Articles