Mohsen Sichani
Mohsen Sichani

Reputation: 1076

maximise the height of gvisTimeline in R

How can I maximize the height of gvisTimeline in R

My code:

 datTL <- data.frame(Position=c(rep("President", 5), rep("Vice", 5)),
                Name=c("Washington", "Adams", "Jefferson",
                       "Adams", "Jefferson", 
 "Burr","Washington2","Washington22","Washington33","Washington44"),
                start=as.Date(x=rep(c("1789-03-29", "1797-02-03", 
                                      "1801-02-03", "1800-01-01","1850-01-01"),2)),
                end=as.Date(x=rep(c("1797-02-03", "1801-02-03", 
                                    "1809-02-03","1830-02-03","1890-02-03"),2))
              )

 Timeline <- gvisTimeline(datTL, 
                     rowlabel="Name",
                     barlabel="Position",
                     start="start", 
                     end="end",
                     options=list(        width = "automatic",
                                  height = "automatic" )   )
plot(Timeline)

See the output enter image description here

Upvotes: 0

Views: 51

Answers (1)

WhiteHat
WhiteHat

Reputation: 61222

you'll have to provide a specific number for the height
a common approach is to select a row height,
then multiply by the number of rows in the data table.

var rowHeight = 44;
var options = {
  height: (dataTable.getNumberOfRows() * rowHeight) + rowHeight  // <-- adder for heading
};

Upvotes: 1

Related Questions