Skip to content

Commit 6a8f629

Browse files
Merge pull request #35 from alexarchambault/develop
Switch to plotly.js 1.41.3
2 parents b1e3604 + ad3b283 commit 6a8f629

File tree

19 files changed

+300
-104
lines changed

19 files changed

+300
-104
lines changed

.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,6 @@ stages:
1616
jobs:
1717
include:
1818
- scala: 2.11.12
19-
- scala: 2.12.6
19+
- scala: 2.12.7
2020
- stage: release
2121
script: sbt ci-release

build.sbt

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11

2-
import Aliases._
32
import Settings._
43

54
import sbtcrossproject.CrossPlugin.autoImport.crossProject
@@ -34,21 +33,21 @@ lazy val `joda-time` = project
3433
.settings(
3534
shared,
3635
plotlyPrefix,
37-
libs += Deps.jodaTime
36+
libraryDependencies += Deps.jodaTime
3837
)
3938

4039
lazy val render = crossProject(JVMPlatform, JSPlatform)
4140
.dependsOn(core)
4241
.settings(
4342
shared,
4443
plotlyPrefix,
45-
libs += Deps.argonautShapeless.value
44+
libraryDependencies += Deps.argonautShapeless.value
4645
)
4746
.jvmSettings(
48-
libs += WebDeps.plotlyJs
47+
libraryDependencies += WebDeps.plotlyJs
4948
)
5049
.jsSettings(
51-
libs += Deps.scalajsDom.value
50+
libraryDependencies += Deps.scalajsDom.value
5251
)
5352

5453
lazy val renderJvm = render.jvm
@@ -63,7 +62,7 @@ lazy val demo = project
6362
plotlyPrefix,
6463
test in Test := (),
6564
testOnly in Test := (),
66-
libs += Deps.scalatags.value,
65+
libraryDependencies += Deps.scalatags.value,
6766
jsDependencies ++= Seq(
6867
WebDeps.plotlyJs
6968
.intransitive()
@@ -107,7 +106,8 @@ lazy val tests = project
107106
shared,
108107
dontPublish,
109108
plotlyPrefix,
110-
libs ++= Seq(
109+
fetchTestData,
110+
libraryDependencies ++= Seq(
111111
Deps.scalaTest % "test",
112112
Deps.rhino % "test"
113113
)
@@ -118,7 +118,7 @@ lazy val almond = project
118118
.settings(
119119
shared,
120120
plotlyPrefix,
121-
libs += Deps.almondScalaApi % "provided"
121+
libraryDependencies += Deps.almondScalaApi % "provided"
122122
)
123123

124124

core/shared/src/main/scala/plotly/Trace.scala

Lines changed: 87 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ sealed abstract class Trace extends Product with Serializable
1111
final case class Scatter(
1212
x: Option[Sequence],
1313
y: Option[Sequence],
14-
text: Option[Seq[String]],
14+
text: Option[OneOrSeq[String]],
1515
mode: Option[ScatterMode],
1616
marker: Option[Marker],
1717
line: Option[Line],
@@ -24,27 +24,37 @@ final case class Scatter(
2424
fill: Option[Fill],
2525
error_x: Option[Error],
2626
error_y: Option[Error],
27-
showlegend: Option[Boolean]
27+
showlegend: Option[Boolean],
28+
fillcolor: Option[OneOrSeq[Color]],
29+
hoverinfo: Option[HoverInfo],
30+
hoveron: Option[HoverOn],
31+
stackgroup: Option[String],
32+
groupnorm: Option[GroupNorm]
2833
) extends Trace
2934

3035
object Scatter {
3136
def apply(
32-
values: Sequence = null,
33-
secondValues: Sequence = null,
34-
text: Seq[String] = null,
35-
mode: ScatterMode = null,
36-
marker: Marker = null,
37-
line: Line = null,
38-
textposition: TextPosition = null,
39-
textfont: TextFont = null,
40-
name: String = null,
41-
connectgaps: JBoolean = null,
42-
xaxis: AxisReference = null,
43-
yaxis: AxisReference = null,
44-
fill: Fill = null,
45-
error_x: Error = null,
46-
error_y: Error = null,
47-
showlegend: JBoolean = null
37+
values: Sequence = null,
38+
secondValues: Sequence = null,
39+
text: OneOrSeq[String] = null,
40+
mode: ScatterMode = null,
41+
marker: Marker = null,
42+
line: Line = null,
43+
textposition: TextPosition = null,
44+
textfont: TextFont = null,
45+
name: String = null,
46+
connectgaps: JBoolean = null,
47+
xaxis: AxisReference = null,
48+
yaxis: AxisReference = null,
49+
fill: Fill = null,
50+
error_x: Error = null,
51+
error_y: Error = null,
52+
showlegend: JBoolean = null,
53+
fillcolor: OneOrSeq[Color] = null,
54+
hoverinfo: HoverInfo = null,
55+
hoveron: HoverOn = null,
56+
stackgroup: String = null,
57+
groupnorm: GroupNorm = null
4858
): Scatter = {
4959

5060
val (xOpt, yOpt) = Option(secondValues) match {
@@ -68,7 +78,12 @@ object Scatter {
6878
Option(fill),
6979
Option(error_x),
7080
Option(error_y),
71-
Option(showlegend) .map(b => b: Boolean)
81+
Option(showlegend) .map(b => b: Boolean),
82+
Option(fillcolor),
83+
Option(hoverinfo),
84+
Option(hoveron),
85+
Option(stackgroup),
86+
Option(groupnorm)
7287
)
7388
}
7489
}
@@ -123,30 +138,40 @@ object Box {
123138
}
124139

125140
final case class Bar(
126-
x: Sequence,
127-
y: Sequence,
128-
name: Option[String],
129-
text: Option[Seq[String]],
130-
marker: Option[Marker],
131-
orientation: Option[Orientation],
132-
xaxis: Option[AxisReference],
133-
yaxis: Option[AxisReference],
134-
error_y: Option[Error],
135-
showlegend: Option[Boolean]
141+
x: Sequence,
142+
y: Sequence,
143+
name: Option[String],
144+
text: Option[Seq[String]],
145+
marker: Option[Marker],
146+
orientation: Option[Orientation],
147+
xaxis: Option[AxisReference],
148+
yaxis: Option[AxisReference],
149+
error_y: Option[Error],
150+
showlegend: Option[Boolean],
151+
hoverinfo: Option[HoverInfo],
152+
textposition: Option[BarTextPosition],
153+
opacity: Option[Double],
154+
width: Option[OneOrSeq[Double]],
155+
base: Option[OneOrSeq[Double]]
136156
) extends Trace
137157

138158
object Bar {
139159
def apply(
140-
x: Sequence,
141-
y: Sequence,
142-
name: String = null,
143-
text: Seq[String] = null,
144-
marker: Marker = null,
145-
orientation: Orientation = null,
146-
xaxis: AxisReference = null,
147-
yaxis: AxisReference = null,
148-
error_y: Error = null,
149-
showlegend: JBoolean = null
160+
x: Sequence,
161+
y: Sequence,
162+
name: String = null,
163+
text: Seq[String] = null,
164+
marker: Marker = null,
165+
orientation: Orientation = null,
166+
xaxis: AxisReference = null,
167+
yaxis: AxisReference = null,
168+
error_y: Error = null,
169+
showlegend: JBoolean = null,
170+
hoverinfo: HoverInfo = null,
171+
textposition: BarTextPosition = null,
172+
opacity: JDouble = null,
173+
width: OneOrSeq[Double] = null,
174+
base: OneOrSeq[Double] = null
150175
): Bar =
151176
Bar(
152177
x,
@@ -158,7 +183,12 @@ object Bar {
158183
Option(xaxis),
159184
Option(yaxis),
160185
Option(error_y),
161-
Option(showlegend).map(b => b: Boolean)
186+
Option(showlegend).map(b => b: Boolean),
187+
Option(hoverinfo),
188+
Option(textposition),
189+
Option(opacity).map(d => d: Double),
190+
Option(width),
191+
Option(base)
162192
)
163193
}
164194

@@ -171,20 +201,24 @@ case class Histogram(
171201
marker: Option[Marker],
172202
xbins: Option[Bins],
173203
histnorm: Option[HistNorm],
174-
showlegend: Option[Boolean]
204+
showlegend: Option[Boolean],
205+
cumulative: Option[Cumulative],
206+
histfunc: Option[HistFunc]
175207
) extends Trace
176208

177209
object Histogram {
178210
def apply(
179-
x: Sequence = null,
180-
y: Sequence = null,
181-
opacity: JDouble = null,
182-
name: String = null,
183-
autobinx: JBoolean = null,
184-
marker: Marker = null,
185-
xbins: Bins = null,
186-
histnorm: HistNorm = null,
187-
showlegend: JBoolean = null
211+
x: Sequence = null,
212+
y: Sequence = null,
213+
opacity: JDouble = null,
214+
name: String = null,
215+
autobinx: JBoolean = null,
216+
marker: Marker = null,
217+
xbins: Bins = null,
218+
histnorm: HistNorm = null,
219+
showlegend: JBoolean = null,
220+
cumulative: Cumulative = null,
221+
histfunc: HistFunc = null
188222
): Histogram =
189223
Histogram(
190224
Option(x),
@@ -195,6 +229,8 @@ object Histogram {
195229
Option(marker),
196230
Option(xbins),
197231
Option(histnorm),
198-
Option(showlegend) .map(b => b: Boolean)
232+
Option(showlegend) .map(b => b: Boolean),
233+
Option(cumulative),
234+
Option(histfunc)
199235
)
200236
}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
package plotly
2+
package element
3+
4+
sealed abstract class BarTextPosition(val label: String) extends Product with Serializable
5+
6+
object BarTextPosition {
7+
case object Inside extends BarTextPosition("inside")
8+
case object Outside extends BarTextPosition("outside")
9+
case object Auto extends BarTextPosition("auto")
10+
case object None extends BarTextPosition("none")
11+
}

core/shared/src/main/scala/plotly/element/Color.scala

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,11 @@ object Color {
1515
"grey",
1616
"white",
1717
"fuchsia",
18-
"red"
18+
"red",
19+
"blue",
20+
"cls", // ???
21+
"pink",
22+
"green"
1923
)
2024
}
2125

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
package plotly.element
2+
3+
final case class Cumulative(enabled: Boolean)

core/shared/src/main/scala/plotly/element/Fill.scala

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,11 @@ package element
44
sealed abstract class Fill(val label: String) extends Product with Serializable
55

66
object Fill {
7+
case object None extends Fill("none")
8+
case object ToZeroX extends Fill("tozerox")
79
case object ToZeroY extends Fill("tozeroy")
10+
case object ToNextX extends Fill("tonextx")
811
case object ToNextY extends Fill("tonexty")
12+
case object ToSelf extends Fill("toself")
13+
case object ToNext extends Fill("tonext")
914
}
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
package plotly.element
2+
3+
sealed abstract class GroupNorm(val label: String) extends Product with Serializable
4+
5+
object GroupNorm {
6+
case object Fraction extends GroupNorm("fraction")
7+
case object Percent extends GroupNorm("percent")
8+
}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
package plotly.element
2+
3+
sealed abstract class HistFunc(val label: String) extends Product with Serializable
4+
5+
object HistFunc {
6+
7+
case object Count extends HistFunc("count")
8+
case object Sum extends HistFunc("sum")
9+
case object Average extends HistFunc("avg")
10+
case object Min extends HistFunc("min")
11+
case object Max extends HistFunc("max")
12+
13+
}
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
package plotly.element
2+
3+
sealed abstract class HoverInfo extends Product with Serializable {
4+
def label: String
5+
}
6+
7+
object HoverInfo {
8+
9+
def all: HoverInfo = All
10+
def none: HoverInfo = None
11+
def skip: HoverInfo = Skip
12+
def apply(elements: Element*): HoverInfo =
13+
Combination(elements)
14+
15+
16+
sealed abstract class Element(override val label: String) extends HoverInfo
17+
18+
case object X extends Element("x")
19+
case object Y extends Element("y")
20+
case object Z extends Element("z")
21+
case object Text extends Element("text")
22+
case object Name extends Element("name")
23+
24+
25+
case object All extends HoverInfo {
26+
def label = "all"
27+
}
28+
val None = Combination(Nil)
29+
case object Skip extends HoverInfo {
30+
def label = "skip"
31+
}
32+
33+
final case class Combination(elements: Seq[Element]) extends HoverInfo {
34+
def label: String = elements.map(_.label).mkString("+")
35+
}
36+
37+
}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
package plotly.element
2+
3+
sealed abstract class HoverOn(val label: String) extends Product with Serializable
4+
5+
object HoverOn {
6+
case object Points extends HoverOn("points")
7+
case object Fills extends HoverOn("fills")
8+
case object PointsFill extends HoverOn("points+fills")
9+
}

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

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@ package layout
44
sealed abstract class BarMode(val label: String) extends Product with Serializable
55

66
object BarMode {
7-
case object Group extends BarMode("group")
8-
case object Stack extends BarMode("stack")
9-
case object Overlay extends BarMode("overlay")
7+
case object Group extends BarMode("group")
8+
case object Stack extends BarMode("stack")
9+
case object Overlay extends BarMode("overlay")
10+
case object Relative extends BarMode("relative")
1011
}

plotly-documentation

0 commit comments

Comments
 (0)