scala-js-d3v4 icon indicating copy to clipboard operation
scala-js-d3v4 copied to clipboard

OrdinalScale doesn't work with Axis

Open schang1146 opened this issue 4 years ago • 1 comments

Trying to use d3scale.scaleOrdinal(...) with d3axis.axisLeft but running into a type problem.

  • Should OrdinalScale extend ContinuousScale[OrdinalScale] similar to LogScale, LinearScale, etc.?

How I'm using it:

val jobs: js.Array[String] = js.Array("Job A", "Job B", "Job C", "Job D", "5", "6", "7", "8", "9", "10")
val y_scale = d3scale.scaleOrdinal(d3.schemeCategory10).domain(jobs)
val y_axis: d3axis.Axis = d3axis.axisLeft(y_scale)

Gives me a type mismatch for y_scale in d3axis.axisLeft()

  • Required: d3.Scale
  • Found: d3scale.OrdinalScale

schang1146 avatar Oct 16 '20 17:10 schang1146

Sorry, I don't have time right now to look into this. But PRs are welcome.

fdietze avatar Jan 19 '21 13:01 fdietze