The charts are just resizing it when the window or the viewport change.
See original GitHub issueI’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 charts are just resizing it when the window or the viewport change.
Expected behavior
Resize the chart when the parent container change, if the chart doesn’t have the property view
defined.
Reproduction of the problem this is a reproduction: https://plnkr.co/edit/eikmlKcVM9vLTbzTQTNs?p=preview. As you can see in the view I put a button to refresh the with of the container but the graph doesn’t resize unless you resize the preview.
What is the motivation / use case for changing the behavior? I’m want to implement the charts in a layout where I have a sidebar that you can toggle, so if the sidebar is hidden then the main container take his place.
Please tell us about your environment:
@angular/cli: 1.0.0
node: 6.11.2
os: win32 x64
@angular/animations: 4.4.3
@angular/common: 4.4.3
@angular/compiler: 4.4.3
@angular/core: 4.4.3
@angular/forms: 4.4.3
@angular/http: 4.4.3
@angular/platform-browser: 4.4.3
@angular/platform-browser-dynamic: 4.4.3
@angular/router: 4.4.3
@angular/cli: 1.0.0
@angular/compiler-cli: 4.4.3
- ngx-charts version: ^7.0.0
- Angular version: ^4.0.0
Issue Analytics
- State:
- Created 6 years ago
- Reactions:19
- Comments:8
Top Results From Across the Web
Charts do not respond to viewport changes - Vaadin
Hi, if i change the viewport on the https://charts.demo.vaadin.com/ColumnWithMultiLevelDrilldown page the chart stays at the same size.
Read more >Does adjusting the browser window change the value of the ...
Yes, you can change your viewport size by resizing the browser window. The website What is my Viewport is a neat way to...
Read more >Dynamically resize canvas on window resize - Stack Overflow
You would dynamically adjust the height and width of the #area-chart. I personally suggest using viewport width to define the height as it...
Read more >Responsive Charts - Chart.js
When it comes to changing the chart size based on the window size, ... to be relatively positioned and dedicated to the chart...
Read more >Resizing an SVG When the Window is Resized in d3.js - Chartio
Think of it this way: Images have specific dimensions ( width and height ) and thus when a browser displays them or is...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@JulioWar I was able to work around the resize issue with the following code as suggested. ngAfterViewInit(): void { setTimeout(_ => { window.dispatchEvent(new Event(‘resize’)); }); // BUGFIX: }
Maybe we can try to trigger the window resize event like is discribed here: https://stackoverflow.com/questions/1818474/how-to-trigger-the-window-resize-event-in-javascript