greetclock / angular-gauge-chart

Angular Gauge Chart
https://recogizer.github.io/gauge-chart/examples/samples/
MIT License
61 stars 41 forks source link

CentralLabel showing on left of gauge #36

Open lagc03 opened 4 years ago

lagc03 commented 4 years ago

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: `

{{ specification.caption }} {{ specification.subcaption }} 70% = {{(specification.widget.bottomLabel | number) + ' ' + specification.units}}
AVG = Elephant Butte Storage Calendar Year Average (1964-2013)

`

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; }`

andrea-colleoni commented 4 years ago

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

bastifix commented 3 years ago

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

lagc03 commented 3 years ago

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"

`

Which looks like this:

gauge_jpg