diff --git a/almond/src/main/scala/plotly/Almond.scala b/almond/src/main/scala/plotly/Almond.scala index 9666461..06c4e06 100644 --- a/almond/src/main/scala/plotly/Almond.scala +++ b/almond/src/main/scala/plotly/Almond.scala @@ -25,10 +25,10 @@ object Almond { |}); """.stripMargin else - """require.config({ + s"""require.config({ | paths: { | d3: 'https://cdnjs.cloudflare.com/ajax/libs/d3/3.5.17/d3.min', - | plotly: 'https://cdn.plot.ly/plotly-1.12.0.min', + | plotly: 'https://cdn.plot.ly/plotly-${Plotly.plotlyVersion}.min', | jquery: 'https://code.jquery.com/jquery-3.3.1.min' | }, | diff --git a/core/shared/src/main/scala/plotly/element/TickMode.scala b/core/shared/src/main/scala/plotly/element/TickMode.scala new file mode 100644 index 0000000..9c5bd9c --- /dev/null +++ b/core/shared/src/main/scala/plotly/element/TickMode.scala @@ -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") +} + + diff --git a/core/shared/src/main/scala/plotly/layout/Axis.scala b/core/shared/src/main/scala/plotly/layout/Axis.scala index a96dc5a..a676af9 100644 --- a/core/shared/src/main/scala/plotly/layout/Axis.scala +++ b/core/shared/src/main/scala/plotly/layout/Axis.scala @@ -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,12 @@ 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 +105,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) ) } diff --git a/core/shared/src/main/scala/plotly/layout/Margin.scala b/core/shared/src/main/scala/plotly/layout/Margin.scala index 76730d5..984fd04 100644 --- a/core/shared/src/main/scala/plotly/layout/Margin.scala +++ b/core/shared/src/main/scala/plotly/layout/Margin.scala @@ -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) ) } diff --git a/tests/src/test/scala/plotly/doc/DocumentationTests.scala b/tests/src/test/scala/plotly/doc/DocumentationTests.scala index 45e4477..2975b9e 100644 --- a/tests/src/test/scala/plotly/doc/DocumentationTests.scala +++ b/tests/src/test/scala/plotly/doc/DocumentationTests.scala @@ -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)