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

d3 v4 #211

Open
jcheng5 opened this issue Jun 28, 2016 · 6 comments
Open

d3 v4 #211

jcheng5 opened this issue Jun 28, 2016 · 6 comments

Comments

@jcheng5
Copy link
Collaborator

jcheng5 commented Jun 28, 2016

I just found out the just released d3 v4.0 isn't backward compatible with older versions of d3. I don't know how we can compose widgets that use both on the same page.

@timelyportfolio
Copy link
Collaborator

Yep, it will be messy.

@ramnathv
Copy link
Owner

Hmm. Yeah, this will be messy. Let us talk to figure out what we can potentially do.

@ramnathv
Copy link
Owner

So, I just realized that people developing on d3 v4.0 are more likely to use ES6 and build custom bundles of the d3 modules and their application code. If not, we can encourage them to do so. This way, the bundle will be standalone and will not pollute the namespace and hence these widgets can co-exist with d3 v3.0.

I have a widget built using d3 v4.0 that is close to completion and I can use that to test this.

@mortonanalytics
Copy link

mortonanalytics commented Jan 25, 2018

I'm writing a reusable charting htmlwidget using d3.js v4 and ES6 standards.

class throws an error in the RStudio HTML viewer: SyntaxError: Use of reserved word 'class'. Should class be supported or do I need to refactor to ES5 constructors? Or is this an RStudio issue?

System details

setting value
version R version 3.4.3 (2017-11-30)
system x86_64, mingw32
ui RStudio (1.1.383)
language (EN)
collate English_United States.1252
tz America/Denver
date 2018-01-25

htmlwidget JS code

Code follows the structure below:

class Chart {
    constructor(opts) {
        // stuff
    }
    setColor() {
        // more stuff
    }
    setData() {
        // even more stuff
    }
}

@timelyportfolio
Copy link
Collaborator

timelyportfolio commented Jan 25, 2018

@mortonanalytics, this is a RStudio Viewer issue. I would recommend using babel to transpile. If you want to stay within R, then reactR has a babel_transform() function. Hope this helps.

@jcheng5
Copy link
Collaborator Author

jcheng5 commented Jan 25, 2018

RStudio 1.2 should resolve this (the underlying browser engine will switch from an old WebKit fork to something Chromium based) but it's quite a few months away from being ready for release, much less the predominant version.

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

4 participants