- Heavily inspired by spaced/scala-js-d3
- D3 modules are imported automatically by bundler when needed.
Supported are ScalaJS 1.0
with Scala 2.12
and 2.13
.
-
Set up Scalajs-Bundler for your project.
-
In your
build.sbt
:resolvers += "jitpack" at "https://jitpack.io" libraryDependencies += "com.github.fdietze.scala-js-d3v4" %%% "scala-js-d3v4" % "809f086"
Don't forget to update the commit hash. You can also use the hashes of branches and PRs.
-
Use d3 like you know it from JavaScript (http://devdocs.io/d3~4):
import d3v4._ d3.___
-
Contribute missing facades as pull requests. Most of the time this can be done in a few lines of code. You get a good overview of what exists and what is missing when looking at src/main/scala. Each File corresponds to a module in d3: https://devdocs.io/d3~4. To add a new module, simply create a new file and implement the facades you need. Finally add an implicit to your module in D3.scala.
-
Don't hesitate to open new Issues.
- Ref types involving null don't need a union type with Null. Provide wrapper methods mapping to Option.
- Prefer overloading in most cases. But use union types to avoid combinatorial explosion.