@@ -5,14 +5,15 @@ import { calculateViewDimensions } from '../../common/view-dimensions.helper';
5
5
import { ColorHelper } from '../../common/color.helper' ;
6
6
import { ViewDimensions } from '../../common/types/view-dimension.interface' ;
7
7
import { ScaleType } from '../../common/types/scale-type.enum' ;
8
+ import { id } from '../../utils/id' ;
8
9
9
10
@Component ( {
10
11
selector : 'ngx-charts-percent-gauge' ,
11
12
template : `
12
13
<ngx-charts-chart [view]="[width, height]" [showLegend]="false" [animations]="animations">
13
14
<svg:g class="percent-gauge chart" (click)="onClick()">
14
15
<svg:g [attr.transform]="transform">
15
- <mask id="circleMask ">
16
+ <mask [attr.id]="circleMaskId ">
16
17
<circle
17
18
[attr.r]="radius"
18
19
[style.stroke-width]="radius / 5"
@@ -38,7 +39,7 @@ import { ScaleType } from '../../common/types/scale-type.enum';
38
39
[style.stroke-dasharray]="dashes"
39
40
/>
40
41
41
- <svg:g mask=" url(#circleMask) ">
42
+ <svg:g [attr. mask]="' url(#' + circleMaskId + ')' ">
42
43
<svg:g [attr.transform]="circleTransform">
43
44
<svg:g *ngFor="let tic of ticks" [attr.transform]="tic.transform">
44
45
<rect
@@ -125,6 +126,7 @@ export class PercentGaugeComponent extends BaseChartComponent {
125
126
targetRadius : number ;
126
127
targetTextTransform : string ;
127
128
129
+ circleMaskId : string ;
128
130
circleTransform : string ;
129
131
ticks : any [ ] = [ ] ;
130
132
ticHeight : number ;
@@ -142,6 +144,8 @@ export class PercentGaugeComponent extends BaseChartComponent {
142
144
update ( ) : void {
143
145
super . update ( ) ;
144
146
147
+ this . circleMaskId = `circleMask${ id ( ) } ` ;
148
+
145
149
this . margin = [ ...this . defaultMargin ] ;
146
150
if ( this . showLabel ) {
147
151
this . margin [ 2 ] = 50 ;
0 commit comments