mpx200 / ng-dygraphs

Angular 2+ library for support of dygraphs(http://dygraphs.com) charts
MIT License
3 stars 9 forks source link

How to make ng-dygraph 100% width and auto-resize #25

Open vbelot opened 5 years ago

vbelot commented 5 years ago

Hi, I spent days trying to make it work without success. How can you reproduce this example this ng-dygraph ? http://dygraphs.com/gallery/#g/resize

I tried a lot of things but I cannot apply style to the graph div.

Kind regards

JimiC commented 5 years ago

Use options.width: 'auto'.

wgtthompson commented 5 years ago

Use options={width:-1}. This works for me with an absolutely fresh project created using ng and following all of the instructions on installing (using the angular-cli.json instructions except for the new angular.json file and replacing the ../node_modules.... paths with node_modules/.... to represent the new path organization in the newer Angular)

ericklg commented 5 years ago

in html

<div id="graphdiv"> <ng-dygraphs [data]="dataGraph" [options]="options" [customVisibility]=true> </ng-dygraphs> </div>

after in option at the controller:

this.options = { width: document.getElementById('graphdiv').offsetWidth, .... }