Karasiq/scalajs-highcharts

using readme example

Closed this issue · 12 comments

Helle -
I have been following the Scala.js tutorial at http://www.scala-js.org/tutorial/basic/
I am now trying to include the scalajs-highcharts example in the TutorialApp.scala, unfortunately without success
Could you provide a more comprehensive example?

many thanks for this - could you provide the commands to compile or run this example? I am continuously failing...
UPDATE: figured it's a multi-project build and I need to do a project scalajs-highcharts-test after starting sbt and before compile/run
Remark: is there a way to terminate the Akka server? the command at the end of def startup() does not seem to terminate the process

    Runtime.getRuntime.addShutdownHook(new Thread(new Runnable {
      override def run(): Unit = {
        Await.result(actorSystem.terminate(), FiniteDuration(5, TimeUnit.MINUTES))
      }
    }))

Enter sbt scalajs-highcharts-test/run in console to run, then press Ctrl+C to terminate

thank you for the reply - I'm using a simple index.html without bootstrap to test the continuously recompiled JS libraries using ~fastOptJS in /test/frontend
another question: is it possible to combine different series types in the same chart? (e.g. column + spline as in http://jsfiddle.net/gh/get/jquery/1.9.1/highslide-software/highcharts.com/tree/master/samples/highcharts/demo/combo/)
I am getting the error "could not find implicit value for parameter" from mkSeries in HighchartsUtils.scala when trying the following:

override val series: SeriesCfg = mkSeries(
    new SeriesColumn {
      override val name: js.UndefOr[String] = "Adam"
      override val data: SeriesCfgData[SeriesColumnData] = js.Array[Double](3, 2, 1)
    },
    new SeriesSpline {
      override val name: js.UndefOr[String] = "Spline"
      override val data: SeriesCfgData[SeriesSplineData] = js.Array[Double](3, 3, 3)
    }
)
override val series: SeriesCfg = mkSeries(new SeriesColumn {
    override val name: js.UndefOr[String] = "Adam"
    override val data: SeriesCfgData[SeriesColumnData] = js.Array[Double](3, 2, 1)
  }).addSeries(new SeriesSpline {
    override val name: js.UndefOr[String] = "Spline"
    override val data: SeriesCfgData[SeriesSplineData] = js.Array[Double](3, 3, 3)
  })

perfect, many thanks! will keep experimenting...

BTW: do you have an example for a pie chart? the data series specification is slightly different from other types (bar, column, line), e.g. js.Array[Double] does not work:

from SeriesPie.scala
: val data: js.UndefOr[js.Array[CleanJsObject[SeriesPieData] | Double]] = js.undefined

from SeriesColumn.scala
: val data: js.UndefOr[js.Array[CleanJsObject[SeriesColumnData] | js.Array[js.Any] | Double]] = js.undefined

looking great - the private mkData method allows to have compressed syntax -
any clue how would I define the size (and center on canvas) of this 3D pie chart? (the type in SeriesPie.scala is js.UndefOr[String | Double])

override val size: UndefOr[String | Double] = UndefOr.any2undefOrA("30%")

Or

override val size: UndefOr[String | Double] = "30%".asInstanceOf[String | Double]

Or use implicit


Update: a3b9a3f

many thanks, this worked - I only had to import the pipe operator from scala.js, js.|
my last question would be: how can the pie chart be inserted into the column chart? see combo example
Update: I saw your push with the new combo chart type, many thanks for this!

See the demo page charts