Browse Source

Skip text for data label when it's off

pull/246/head
Masayuki Tanaka 11 years ago
parent
commit
f91595d99c
  1. 42
      c3.js
  2. 4
      c3.min.js

42
c3.js

@ -3345,26 +3345,28 @@
.attr("cy", __axis_rotated ? circleX : circleY); .attr("cy", __axis_rotated ? circleX : circleY);
mainCircle.exit().remove(); mainCircle.exit().remove();
mainText = main.selectAll('.' + CLASS.texts).selectAll('.' + CLASS.text) if (hasDataLabel()) {
.data(barOrLineData); mainText = main.selectAll('.' + CLASS.texts).selectAll('.' + CLASS.text)
mainText.enter().append('text') .data(barOrLineData);
.attr("class", classText) mainText.enter().append('text')
.attr('text-anchor', function (d) { return __axis_rotated ? (d.value < 0 ? 'end' : 'start') : 'middle'; }) .attr("class", classText)
.style("stroke", 'none') .attr('text-anchor', function (d) { return __axis_rotated ? (d.value < 0 ? 'end' : 'start') : 'middle'; })
.style("fill", color) .style("stroke", 'none')
.style("fill-opacity", 0); .style("fill", color)
mainText .style("fill-opacity", 0);
.text(function (d) { return formatByAxisId(d.id)(d.value, d.id); }) mainText
.style("fill-opacity", initialOpacityForText) .text(function (d) { return formatByAxisId(d.id)(d.value, d.id); })
.transition().duration(duration) .style("fill-opacity", initialOpacityForText)
.attr('x', xForText) .transition().duration(duration)
.attr('y', yForText) .attr('x', xForText)
.style("fill", color) .attr('y', yForText)
.style("fill-opacity", opacityForText); .style("fill", color)
mainText.exit() .style("fill-opacity", opacityForText);
.transition().duration(durationForExit) mainText.exit()
.style('fill-opacity', 0) .transition().duration(durationForExit)
.remove(); .style('fill-opacity', 0)
.remove();
}
// arc // arc
mainArc = main.selectAll('.' + CLASS.arcs).selectAll('.' + CLASS.arc) mainArc = main.selectAll('.' + CLASS.arcs).selectAll('.' + CLASS.arc)

4
c3.min.js vendored

File diff suppressed because one or more lines are too long
Loading…
Cancel
Save