Browse Source

fix: fixes #2409 (#2417)

pull/2433/head
Yoshiya Hinosawa 6 years ago committed by GitHub
parent
commit
f5b6f30f04
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 21
      src/arc.js

21
src/arc.js

@ -316,7 +316,7 @@ ChartInternal.prototype.initArc = function () {
ChartInternal.prototype.redrawArc = function (duration, durationForExit, withTransform) { ChartInternal.prototype.redrawArc = function (duration, durationForExit, withTransform) {
var $$ = this, d3 = $$.d3, config = $$.config, main = $$.main, var $$ = this, d3 = $$.d3, config = $$.config, main = $$.main,
arcs, mainArc, backgroundArc, arcs, mainArc,
arcLabelLines, mainArcLabelLine, arcLabelLines, mainArcLabelLine,
hasGaugeType = $$.hasType('gauge'); hasGaugeType = $$.hasType('gauge');
arcs = main.selectAll('.' + CLASS.arcs).selectAll('.' + CLASS.arc) arcs = main.selectAll('.' + CLASS.arcs).selectAll('.' + CLASS.arc)
@ -469,11 +469,15 @@ ChartInternal.prototype.redrawArc = function (duration, durationForExit, withTra
.style("opacity", $$.hasType('donut') || hasGaugeType ? 1 : 0); .style("opacity", $$.hasType('donut') || hasGaugeType ? 1 : 0);
if (hasGaugeType) { if (hasGaugeType) {
var index = 0; let index = 0;
backgroundArc = $$.arcs.select('g.' + CLASS.chartArcsBackground).selectAll('path.' + CLASS.chartArcsBackground).data($$.data.targets); const backgroundArc = $$.arcs.select('g.' + CLASS.chartArcsBackground).selectAll('path.' + CLASS.chartArcsBackground).data($$.data.targets);
backgroundArc.enter().append("path")
.attr("class", function (d, i) { return CLASS.chartArcsBackground + ' ' + CLASS.chartArcsBackground +'-'+ i; }) backgroundArc
.attr("d", function (d1) { .enter()
.append("path")
.attr("class", (d, i) => CLASS.chartArcsBackground + ' ' + CLASS.chartArcsBackground +'-'+ i)
.merge(backgroundArc)
.attr("d", d1 => {
if ($$.hiddenTargetIds.indexOf(d1.id) >= 0) { return "M 0 0"; } if ($$.hiddenTargetIds.indexOf(d1.id) >= 0) { return "M 0 0"; }
var d = { var d = {
@ -484,7 +488,10 @@ ChartInternal.prototype.redrawArc = function (duration, durationForExit, withTra
}; };
return $$.getArc(d, true, true); return $$.getArc(d, true, true);
}); });
backgroundArc.exit().remove();
backgroundArc
.exit()
.remove();
$$.arcs.select('.' + CLASS.chartArcsGaugeUnit) $$.arcs.select('.' + CLASS.chartArcsGaugeUnit)
.attr("dy", ".75em") .attr("dy", ".75em")

Loading…
Cancel
Save