Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Call dygraphs methods #24

Open
Antoine38660 opened this issue Apr 13, 2018 · 2 comments
Open

Call dygraphs methods #24

Antoine38660 opened this issue Apr 13, 2018 · 2 comments

Comments

@Antoine38660
Copy link

It seems impossible to access the chart methods such as .resetZoom() and .xAxisRange() as described here: http://dygraphs.com/jsdoc/symbols/Dygraph.html
Because _g (the chart instance) is private so we can't access it. Also NgDygraphsComponent isn't exported in index.ts (but available by importing ɵa from 'ng-dygraphs').

Is there a good reason to keep _g and NgDygraphsComponent private?

FYI: angular2-chartjs use this way to allow developers to access to the chart instance (emn178/angular2-chartjs#2 (comment))

@pierre-fromager
Copy link

Hi, you can get the component instance using the drawCallback:(dygraph: Dygraph, is_initial: boolean).
Just 've to define your callback lambda on the options.

@pierre-fromager
Copy link

pierre-fromager commented May 26, 2019

Well, to enforce my previous answer, i would suggest to add (dygraphs + @types/dygraphs) npm packages to your project to make your mind up and to get all available dygraph options.
Then to type your callback dygraph instance as Dygraph, just do an import as below .
import Dygraph from 'dygraphs';
Hope this helps 😄

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants