Skip to content

Commit 922a12d

Browse files
authored
Merge pull request #43 from sbrunk/automargin
Add a few axis options
2 parents bae2349 + f8b9567 commit 922a12d

File tree

5 files changed

+38
-8
lines changed

5 files changed

+38
-8
lines changed

almond/src/main/scala/plotly/Almond.scala

+2-2
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,10 @@ object Almond {
2525
|});
2626
""".stripMargin
2727
else
28-
"""require.config({
28+
s"""require.config({
2929
| paths: {
3030
| d3: 'https://cdnjs.cloudflare.com/ajax/libs/d3/3.5.17/d3.min',
31-
| plotly: 'https://cdn.plot.ly/plotly-1.12.0.min',
31+
| plotly: 'https://cdn.plot.ly/plotly-${Plotly.plotlyVersion}.min',
3232
| jquery: 'https://code.jquery.com/jquery-3.3.1.min'
3333
| },
3434
|
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
package plotly.element
2+
3+
sealed abstract class TickMode(val mode: String) extends Product with Serializable
4+
5+
object TickMode {
6+
case object Auto extends TickMode("auto")
7+
case object Linear extends TickMode("linear")
8+
case object Array extends TickMode("array")
9+
}
10+
11+

core/shared/src/main/scala/plotly/layout/Axis.scala

+18-3
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,12 @@ final case class Axis(
3333
anchor: Option[AxisAnchor],
3434
`type`: Option[AxisType],
3535
overlaying: Option[AxisAnchor],
36-
position: Option[Double]
36+
position: Option[Double],
37+
tickmode: Option[TickMode],
38+
tickvals: Option[Sequence],
39+
ticktext: Option[Sequence],
40+
nticks: Option[Int],
41+
automargin: Option[Boolean]
3742
)
3843

3944
object Axis {
@@ -65,7 +70,12 @@ object Axis {
6570
anchor: AxisAnchor = null,
6671
`type`: AxisType = null,
6772
overlaying: AxisAnchor = null,
68-
position: JDouble = null
73+
position: JDouble = null,
74+
tickmode: TickMode = null,
75+
tickvals: Sequence = null,
76+
ticktext: Sequence = null,
77+
nticks: JInt = null,
78+
automargin: JBoolean = null
6979
): Axis =
7080
Axis(
7181
Option(title),
@@ -95,6 +105,11 @@ object Axis {
95105
Option(anchor),
96106
Option(`type`),
97107
Option(overlaying),
98-
Option(position) .map(x => x: Double)
108+
Option(position) .map(x => x: Double),
109+
Option(tickmode),
110+
Option(tickvals),
111+
Option(ticktext),
112+
Option(nticks) .map(x => x: Int),
113+
Option(automargin) .map(x => x: Boolean)
99114
)
100115
}

core/shared/src/main/scala/plotly/layout/Margin.scala

+6-3
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@ final case class Margin(
88
l: Option[Int],
99
r: Option[Int],
1010
t: Option[Int],
11-
b: Option[Int]
11+
b: Option[Int],
12+
pad: Option[Int]
1213
)
1314

1415
object Margin {
@@ -17,13 +18,15 @@ object Margin {
1718
l: JInt = null,
1819
r: JInt = null,
1920
t: JInt = null,
20-
b: JInt = null
21+
b: JInt = null,
22+
pad: JInt = null
2123
): Margin =
2224
Margin(
2325
Option(autoexpand).map(b => b: Boolean),
2426
Option(l).map(n => n: Int),
2527
Option(r).map(n => n: Int),
2628
Option(t).map(n => n: Int),
27-
Option(b).map(n => n: Int)
29+
Option(b).map(n => n: Int),
30+
Option(pad).map(n => n: Int)
2831
)
2932
}

tests/src/test/scala/plotly/doc/DocumentationTests.scala

+1
Original file line numberDiff line numberDiff line change
@@ -233,6 +233,7 @@ class DocumentationTests extends FlatSpec with Matchers {
233233
"financial/time-series",
234234
"basic/bubble",
235235
"basic/area",
236+
"layout/sizing",
236237
// TODO? Gauge charts
237238
// TODO Multiple chart types (needs contour)
238239
// TODO Shapes (need mock of d3)

0 commit comments

Comments
 (0)