我有一個非常大的歷史資料資料框,這是一個剪輯(資料=歷史):
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 只是從“最近”獲取最新資料點):
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 檔案(由降價生成)的查看者能夠突出顯示一些特定日期(來自“歷史”)并將其與“最近”的資料進行比較。現在我意識到這可能在一個閃亮的應用程式中是可能的,但這不適合我的目的,我想知道 jQuery 的“Datepicker”插件(或類似的東西)是否可以提供解決方案。
有誰知道我如何(或是否)能做到這一點?
https://www.aliciaschep.com/blog/js-rmarkdown/
uj5u.com熱心網友回復:
多虧了 r2evans,我似乎不得不將資料集分割成更易于管理的選擇,然后使用 crossstalk 庫來添加互動性。
轉載請註明出處,本文鏈接:https://www.uj5u.com/qiye/430665.html
上一篇:圖表未出現
