Git Product home page Git Product logo

Comments (3)

picousse avatar picousse commented on July 24, 2024 1

owkay, I got it up and running using a gallery example.

from r2d3.

javierluraschi avatar javierluraschi commented on July 24, 2024

@picousse r2d3::r2d3() takes an R object, not a character with JSON data, use jsonlite::fromJSON instead with something similar to:

r2d3::r2d3(
  data = jsonlite::fromJSON("{\n\"name\": \"aaaa\",\n\"children\": [\n{\n\"name\": \"bbbb\",\n\"children\": [\n{\n\"name\": \"cccc\",\n\"children\": [\n{\n\"name\": \"dddd\"\n}\n]\n}\n]\n}\n]\n}"), script="~/RStudio/test-d3-34.js",
  script = "learn_plot.js"
)

from r2d3.

picousse avatar picousse commented on July 24, 2024

Hi,
Thanks for the reply.
However i found it weird that you have two script arguments. One for D3 and the other for the .js file.
two things about this:

  • I get an error: formal argument "script" matched by multiple actual arguments. I removed the script argument towards the d3 library, and still nothing.
  • do you explicitly need to have a path towards a downloaded d3 library? I thought this was not necessary...

I still don't get it working :-(

r2d3::r2d3(
data = jsonlite::fromJSON("{\n"name": "aaaa",\n"children": [\n{\n"name": "bbbb",\n"children": [\n{\n"name": "cccc",\n"children": [\n{\n"name": "dddd"\n}\n]\n}\n]\n}\n]\n}"),
script = "learn_plot.js",
d3_version = c("4"))

the example

r2d3(
data = c (0.3, 0.6, 0.8, 0.95, 0.40, 0.20),
script = system.file("examples/barchart.js", package = "r2d3")
)

works, so I guess it has to be something in my learn_plot.js file?

Thanks for the help

from r2d3.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.