Object not defined error when using d3.js with J2V8

128 views Asked by At

Tried to use the D3 logics / algorithm in android using J2V8

For example

V8 runtime = V8.createV8Runtime();
Object obj = runtime.executeScript(readFileAsString("d3-array.v1.js"));
Integer maxObject = runtime.executeIntegerScript("d3.max([2,3])");

D3 array utility as follows

https://d3js.org/d3-array.v1.js

Getting following error

 Process: com.j2v8test, PID: 2061
    java.lang.RuntimeException: Unable to start activity ComponentInfo{com.j2v8test/com.j2v8test.MainActivity}: undefined:1: ReferenceError: d3 is not defined
    d3.max([2,3])
    ^
    ReferenceError: d3 is not defined
        at <anonymous>:1:1
    com.eclipsesource.v8.V8ScriptExecutionException

P.S. : D3.JS with version 3 was working well but the error occurs with D3.JS latest version (or from version 4)

0

There are 0 answers