Permalink
Browse files

Add a few axis options. Fixes #41, fixes #42

  • Loading branch information...
sbrunk committed Nov 28, 2018
1 parent 0328584 commit 4fc7d16810c29fe1331657894e7b432227461b29
@@ -0,0 +1,11 @@
package plotly.element
sealed abstract class TickMode(val mode: String) extends Product with Serializable
object TickMode {
case object Auto extends TickMode("auto")
case object Linear extends TickMode("linear")
case object Array extends TickMode("array")
}
@@ -33,7 +33,12 @@ final case class Axis(
anchor: Option[AxisAnchor],
`type`: Option[AxisType],
overlaying: Option[AxisAnchor],
position: Option[Double]
position: Option[Double],
tickmode: Option[TickMode],
tickvals: Option[Sequence],
ticktext: Option[Sequence],
nticks: Option[Int],
automargin: Option[Boolean]
)
object Axis {
@@ -65,7 +70,13 @@ object Axis {
anchor: AxisAnchor = null,
`type`: AxisType = null,
overlaying: AxisAnchor = null,
position: JDouble = null
position: JDouble = null,
tickmode: TickMode = null,
tickvals: Sequence = null,
ticktext: Sequence = null,
nticks: JInt = null,
automargin: JBoolean = null,
): Axis =
Axis(
Option(title),
@@ -95,6 +106,11 @@ object Axis {
Option(anchor),
Option(`type`),
Option(overlaying),
Option(position) .map(x => x: Double)
Option(position) .map(x => x: Double),
Option(tickmode),
Option(tickvals),
Option(ticktext),
Option(nticks) .map(x => x: Int),
Option(automargin) .map(x => x: Boolean)
)
}
@@ -8,7 +8,8 @@ final case class Margin(
l: Option[Int],
r: Option[Int],
t: Option[Int],
b: Option[Int]
b: Option[Int],
pad: Option[Int],
)
object Margin {
@@ -17,13 +18,15 @@ object Margin {
l: JInt = null,
r: JInt = null,
t: JInt = null,
b: JInt = null
b: JInt = null,
pad: JInt = null
): Margin =
Margin(
Option(autoexpand).map(b => b: Boolean),
Option(l).map(n => n: Int),
Option(r).map(n => n: Int),
Option(t).map(n => n: Int),
Option(b).map(n => n: Int)
Option(b).map(n => n: Int),
Option(pad).map(n => n: Int)
)
}
@@ -233,6 +233,7 @@ class DocumentationTests extends FlatSpec with Matchers {
"financial/time-series",
"basic/bubble",
"basic/area",
"layout/sizing",
// TODO? Gauge charts
// TODO Multiple chart types (needs contour)
// TODO Shapes (need mock of d3)

0 comments on commit 4fc7d16

Please sign in to comment.