简体   繁体   中英

How to remove date from a calendar built using toastui in R

I have the created a weekly calendar in R below using toastui :

library(toastui)
calendar(view="week", defaultDate = NULL) %>% cal_week_options(workweek = TRUE, hourStart = 7.5, hourEnd = 24)

This line of the code gives the following output: 在此处输入图片说明

How can I remove the dates ie 21, 22, 23, 24, 25 and just have Monday-Friday as the labels? I have been going through the documentation but I couldn't find a solution. Any suggestion is appreciated.

I found the answer to this question. It is quite simple. According to the documentation one needs to use JS in order to update the names. The code below perfectly displays how the column values are updated:

library(toastui)
calendar(view="week", defaultDate = NULL) %>% 
  cal_week_options(workweek = TRUE, hourStart = 7.5, hourEnd = 24) %>% 
  cal_template(
    weekDayname = JS(
      "function(model) {",
      "var days = ['Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday'];",
      "return '<span class=\"tui-full-calendar-dayname-name\">' + days[model.day] + '</span>';",
      "}"
    )
  )

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM