An open API service indexing awesome lists of open source software.

https://github.com/fdietze/scala-js-d3v4

ScalaJS facade types for D3 version 5
https://github.com/fdietze/scala-js-d3v4

d3 d3v4 facade scala-js

Last synced: 1 day ago
JSON representation

ScalaJS facade types for D3 version 5

Awesome Lists containing this project

README

          

[![](https://jitpack.io/v/fdietze/scala-js-d3v4.svg)](https://jitpack.io/#fdietze/scala-js-d3v4)

# ScalaJS facade types for D3 version 5
* Heavily inspired by [spaced/scala-js-d3](https://github.com/spaced/scala-js-d3)
* D3 modules are imported automatically by bundler when needed.

## Usage
Supported are ScalaJS` 1.0` with Scala `2.12` and `2.13`.

* Set up [Scalajs-Bundler](https://scalacenter.github.io/scalajs-bundler/) for your project.
* In your `build.sbt`:
```scala
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):

```scala
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](https://github.com/fdietze/scala-js-d3v4/tree/master/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](https://github.com/fdietze/scala-js-d3v4/blob/master/src/main/scala/D3.scala#L38).
* Don't hesitate to open new Issues.

## Facade writing guidelines
* 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.