angular-gauge-chart icon indicating copy to clipboard operation
angular-gauge-chart copied to clipboard

CentralLabel showing on left of gauge

Open lagc03 opened this issue 5 years ago • 3 comments

Any hints on why the central label is showing at the left of the chart intead of in the inner middle?

image

Here is some of my code: <mat-card class="summary-box"> <mat-card-header> <mat-card-title>{{ specification.caption }}</mat-card-title> <mat-card-subtitle> {{ specification.subcaption }}</mat-card-subtitle> </mat-card-header> <mat-card-content> <rg-gauge-chart [canvasWidth]= 500 [nameFont] = 20 [needleValue]="specification.widget.needleValue" [bottomLabelFont] = 18 [centralLabel] = 70 [options]="options" ></rg-gauge-chart> <small>70% = {{(specification.widget.bottomLabel | number) + ' ' + specification.units}}</small><br> <small>AVG = Elephant Butte Storage Calendar Year Average (1964-2013)</small> </mat-card-content> </mat-card>

CSS:

`.metadata-box{ margin: 25px 10px 25px 10px; }

mat-card { display: flex; flex-grow: 1; }

mat-card-content { margin-left: 15px; flex-grow: 1; }

.description{ font-size: 16px; }`

lagc03 avatar Apr 08 '20 21:04 lagc03

x attribute in text element of the SVG is actually NaN when using centralLabel Have you solved this Luis?

andrea-colleoni avatar Nov 02 '20 11:11 andrea-colleoni

Same problem here: With centralLabel it works fine, but with [centralLabel] it's on the left and I get capture_002_16012021_002152

bastifix avatar Jan 15 '21 23:01 bastifix

I ended up using the bottomLabel instead and leaving the central as an empty string. My component is setup like so now:

<rg-gauge-chart *ngIf="specification.widget.type === 'fill-percent-gauge' && plotVisible === true" [canvasWidth]="canvasWidth" [nameFont]="nameFont" [centralLabel]="centralLabel" [needleValue]="specification.widget.needleValue" [bottomLabelFont]="bottomLabelFont" [bottomLabel]="bottomLabel" [options]="options" ></rg-gauge-chart>

Which looks like this:

gauge_jpg

lagc03 avatar Jan 19 '21 21:01 lagc03