|
|
|
@ -7780,6 +7780,7 @@ nv.models.pie = function() {
|
|
|
|
|
, getValues = function(d) { return d.values }
|
|
|
|
|
, getX = function(d) { return d.x }
|
|
|
|
|
, getY = function(d) { return d.y }
|
|
|
|
|
, getDescription = function(d) { return d.description }
|
|
|
|
|
, id = Math.floor(Math.random() * 10000) //Create semi-unique ID in case user doesn't select one
|
|
|
|
|
, color = nv.utils.defaultColor()
|
|
|
|
|
, valueFormat = d3.format(',.2f')
|
|
|
|
@ -8070,6 +8071,12 @@ nv.models.pie = function() {
|
|
|
|
|
return chart;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
chart.description = function(_) {
|
|
|
|
|
if (!arguments.length) return getDescription;
|
|
|
|
|
getDescription = _;
|
|
|
|
|
return chart;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
chart.showLabels = function(_) {
|
|
|
|
|
if (!arguments.length) return showLabels;
|
|
|
|
|
showLabels = _;
|
|
|
|
@ -8162,10 +8169,11 @@ nv.models.pieChart = function() {
|
|
|
|
|
//------------------------------------------------------------
|
|
|
|
|
|
|
|
|
|
var showTooltip = function(e, offsetElement) {
|
|
|
|
|
var tooltipLabel = pie.description()(e.point) || pie.x()(e.point)
|
|
|
|
|
var left = e.pos[0] + ( (offsetElement && offsetElement.offsetLeft) || 0 ),
|
|
|
|
|
top = e.pos[1] + ( (offsetElement && offsetElement.offsetTop) || 0),
|
|
|
|
|
y = pie.valueFormat()(pie.y()(e.point)),
|
|
|
|
|
content = tooltip(pie.x()(e.point), y, e, chart);
|
|
|
|
|
content = tooltip(tooltipLabel, y, e, chart);
|
|
|
|
|
|
|
|
|
|
nv.tooltip.show([left, top], content, e.value < 0 ? 'n' : 's', null, offsetElement);
|
|
|
|
|
};
|
|
|
|
@ -8344,7 +8352,7 @@ nv.models.pieChart = function() {
|
|
|
|
|
chart.dispatch = dispatch;
|
|
|
|
|
chart.pie = pie;
|
|
|
|
|
|
|
|
|
|
d3.rebind(chart, pie, 'valueFormat', 'values', 'x', 'y', 'id', 'showLabels', 'donutLabelsOutside', 'pieLabelsOutside', 'donut', 'labelThreshold');
|
|
|
|
|
d3.rebind(chart, pie, 'valueFormat', 'values', 'x', 'y', 'description', 'id', 'showLabels', 'donutLabelsOutside', 'pieLabelsOutside', 'donut', 'labelThreshold');
|
|
|
|
|
|
|
|
|
|
chart.margin = function(_) {
|
|
|
|
|
if (!arguments.length) return margin;
|
|
|
|
|