I'm using scala.js (v0.6.13) with the Highcharts facade, and I have run into a roadblock trying to access some variables that I would normally access in javascript using 'this' and 'chart'. Here's an example:
coffeescript:
tooltip: {
enabled: true,
positioner: (labelWidth, labelHeight, point) ->
return { x: chart.plotWidth - labelWidth + chart.plotLeft, y: 17 }
formatter: () ->
x = this.x
point = this.points.find (p) -> x == p.x
...
My question is how do I access "this.x" and "chart.plotWidth" in my formatter and positioner functions in scala.js? Here's my scala code thus far:
override val tooltip: Cfg[Tooltip] = Tooltip(
formatter = { () =>
"what?"
}: js.Function0[String],
positioner = { (labelWidth: Any, labelHeight: Any, point: Object) =>
js.Dynamic.literal(
x = labelWidth,
y = 17)
}: js.Function3[Any, Any, Object, Object]
)
edit: chart pertains to a highchart chart.