当“从外部”输入饼图时,工具提示工作正常,但切片之间的过渡会导致工具提示消失并且不会创建新的工具提示。
这是我的jsfiddle 片段 http://jsfiddle.net/LqB3f/14/,密切基于有用的建议这个答案 https://stackoverflow.com/questions/8209474/how-to-display-tooltips-on-jqplot-pie-chart.
我知道如何让工具提示适用于整个馅饼,正如所见另一个jsfiddle http://jsfiddle.net/AnthonyLeGovic/bB9cw/2/就是这样做,但我希望工具提示位于特定切片的顶部。
我见过气泡图 http://www.jqplot.com/tests/bubble-plots.php示例http://www.jqplot.com http://www.jqplot.com但由于它使用了plot1b.axes.xaxis等,我认为它不容易应用于馅饼或甜甜圈?
$(document).ready(function () {
var data = [
['Heavy Industry', 12],['Retail', 9], ['Light Industry', 14],
['Out of home', 16],['Commuting', 7], ['Orientation', 9]
];
plot2 = jQuery.jqplot('chart2', [ data ], {
seriesDefaults: {
shadow: false,
renderer: jQuery.jqplot.PieRenderer,
rendererOptions: {
padding: 2,
sliceMargin: 2,
showDataLabels: true,
highlightMouseOver: true
},
highlighter: {
show: true,
formatString: '%s',
tooltipLocation: 'sw',
useAxesFormatters: false
}
}
});
$('#chart2').bind('jqplotDataHighlight',
function (ev, seriesIndex, pointIndex, data) {
console.log("jqplotDataHighlight for " + data)
var $this = $(this);
$this.attr('title', data[0] + ": " + data[1]);
});
$("#chart2").bind('jqplotDataUnhighlight', function (ev, seriesIndex, pointIndex, data) {
console.log("jqplotDataUnhighlight for " + data)
var $this = $(this);
$this.attr('title', "");
});
});