dygraphs icon indicating copy to clipboard operation
dygraphs copied to clipboard

ReferenceError: Dygraph is not defined

Open anonymous33999 opened this issue 4 years ago • 2 comments

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 avatar Nov 26 '20 09:11 anonymous33999

@danvk

anonymous33999 avatar Nov 26 '20 09:11 anonymous33999

it seems similar to https://github.com/danvk/dygraphs/issues/848

ffischer1984 avatar Aug 25 '21 22:08 ffischer1984

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 avatar Feb 07 '23 20:02 mirabilos