Skip to content

Commit

Permalink
expose internal pieChart._applyLabelText
Browse files Browse the repository at this point in the history
allowing a workaround for #703
  • Loading branch information
gordonwoodhull committed Feb 11, 2016
1 parent 54ac23a commit 72fa2a7
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 7 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "dc",
"version": "2.0.0-beta.25",
"version": "2.0.0-beta.26",
"license": "Apache-2.0",
"copyright": "2014",
"description": "A multi-dimensional charting library built to work natively with crossfilter and rendered using d3.js ",
Expand Down
17 changes: 11 additions & 6 deletions src/pie-chart.js
Original file line number Diff line number Diff line change
Expand Up @@ -155,19 +155,24 @@ dc.pieChart = function (parent, chartGroup) {
}
}

function positionLabels (labelsEnter, arc) {
dc.transition(labelsEnter, _chart.transitionDuration())
.attr('transform', function (d) {
return labelPosition(d, arc);
})
.attr('text-anchor', 'middle')
_chart._applyLabelText = function (labels) {
labels
.text(function (d) {
var data = d.data;
if ((sliceHasNoData(data) || sliceTooSmall(d)) && !isSelectedSlice(d)) {
return '';
}
return _chart.label()(d.data);
});
};

function positionLabels (labels, arc) {
_chart._applyLabelText(labels);
dc.transition(labels, _chart.transitionDuration())
.attr('transform', function (d) {
return labelPosition(d, arc);
})
.attr('text-anchor', 'middle');
}

function createLabels (pieData, arc) {
Expand Down

0 comments on commit 72fa2a7

Please sign in to comment.