I am looking to create a timevis plot where the font size varies based on the importance of each variable.
While I can change the font color using the 'style' option in the source data frame, attempting to adjust the font size in the same manner causes rendering issues in R.
Below is a snippet of my dataset:
data <- structure(list(groups = c("Deadline.1", "Deadline.1", "Deadline.1",
"Deadline.1", "Deadline.1"), content = c("Geography Tutorials: Critical
Thinking & Techniques", "Principles of Geographical Inquiry I", "Geography
in Action",
"Physical Geography: Earth Surface Processes & Landforms", "Biogeography &
Ecology"
), start = structure(c(17459, 17505, 17631, 17911, 18048), class = "Date"),
end = structure(c(17459, 17505, 17631, 17911, 18048), class = "Date"),
type = c("point", "point", "point", "point", "point"), id = c(1L,
2L, 7L, 9L, 10L), Assessment = c("1500 word essay ", "Group survey",
"20% attendance (5% per block)", "2 hr exam ", "2 hr exam "
), Percentage = c(15, 15, 20, 100, 100), style = c("'font-size:15px;'",
"'font-size:15px;'", "'font-size:20px;'", "'font-size:100px;'",
"'font-size:100px;'")), row.names = c(NA, 5L), class = "data.frame")
Here is a portion of my code where I attempt to link the 'percentage' variable with the font size, which unfortunately does not work as expected.
library(shiny)
library(timevis)
library(tidyr)
library(plyr)
library(dplyr)
data$style <- paste0("'font-size:", data$Percentage, "px;'")
### example time vis rendering (doesn't work)
timevis(data = data[2:3, ]) ### random variable choice
### but this works
data$style <- 'color: red'
timevis(data = data[2:3, ])
Any suggestions or feedback would be greatly appreciated. I come from a modeling background rather than app development, so any help with potential HTML errors would be beneficial.