【发布时间】:2017-05-24 22:16:11
【问题描述】:
我有一个 jqplot 条形图,我已经为它实现了 tooltipContentHandler 来显示图像而不是文本。这是代码...
tooltipContentEditor: function(str, seriesIndex, pointIndex, jqPlot) {
var currentItem = myData[0][pointIndex];
var pid = currentItem[0];
// Get the image url from static list...
var pidImage = pidImages[pid];
var s = "<img src='" +pidImage+ "' width=50px height=50px/>";
return s;
}
效果很好 - 当鼠标移到条上时会显示图像。我的问题是图像的不透明度 - 因为图像的一部分覆盖了条,而另一部分没有,所以图像的不透明度看起来很奇怪。
所以我只是通过将其添加到 tooltipContentHandler 函数来更改不透明度...
$('.jqplot-highlighter-tooltip').css("background", "rgba(208,208,208,1.0)");
没有区别,所以我直接在 jqplot css 中进行了更改(包括“.min”版本):
.jqplot-highlighter-tooltip, .jqplot-canvasOverlay-tooltip {
/*replace this
background: rgba(208,208,208,0.5);
with...*/
background: rgba(208,208,208,1.0);
}
但仍然存在相同的不透明度问题。然后我尝试在 css 中对 .jqplot-cursor-tooltip 进行相同的 rgba 更改,尽管我知道这不会有任何区别。
有人对我如何解决这个问题有任何好的想法吗?
谢谢。
【问题讨论】:
-
您可以为您的图表覆盖工具提示 div 的 CSS 属性。在那里你可以指定你的不透明度
-
@Gyandeep 这不正是我在上面所做的吗?
标签: jqplot