mages / googleVis

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

Date Labels stripped off when use width = automatic (and browser windows is wide) #23

Open micstr opened 9 years ago

micstr commented 9 years ago

This may be an issue more with underlying google chart object, but I wanted to bring this to your attention.

I noticed my dates fall off the axis when I use a large browser window. I am trying to get my shiny app to work for tablets and desktop so I dont set the width in pixels but use automatic.

When browser window is small: 20150714-googlevisdates-ok

When browser is wide - dates go missing: 20150714-googlevisdates-notok

Any clues on what to do to fix this? Thanks we really appreciate your work.

mages commented 9 years ago

Not sure I can help without a reproducible example. Alternatively try the Google Chart API forum: https://groups.google.com/forum/#!forum/google-chart-api

micstr commented 9 years ago

Sorry mages - Here is some sample code. Try run it. If you can see the dates in x axis, then maximise your window on a big screen and refresh. Then I find the dates go missing like the screenshots I sent.

My screen resolution is 1920 x 1080. using Chrome Version 43.0.2357.132 m

testcase mages

library(data.table) library(googleVis)

test.dt <- data.table(day = c(as.Date("2014/3/10"), as.Date("2014/3/11"), as.Date("2014/3/14"), as.Date("2014/3/15"), as.Date("2014/3/16")), value = c(0.8,1.2,1.2, 1.3, 1.2), price = c(1, 1.1, 1.2, 1.1, 1.4), name = c("A","A","A","A","A"))

xformat <- "d-MMM-yyyy" #"d/M/yy" eg 1 Apr 2015 xlabel <- "Date"

testop <- list(series = "[{labelInLegend: 'A price'}, {labelInLegend: 'A value'}]", legend ="right", height = "automatic", width = "automatic", hAxis = paste0("{format:'", xformat,"', title:'", xlabel, "'}"))

testplotdatay <- c("price", "value")

plot(gvisLineChart(test.dt, xvar = "day", yvar = testplotdatay, options = testop))

I thought it might be the height = automatic as I saw in gvis code you manage the number and append px for pixels. But I think this is a problem even when I rem the lines out.

Let me know if you also have this issue. Thanks Michael

P.S. whilst you are fixing typos = You have a typo in vignette description

googleVis_examples Demonstartion of googleVis (source, html)

On Tue, Jul 14, 2015 at 7:57 PM, Markus Gesmann notifications@github.com wrote:

Not sure I can help without a reproducible example. Alternatively try the Google Chart API forum: https://groups.google.com/forum/#!forum/google-chart-api

— Reply to this email directly or view it on GitHub https://github.com/mages/googleVis/issues/23#issuecomment-121323529.

mages commented 9 years ago

I am sorry, but I can't see to reproduce the issue on Mac 10.10.4 with either Safari 8.0.7 or Chrome 43.0.2357.134.

Btw, thanks for pointing out the typo.