Pie Chart Zero Slices
If all but one slice is zero, the > zero slice does not get drawn.
HTML
<script language="javascript" type="text/javascript" src="https://bitbucket.org/cleonello/jqplot/raw/b5a7796a9ebf/src/jquery.jqplot.js"></script>
<script language="javascript" type="text/javascript" src="https://bitbucket.org/cleonello/jqplot/raw/81ec4eb933068c5009958b504feef3f27e1b1129/src/plugins/jqplot.pieRenderer.js"></script>
<script language="javascript" type="text/javascript" src="https://bitbucket.org/cleonello/jqplot/src/e8af8a37f0f14ea1e8c630ecfe6f1b1933794036/src/plugins/jqplot.highlighter.js"></script>
<div id="chart2"></div>
JavaScript
$(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', "");
});
});