Last active
February 1, 2020 15:09
-
-
Save simerplaha/0e7757da96b10ea7b50669a078a3a92a to your computer and use it in GitHub Desktop.
Dynamic facade/access to Highcharts's API from Scala.js
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@JSGlobal | |
@js.native | |
object Highcharts extends js.Object { | |
def chart(id: String, data: js.Object): js.Any = scalajs.js.native | |
} | |
//See - https://www.highcharts.com/docs/getting-started/your-first-chart | |
Highcharts.chart( | |
id = "chart", | |
data = | |
js.Dynamic.literal( | |
chart = | |
js.Dynamic.literal( | |
`type` = "column" | |
), | |
title = | |
js.Dynamic.literal( | |
text = "Fruit Consumption" | |
), | |
xAxis = | |
js.Dynamic.literal( | |
categories = js.Array("Apples", "Bananas", "Oranges") | |
), | |
yAxis = | |
js.Dynamic.literal( | |
title = | |
js.Dynamic.literal( | |
text = "Fruit eaten" | |
) | |
), | |
series = | |
js.Array( | |
js.Dynamic.literal( | |
name = "Jane", | |
data = js.Array(1, 0, 4) | |
), | |
js.Dynamic.literal( | |
name = "John", | |
data = js.Array(5, 7, 3) | |
) | |
) | |
) | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment