最大化R中gvisTimeline的高度
maximise the height of gvisTimeline in R
如何在 R 中最大化 gvisTimeline 的高度
我的代码:
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)
查看输出
您必须提供具体的身高数字
一种常见的做法是select一个行高,
然后乘以数据中的行数 table。
var rowHeight = 44;
var options = {
height: (dataTable.getNumberOfRows() * rowHeight) + rowHeight // <-- adder for heading
};
如何在 R 中最大化 gvisTimeline 的高度
我的代码:
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)
查看输出
您必须提供具体的身高数字
一种常见的做法是select一个行高,
然后乘以数据中的行数 table。
var rowHeight = 44;
var options = {
height: (dataTable.getNumberOfRows() * rowHeight) + rowHeight // <-- adder for heading
};