Skip to content

Commit 22e3107

Browse files
add Image trace support
1 parent 93faa78 commit 22e3107

File tree

7 files changed

+61
-5
lines changed

7 files changed

+61
-5
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
target/
22
.bsp/
3+
.idea

README.md

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,10 @@ It is published for both scala 2.12 and 2.13.
2828

2929
### From almond
3030

31-
Add the `org.plotly-scala::plotly-almond:0.8.0` dependency to the notebook. (Latest version: [![Maven Central](https://img.shields.io/maven-central/v/org.plotly-scala/plotly-render_2.13.svg)](https://maven-badges.herokuapp.com/maven-central/org.plotly-scala/plotly-render_2.13))
31+
Add the `org.plotly-scala::plotly-almond:0.8.1` dependency to the notebook. (Latest version: [![Maven Central](https://img.shields.io/maven-central/v/org.plotly-scala/plotly-render_2.13.svg)](https://maven-badges.herokuapp.com/maven-central/org.plotly-scala/plotly-render_2.13))
3232
Then initialize plotly-scala, and use it, like
3333
```scala
34-
import $ivy.`org.plotly-scala::plotly-almond:0.8.0`
34+
import $ivy.`org.plotly-scala::plotly-almond:0.8.1`
3535

3636
import plotly._
3737
import plotly.element._
@@ -57,7 +57,7 @@ jupyter labextension install @jupyterlab/plotly-extension
5757

5858
Add the corresponding dependency to your project, like
5959
```scala
60-
libraryDependencies += "org.plotly-scala" %%% "plotly-render" % "0.8.0"
60+
libraryDependencies += "org.plotly-scala" %%% "plotly-render" % "0.8.1"
6161
```
6262
(Latest version: [![Maven Central](https://img.shields.io/maven-central/v/org.plotly-scala/plotly-render_2.13.svg)](https://maven-badges.herokuapp.com/maven-central/org.plotly-scala/plotly-render_2.13))
6363

@@ -93,7 +93,7 @@ plot.plot(
9393

9494
Load the corresponding dependency, and some imports, like
9595
```scala
96-
import $ivy.`org.plotly-scala::plotly-render:0.8.0`
96+
import $ivy.`org.plotly-scala::plotly-render:0.8.1`
9797
import plotly._, element._, layout._, Plotly._
9898
```
9999

@@ -137,7 +137,8 @@ plotly-scala supports the features illustrated in the following sections of the
137137
- [Subplots](https://plot.ly/javascript/subplots/),
138138
- [Multiple Axes](https://plot.ly/javascript/multiple-axes/),
139139
- [Histograms](https://plot.ly/javascript/histograms/),
140-
- [Log Plots](https://plot.ly/javascript/log-plot/).
140+
- [Log Plots](https://plot.ly/javascript/log-plot/),
141+
- [Image](https://plotly.com/javascript/reference/image/).
141142

142143
Some of these are illustrated in the [demo](https://alexarchambault.github.io/plotly-scala/) page.
143144

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

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,29 @@ object Box {
152152
)
153153
}
154154

155+
@data(optionSetters = true) class Image(
156+
name: Option[String] = None,
157+
text: Option[Seq[String]] = None,
158+
opacity: Option[Double] = None,
159+
ids: Option[Seq[String]] = None,
160+
x0: Option[Element] = None,
161+
dx: Option[Double] = None,
162+
y0: Option[Element] = None,
163+
dy: Option[Double] = None,
164+
z: Seq[Seq[Seq[Int]]],
165+
source: Option[String] = None,
166+
hoverinfo: Option[HoverInfo] = None,
167+
hovertemplate: Option[Seq[String]] = None,
168+
meta: Option[String] = None,
169+
customdata: Option[Seq[String]] = None,
170+
xaxis: Option[AxisReference] = None,
171+
yaxis: Option[AxisReference] = None,
172+
colormodel: Option[String] = None,
173+
zmax: Option[Seq[Int]] = None,
174+
zmin: Option[Seq[Int]] = None,
175+
hoverlabel: Option[HoverLabel] = None
176+
) extends Trace
177+
155178
@data(optionSetters = true) class Bar(
156179
x: Sequence,
157180
y: Sequence,
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 Alignment(val label: String) extends Product with Serializable
4+
5+
object Alignment {
6+
case object Left extends Alignment("left")
7+
case object Right extends Alignment("right")
8+
case object Auto extends Alignment("auto")
9+
}

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ object HoverInfo {
2020
case object Z extends Element("z")
2121
case object Text extends Element("text")
2222
case object Name extends Element("name")
23+
case object Color extends Element("color")
2324

2425

2526
case object All extends HoverInfo {
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
package plotly.element
2+
3+
import dataclass.data
4+
5+
@data(optionSetters = true) class HoverLabel(
6+
bgcolor: Option[OneOrSeq[Color]] = None,
7+
bordercolor: Option[OneOrSeq[Color]] = None,
8+
font: Option[HoverLabelFont] = None,
9+
align: Option[OneOrSeq[Alignment]] = None,
10+
namelength: Option[OneOrSeq[Int]] = None,
11+
uirevision: Option[Element] = None
12+
)
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
package plotly.element
2+
3+
import dataclass.data
4+
5+
@data(optionSetters = true) class HoverLabelFont(
6+
family: Option[OneOrSeq[String]] = None,
7+
size: Option[OneOrSeq[Double]] = None,
8+
color: Option[OneOrSeq[Color]] = None
9+
)

0 commit comments

Comments
 (0)