簡體   English   中英

R / d3heatmap /有光澤 - 有沒有辦法在d3工具提示中嵌入圖像?

[英]R / d3heatmap / shiny - is there a way to embed images in d3 tooltip?

我想在滾動單元格時在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)

默認工具提示

1981豐田卡羅納

一種方法是在base64中對圖像進行編碼,然后將這些圖像的矩陣傳遞給d3heatmap(...,cellnote =)

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

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM