带有 JQuery 日期选择器的 ggplot;我可以使用它来为 html markdown 输出添加交互性吗(闪亮的不合适)?

ggplot with JQuery Datepicker; can I use this to add interactivity to the html markdown output (Shiny not suitable)?

我有一个非常大的历史数据数据框,这是其中的一个剪辑(data=historic):

structure(list(date = structure(c(18948, 18948, 18948, 18948, 
18949, 18949, 18949, 18949, 18950, 18950, 18950, 18950, 18951, 
18951, 18951, 18951, 18952, 18952, 18952, 18952, 18953, 18953, 
18953, 18953, 18954, 18954, 18954, 18954, 18955, 18955, 18955, 18955), class = "Date"), 
    cumvol = c(17.572, 17.578, 17.672, 17.829, 17.471, 17.477, 
    17.489, 17.497, 17.527, 17.546, 17.552, 17.557, 17.562, 17.564, 
    17.573, 17.658, 17.688, 17.698, 17.714, 17.743, 17.757, 17.764, 
    17.774, 17.776, 17.787, 17.798, 17.809, 17.82, 17.825, 17.841, 18.101, 18.243
    ), time = structure(c(29674, 29674, 29691, 29719, 29674, 
    29674, 29691, 29719, 29730, 29746, 29749, 29757, 29763, 29768, 
    29782, 29782, 29795, 29796, 29805, 29916, 29919, 29922, 29924, 
    29933, 30004, 30016, 30037, 30048, 30053, 30055, 30075, 30078, 30081), class = c("hms", 
    "difftime"), units = "secs")), class = c("data.table", "data.frame"
), row.names = c(NA, -30L), .internal.selfref = <pointer: 0x000001d92b2d1ef0>)

我目前正在其顶部绘制一些最近的数据(数据=最近):

   structure(list(date = structure(c(19038, 19038, 19038, 19038), class = "Date"), 
    cumvol = c(0.029, 0.034, 0.07, 0.075), time = structure(c(29674, 
    29674, 29691, 29719), class = c("hms", "difftime"), units = "secs")), class = c("data.table", 
"data.frame"), row.names = c(NA, -4L), .internal.selfref = <pointer: 0x000001d92b2d1ef0>) 

使用以下代码(most_recent 只是从 'recent' 中获取最新的数据点):

ggplot()+geom_line(data=historic,aes(x=time, y=cumvol, group=date),color='#BAB0AC', alpha=0.5)+
  geom_line(data=recent,aes(x=time, y=cumvol, group=date),size=1.2,color='#E15758')+
  geom_point(data=most_recent, aes(x=time,y=cumvol), color='#E15759',size=3)+geom_hline(yintercept = 0)+  theme(title=element_text(size=12),panel.background = element_rect(fill='white',color='black'),legend.position='right')+
    labs(title = "Morning Vol",subtitle = "Cum Vol so far", x = "Time", y = "Vol")

我想做的是让 html 文件(由 markdown 生成)的查看者能够突出显示某些特定日期(从 'historic' 开始)并将其与数据进行比较来自 'recent'。现在我意识到这可能在一个闪亮的应用程序中是可能的,但是这不适合我的目的,我想知道 jQuery 的 'Datepicker' 插件(或类似的东西)是否可以提供解决方案。

有谁知道我如何(或是否)可以做到这一点?

https://www.aliciaschep.com/blog/js-rmarkdown/

多亏了 r2evans,我似乎不得不将数据集分割成更易于管理的选择,然后使用 crosstalk 库来添加交互性。