Error showing data with Spark Highcharts

2019-09-16 14:57发布

I'm having error trying to show graphical view of a csv data with spark-highcharts.

Complete stacktrace of the error:

Paragraph 1:

import org.apache.commons.io.IOUtils
import java.nio.charset.Charset
import com.knockdata.spark.highcharts._
import com.knockdata.spark.highcharts.model._


import org.apache.commons.io.IOUtils
import java.nio.charset.Charset
import com.knockdata.spark.highcharts._
import com.knockdata.spark.highcharts.model._
FINISHED
Took 2 sec. Last updated by anonymous at January 30 2017, 7:55:31 AM.

Paragraph 2:

val mydataRDD = sc.textFile("/tmp/ClusteringExample.csv")

Paragraph 3:

case class DataObj(id: String,variableX: Double, variableY:Integer,cluster: Integer)

defined class DataObj
FINISHED
Took 4 sec. Last updated by anonymous at January 30 2017, 7:55:51 AM.

Paragraph 4:

val dataobj = mydataRDD.map(s => s.split(",")).filter(s => s(0) != "id").map(
    s => DataObj(s(0),
            s(1).toDouble,
            s(2).toInt,
            s(3).toInt   
        )
).toDF()

dataobj: org.apache.spark.sql.DataFrame = [cliente_id: string, cliente_entropia_supermercado: double ... 3 more fields]
FINISHED
Took 5 sec. Last updated by anonymous at January 30 2017, 7:55:56 AM.

Paragraph 5:

highcharts(dataobj.series("name" -> "variableX", "y" -> avg($"variableY")).orderBy($"variableX")).
  xAxis(new XAxis("variableX").typ("category")).
  chart(Chart.area).
  plot()



Took 1 min 1 sec. Last updated by anonymous at January 30 2017, 7:58:59 AM.

As you can see, the last sentence works well, it looks like the process y working because it takes more than one minute to finish, but the browser console, shows the following and the graphic is missing:

jQuery.Deferred exception: $(...).highcharts is not a function @http://10.32.8.181:8080/#/notebook/2CACZ74UU:726750:1
f/</l@http://10.32.8.181:8080/scripts/vendor.f686b78964de6852.js:29:25192
f/</m<@http://10.32.8.181:8080/scripts/vendor.f686b78964de6852.js:29:25509
 undefined vendor.f686b78964de6852.js:29:26787
TypeError: $(...).highcharts is not a function
<anónimo>
 10.32.8.181:8080:726750
f/</l()
 vendor.f686b78964de6852.js:29
f/</m<()
 vendor.f686b78964de6852.js:29
 10.32.8.181:8080:726750:1

The paragraph also reservate space for showing results, but is a white space.

0条回答
登录 后发表回答