本文介绍了R / d3heatmap /闪亮-是否可以在d3工具提示中嵌入图像?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
在单元格上滚动时,我想在d3工具提示中嵌入图像(而不是默认的行-列-值数据)。
I'd like to embed images (rather than the default Row - Column - Value data) in the d3 tooltip when scrolling over a cell.
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)
推荐答案
一种方法是在base64中对图像进行编码,然后将这些图像的矩阵传递给d3heatmap(...,cellnote =)
One way to do this is to encode your image in base64 and then pass a matrix of those images to d3heatmap(..., cellnote = )
var tip = d3.tip()
.attr('class', 'd3heatmap-tip')
.html(function(d, i) {
return ('<img src="' + d.label + '"/>');
})
这篇关于R / d3heatmap /闪亮-是否可以在d3工具提示中嵌入图像?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!