Ngx-charts: Expect text and unit font size could be customised in gauge chart

Created on 3 May 2017  路  7Comments  路  Source: swimlane/ngx-charts

I'm submitting a ... (check one with "x")

[ ] bug report => search github for a similar issue or PR before submitting
[ x] feature request
[ ] support request => Please do not submit support request here

Current behavior

Expected behavior
Hopefully user can customise font size for these two labels, thanks

Reproduction of the problem

What is the motivation / use case for changing the behavior?

Please tell us about your environment:

  • ngx-charts version: x.x.x

  • Angular version: 2.x.x

  • Browser: [all | Chrome XX | Firefox XX | IE XX | Safari XX | Mobile Chrome XX | Android X.X Web Browser | iOS XX Safari | iOS XX UIWebView | iOS XX WKWebView ]

  • Language: [all | TypeScript X.X | ES6/7 | ES5]

Working as Intended

Most helpful comment

Yes, I agree with @qiluo this is how my gauge looks if I set showAxis=false.
https://plnkr.co/edit/CoCmJQd6eNNTTKUI7anq?p=preview
image

<ngx-charts-gauge
  [results]="base"
  [min]="0"
  [max]="100"
  [units]="'%'"
  [angleSpan]="180"
  [startAngle]="-90"
  [showAxis]="false"
  (select)="onSelect($event)">

All 7 comments

The text and unit fonts automatically scale with the chart, so we can not allow overriding those without breaking responsiveness.

But if set showAxis=false, the inner texts (value and unit) would be very large

Yes, I agree with @qiluo this is how my gauge looks if I set showAxis=false.
https://plnkr.co/edit/CoCmJQd6eNNTTKUI7anq?p=preview
image

<ngx-charts-gauge
  [results]="base"
  [min]="0"
  [max]="100"
  [units]="'%'"
  [angleSpan]="180"
  [startAngle]="-90"
  [showAxis]="false"
  (select)="onSelect($event)">

Please reopen if this is still an issue.

Hello. I have this issue as well. I'm using the gauge chart to display my state of charge. Is there any way to just display the value with a % sign next to it? https://i.gyazo.com/95c75c7b15bab799fe840595ffc32e05.png
This is how it looks currently.

Hello. I have this issue as well. I'm using the gauge chart to display my state of charge. Is there any way to just display the value with a % sign next to it? https://i.gyazo.com/95c75c7b15bab799fe840595ffc32e05.png
This is how it looks currently.

Hello again. I solved this issue by using valueFormatting. However, when I first used a valueFormatting function it started to kill the performance since I hadn't changed my ChangeDetectionStrategy, so make sure you use

changeDetection: ChangeDetectionStrategy.OnPush

I had a solution for hiding the Gauge chart middle text.

[view]="view"
[scheme]="colorScheme"
[results]="radioData"
[min]="0"
[max]="100"
[angleSpan]="240"
[startAngle]="-120"
[bigSegments]="10"
[smallSegments]="5"
[tooltipDisabled]="false"
[valueFormatting]="hideShowText"
[animations]="animations" >

By using [valueFormatting]="hideShowText", in component part we need to write below function

hideShowText(showText){
//console.log(showText)
}

That's it data will hide
noLabel

Was this page helpful?
0 / 5 - 0 ratings