diff options
Diffstat (limited to 'examples/scalajs-plain-example/js/App.scala')
-rw-r--r-- | examples/scalajs-plain-example/js/App.scala | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/examples/scalajs-plain-example/js/App.scala b/examples/scalajs-plain-example/js/App.scala new file mode 100644 index 0000000..71a285e --- /dev/null +++ b/examples/scalajs-plain-example/js/App.scala @@ -0,0 +1,27 @@ +package prototype + +import org.scalajs.dom + +import scala.scalajs.js +import scala.scalajs.js.JSON +import scala.scalajs.js.JSApp +import scala.scalajs.js.annotation.JSExport + +@JSExport("App") +object App extends JSApp { + def main(): Unit = { + val trace1 = """{ + | "x": [1, 2, 3, 4], + | "y": [10, 15, 13, 17], + | "type": "scatter" + |} """.stripMargin + val trace2 = """{ + | "x": [1, 2, 3, 4], + | "y": [16, 5, 11, 9], + | "type": "scatter" + |} """.stripMargin + val data = js.Array(trace1, trace2).map(trace => JSON.parse(trace)) + val doc = dom.document + Plotly.newPlot("plotly", data) + } +} |