diff --git a/htdocs/samples/chart_pie.html b/htdocs/samples/chart_pie.html index cf05c6d2e..679fe6cdd 100644 --- a/htdocs/samples/chart_pie.html +++ b/htdocs/samples/chart_pie.html @@ -8,45 +8,25 @@ - + \ No newline at end of file diff --git a/src/arc.ts b/src/arc.ts index cd04eed0d..e6c7fb7b8 100644 --- a/src/arc.ts +++ b/src/arc.ts @@ -702,10 +702,7 @@ ChartInternal.prototype.redrawArc = function( .style('opacity', function(d) { return $$.isTargetToShow(d.data.id) && $$.isArcType(d.data) ? 1 : 0 }) - main - .select('.' + CLASS.chartArcsTitle) - .style('opacity', $$.hasType('donut') || hasGaugeType ? 1 : 0) - + if (hasGaugeType) { let index = 0 const backgroundArc = $$.arcs diff --git a/src/core.ts b/src/core.ts index 59eacb7bf..217882bc4 100644 --- a/src/core.ts +++ b/src/core.ts @@ -732,6 +732,11 @@ ChartInternal.prototype.redraw = function(options, transitions) { .transition() .style('opacity', targetsToShow.length ? 0 : 1) + // Only show arc title if chart type is donut or gauge and if there are any data to show + main + .select('.' + CLASS.chartArcsTitle) + .style('opacity', ($$.hasType('donut') || $$.hasType('gauge')) && targetsToShow.length > 0 ? 1 : 0) + // event rect if (withEventRect) { $$.redrawEventRect()