question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Gauge chart & label doesn't fit parent component

See original GitHub issue

I’m submitting a … (check one with “x”)

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

Current behavior The chart is always full size and does not fit component size By the way, units & text are too small on firefox and does not fit chart size. But if I switch tabs and come back to the chart tab, the text is well displayed. I added this console log in scaleText : console.log(this.resizeScale + ' - ' + oldScale); and here are results on init view : 1 - 1 When I change and get back to chart tab :

2.46 - 1
2.46 - 2.46

Here is my component :

<div fxLayout="row" fxLayoutAlign="center center">
  <ngx-charts-gauge #graph
    [view]="view"
    [scheme]="colorScheme"
    [results]="graphData"
    [margin]="margin"
    [min]="0"
    [max]="100"
    [angleSpan]="360"
    [startAngle]="0"
    [units]="'front.bonus.value.progress' | translate"
    [showAxis]="false"
    [tooltipDisabled]="true"
    [textValue]="graphLabel">
  </ngx-charts-gauge>
</div>

view: Array<number> = [];
margin: Array<number> = [0, 0, 0, 0];
colorScheme = { domain: ['rgb(0, 130, 195)', 'rgb(255, 192, 88)'] };

Expected behavior The chart should fit its parent component size & the chart text should fit its chart size

Reproduction of the problem I can’t reproduce the problem with a fresh plunker so here are screenshots from my app : desktop mode (chart 600x400) : 2017-08-19_19h49_12

mobile mode : chart is still 600x400 while my component is 320x334 2017-08-19_20h10_53

FF text size bug with chart 600x400 : 2017-08-19_19h51_10

  • ngx-charts version: 6.0.1

  • Angular version: 4.3.5

  • Browser: Chrome 60 & FF 55.0.1

  • Language: TypeScript 2.4.2 | ES7

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
marjan-georgievcommented, Oct 3, 2017

Try setting the height of the parent container and see if that fixes it.

<div fxLayout="row" fxLayoutAlign="center center" style="height:334px;">

0reactions
marjan-georgievcommented, Apr 8, 2018

Closing this in favor of #560. Let’s continue discussion in there please.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Angular NGX Chart not fitting to parent container correctly ...
The problem is with the pie-chart, because that chart doesn't fit the parent container correctly. Here is the HTML:
Read more >
How to Keep the Chart Size Consistent While Changing ...
Chart JS Dashboard Series: Most Liked Video Series: Watch Part 1: ... polar area chart, radar chart, gauge chart and area chart.
Read more >
Gauge charts – amCharts 5 Documentation
This tutorial will address how to build gauges using radar chart components. Creating chart#. In amCharts 5, we use radar chart to create...
Read more >
Tutorial on Creating Charts using JavaScript & HTML
An interactive tutorial on creating HTML5 JavaScript Charts using CanvasJS. ... dataSeries – parent of dataPoints that also defines type of chart and...
Read more >
Plot sizing problems - plotly.js - Plotly Community Forum
Layout is initially wrong (top chart doesn't fill its div, and that div is already taller than desired. Expanding the window height causes...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found