Skip to content
New issue

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

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

Already on GitHub? # to your account

ReferenceError: Dygraph is not defined #1009

Closed
anonymous33999 opened this issue Nov 26, 2020 · 3 comments
Closed

ReferenceError: Dygraph is not defined #1009

anonymous33999 opened this issue Nov 26, 2020 · 3 comments

Comments

@anonymous33999
Copy link

I am using react and I want to use the hairlines plugins of the dygraph. But whenever I am trying to use that plugin after compilation in the browser error comes dygraph is not defined. It comes from the hairline.js in the dygraph node module.

I import this two files as shown in the example but than also the error comes.
import Dygraph from 'dygraphs/dist/dygraph'
import Hairlines from 'dygraphs/src/extras/hairlines'

I tried
import Dygraphs from 'dygraphs/index.es5';
import Hairlines from 'dygraphs/src/extras/hairlines'
but same error was coming

To make it work I am editing the hairline.js and adding the import Dygraph from '../../index.es5' line and after that it is working perfectly fine. But as this is a node module and everyone will install on their laptops all of them need to edit it.

Am I missing some other imports or is there any other way we can use the hairlines plugin.

@anonymous33999
Copy link
Author

@danvk

@ffischer1984
Copy link

it seems similar to #848

@mirabilos
Copy link
Collaborator

Yeah, let’s track this in #848 instead. I think I actually know what to do now, but it’s bedtime. @chiubaca accidentally gave me what I needed to figure it out.

@mirabilos mirabilos closed this as not planned Won't fix, can't repro, duplicate, stale Feb 7, 2023
mirabilos added a commit that referenced this issue Feb 9, 2023
• taken initially from the existing one that require()s from
  smooth-plotter and synchroniser, for obtaining the Dygraph
  “global” in a module system
• some ways to import put it as .default though so use that
  if .NAME is absent but .default is defined
• apply this to all extras, fixing (#848) (#989) (#1009)
• drop redundant closure where applicable, suitably label otherwise
• label all functions here
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants