Skip to content

Electron compatibility #31

@nathansalwen

Description

@nathansalwen

I am not sure if this is an electron issue or a d3 issue (or maybe just user error). However, since it works with an older version of d3 but not the latest, I am routing it here. I do not know

d3 version 4.12 (d3-request 1.0.6) does not work well with electron. In particular, I cannot access local files by relative address, for example d3.csv("data.csv")

I found that, if I comment line 3 in d3-request/builds/d3-request.node.js
//var XMLHttpRequest = require('xmlhttprequest').XMLHttpRequest;
it uses the built-in electron XMLHttpRequest and then works.

When I run an earlier version of d3 (version 3.5.17), which does not have any d3-request module, this issue does not occur and d3.csv("data.csv") succeed

Thank you for the packages.

index.html:
`

<script> d3 = require("d3"); d3.csv("data.csv", function(data){ console.log(data); }, function(error, rows){ console.log(rows); }) </script> `

package.json (works):
{ "name": "simple", "version": "0.1.0", "main": "./main.js", "scripts": { "start": "electron .", "binary": { "module_name": "simple", "module_path": "./lib/binding/", "host": "localhost" } }, "dependencies": { "electron-prebuilt": "", "electron-debug": "", "d3": "^3.5.6" } }

package.json (fails):
{ "name": "simple", "version": "0.1.0", "main": "./main.js", "scripts": { "start": "electron .", "binary": { "module_name": "simple", "module_path": "./lib/binding/", "host": "localhost" } }, "dependencies": { "electron-prebuilt": "", "electron-debug": "", "d3": "" } }

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions