vegas-viz / Vegas

The missing MatPlotLib for Scala + Spark
MIT License
730 stars 98 forks source link

I getting "ArrayBuffer(ReferenceError: Can't find variable: vg)" #163

Open SashkoTar opened 6 years ago

SashkoTar commented 6 years ago

I run quite simple flow Vegas("Country Pop"). withData( Seq( Map("country" -> "USA", "population" -> 314), Map("country" -> "UK", "population" -> 64), Map("country" -> "DK", "population" -> 80) ) ). encodeX("country", Nom). encodeY("population", Quant). mark(Bar).show

but I get blank window for graph and message "ArrayBuffer(ReferenceError: Can't find variable: vg)"

I use version 0.3.11
Could you please let me know where I can start fixing from?

oshikiri commented 6 years ago

@SashkoTar There seems to be an error in generated HTML.

Could you please check the output of println(plot.html.pageHTML())?

scala> import vegas._
import vegas._

scala> 

scala> val plot = Vegas("Country Pop").
     |   withData(
     |     Seq(
     |       Map("country" -> "USA", "population" -> 314),
     |       Map("country" -> "UK", "population" -> 64),
     |       Map("country" -> "DK", "population" -> 80)
     |     )
     |   ).
     |   encodeX("country", Nom).
     |   encodeY("population", Quant).
     |   mark(Bar)
plot: vegas.DSL.ExtendedUnitSpecBuilder = ExtendedUnitSpecBuilder(...

scala> println(plot.html.pageHTML())
<html>
  <head>
    <script src="https://cdn.jsdelivr.net/webjars/org.webjars.bower/d3/3.5.17/d3.min.js" charset="utf-8"></script>
...
    </body>
</html>

scala>