gpt4 book ai didi

javascript - R/d3heatmap/shiny - 有没有办法在 d3 工具提示中嵌入图像?

转载 作者:行者123 更新时间:2023-11-29 15:24:59 25 4
gpt4 key购买 nike

我想在滚动单元格时在 d3 工具提示中嵌入图像(而不是默认的行 - 列 - 值数据)。

library(shiny)
library(d3heatmap)

ui <- shinyUI(fluidPage(

titlePanel("Old Faithful Geyser Data"),
mainPanel(
d3heatmapOutput("out")
)
)
)

server <- shinyServer(function(input, output) {

output$out <- renderD3heatmap({
d3heatmap(x = mtcars,
Colv = NULL,
scale= "column",
key = FALSE,
yaxis_font_size = "10pt",
xaxis_font_size = "10pt")
})

})

shinyApp(ui = ui, server = server)

Default Tooltip

1981 Toyota Carona

最佳答案

一种方法是用 base64 对图像进行编码,然后将这些图像的矩阵传递给 d3heatmap(..., cellnote = )

    var tip = d3.tip()
.attr('class', 'd3heatmap-tip')
.html(function(d, i) {
return ('<img src="' + d.label + '"/>');
})

关于javascript - R/d3heatmap/shiny - 有没有办法在 d3 工具提示中嵌入图像?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40044089/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com