我使用的是PrimeFaces 6.0,我想在我的条形图上显示工具提示。我尝试过像this example这样的数据处理程序,它工作得很好。问题是,我可能会使用长文本作为工具提示,而最左边的栏不会显示全文like this。
我试着用这个代码移动位置。
function toolTip(str, seriesIndex, pointIndex, plot){
var val = plot.data[seriesIndex][pointIndex];
return "<div style='position:relative; left:80px; bottom:15px;'>1aaaaaaaaaaaaaaaaaaaa: " +
(pointIndex +1) + "<br/>2bbbbbbbbbbbbbbbbbb: " + val + "</div>";
}文本按我设计的方式移动,但框仍然存在like this。
我正在考虑使用扩展程序,但我在文档页面上搞不懂该使用哪个属性,以及如何将bean中的数据作为工具提示的文本进行传递。
你知道如何将框和文本移动到我用datatipeditor设计的位置吗?
发布于 2018-07-26 09:45:14
bean内部:
CartesianChartModel barModel = new BarChartModel();
barModel.setExtender("myExtender");然后在我的js中,我使用来自荧光笔的tooltipContentEditor,下面是代码:
function myExtender(){
this.cfg.highlighter = {
tooltipContentEditor: function (str, seriesIndex, pointIndex, plot) {
var val = plot.data[seriesIndex][pointIndex];
return "this value is: " + val + "<br/>this is a looooooooooooong text";
},
show: true,
useAxesFormatters: false,
tooltipLocation: 'n'
};
}这是result。
https://stackoverflow.com/questions/51513206
复制相似问题