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.

Chart does not display after loading remains in 0 width x 0 height element

See original GitHub issue

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

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

Current behavior Chart generate a 0x0 ngx-charts-bar-vertical element(this is happening on all charts) though a portion of it appears as per this image: http://imgur.com/zsLUSbi data is per this image: http://imgur.com/cfDl8za

no errors are logged and charts do seem to be created as per this image: http://imgur.com/JmGK9iJ

Expected behavior I just want my chart!

Reproduction of the problem data is per this image: http://imgur.com/cfDl8za using this example: https://swimlane.gitbooks.io/ngx-charts/content/charts/bar-vertical.html data is loaded in during oninit via http <ngx-charts-bar-vertical [view]=“view” [scheme]=“colorScheme” [results]=“wakaChartData” [gradient]=“gradient” [xAxis]=“showXAxis” [yAxis]=“showYAxis” [legend]=“showLegend” [showXAxisLabel]=“showXAxisLabel” [showYAxisLabel]=“showYAxisLabel” [xAxisLabel]=“xAxisLabel” [yAxisLabel]=“yAxisLabel” (select)=“onSelect($event)”> </ngx-charts-bar-vertical>

Please tell us about your environment: Angular CLI Angular 4.1.0 most recent ngx-charts and D3 “@angular/animations”: “^4.0.0”, “@angular/common”: “^4.0.0”, “@angular/compiler”: “^4.0.0”, “@angular/core”: “^4.0.0”, “@angular/forms”: “^4.0.0”, “@angular/http”: “^4.0.0”, “@angular/platform-browser”: “^4.0.0”, “@angular/platform-browser-dynamic”: “^4.0.0”, “@angular/router”: “^4.0.0”, “@ng-bootstrap/ng-bootstrap”: “^1.0.0-alpha.23”, “@ngrx/core”: “^1.2.0”, “@ngrx/store”: “^2.2.2”, “@swimlane/ngx-charts”: “^5.1.2”, “angular2-jwt”: “0.2.2”, “bootstrap”: “^4.0.0-alpha.6”, “core-js”: “^2.4.1”, “cpx”: “^1.5.0”, “d3”: “^4.2.2”, “font-awesome”: “4.7.0”, “ng-bootstrap”: “^1.6.3”, “ngx-bootstrap”: “^1.6.6”, “rxjs”: “^5.3.0”, “simple-line-icons”: “^2.4.1”, “zone.js”: “^0.8.4”

  • Browser: [all]

  • Language: TypeScript 2.2 { “compileOnSave”: false, “compilerOptions”: { “outDir”: “./dist/out-tsc”, “baseUrl”: “src”, “sourceMap”: true, “declaration”: false, “moduleResolution”: “node”, “emitDecoratorMetadata”: true, “experimentalDecorators”: true, “target”: “es5”, “typeRoots”: [ “node_modules/@types” ], “lib”: [ “es2016”, “dom” ] } }

Issue Analytics

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

github_iconTop GitHub Comments

2reactions
marjan-georgievcommented, Apr 8, 2018

@Splaktar the results input is immutable, meaning you have to pass it a new array for the changes to be detected. You can do that by doing results = [...results] after you modify it.

I am going to close this issue. @wdunn001 if you still have the same problem and can create a stackblitz with an example, I would be happy to reopen.

0reactions
Splaktarcommented, Mar 18, 2018

It looks like this is because results doesn’t update as the passed in array changes. I need to do *ngIf on the value passed into results. Also to get the container to resize properly so that the charts don’t run outside of the container, I needed to use display: flex.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Charts.js sets canvas width/height to 0 and displays nothing
It appears that the issue is that the canvas and all its parent nodes cannot have display none at the time the ...
Read more >
overflow-x - CSS: Cascading Style Sheets - MDN Web Docs
The overflow-x CSS property sets what shows when content overflows a block-level element's left and right edges. This may be nothing, ...
Read more >
Visualization: Table | Charts - Google Developers
Overview. A table that can be sorted and paged. Table cells can be formatted using format strings, or by directly inserting HTML as...
Read more >
Drawing on Canvas - Eloquent JavaScript
When no width or height attribute is specified, as in the example, a canvas element gets a default width of 300 pixels and...
Read more >
Dygraphs — options reference
When set, draw the X axis at the Y=0 position and the Y axis at the X=0 position if those positions are inside...
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