lightning-viz/lightning-scala

Readme instructions

Closed this issue · 2 comments

Hello! I downloaded lightning and started a server locally, and then downloaded lightning-scala and ran sbt assembly.

I tried including the jar in the class path per the readme, but then was unable to find org.viz:

austin:lightning-scala austin$ scala -classpath scala-lightning/target/scala-2.10/lightning-scala-assembly-0.1.0.jar
Welcome to Scala version 2.10.3 (Java HotSpot(TM) 64-Bit Server VM, Java 1.7.0_25).
Type in expressions to have them evaluated.
Type :help for more information.

scala> import org.viz.lightning.Lightning
<console>:7: error: object viz is not a member of package org
       import org.viz.lightning.Lightning
                  ^

scala>

I started an sbt console from lightning-scala root, and was able to run the commands. Trying the two examples gave me casting exceptions:

scala> lgn.line(Array(1,1,2,3,9,20))
java.lang.ClassCastException: [I cannot be cast to [D
    at org.viz.lightning.types.Plots$$anonfun$1.apply(Plots.scala:10)
    at org.viz.lightning.types.utils.Cleaner.apply(Cleaner.scala:8)
    at org.viz.lightning.Lightning.applyDynamic(Lightning.scala:98)

and

scala> lgn.scatter(Array(0.1,0.2,0.3), Array(0.9,0.1,0.5))
java.lang.ClassCastException: scala.Tuple2 cannot be cast to scala.Tuple4
    at org.viz.lightning.types.Plots$$anonfun$2.apply(Plots.scala:23)
    at org.viz.lightning.types.utils.Cleaner.apply(Cleaner.scala:8)
    at org.viz.lightning.Lightning.applyDynamic(Lightning.scala:98)

I was able to create a line with an array of type double:

scala> lgn.line(Array(1d,2d,4d))
res7: org.viz.lightning.Visualization = org.viz.lightning.Visualization@711f6aec

and see it in browser :)

Thanks for being an early tester! This is a WIP but glad to see it's at least partially working for you. I think I just fixed everything you caught:

  • the problem including the jar was just a typo in how the path was specified, as written in the Readme it should now work
  • the casting errors were due to a new feature I added last night without sufficient testing for including extra plot arguments, it should now be working again exactly as described in the Readme

I did same thing as AustinBGibbons did. I downloaded lightning server and started a server locally, and then downloaded lightning-scala and ran sbt assembly. It resulted in errors like this. Not sure where I am going wrong. Please let me know. Thanks in advance.


Sudhakars-MacBook-Pro-2:Downloads sudhakarthota$ cd /Users/sudhakarthota/lightning/lightning-scala
Sudhakars-MacBook-Pro-2:lightning-scala sudhakarthota$ sbt assembly
[info] Loading global plugins from /Users/sudhakarthota/.sbt/0.13/plugins
[info] Loading project definition from /Users/sudhakarthota/lightning/lightning-scala/project
[info] Set current project to lightning-scala (in build file:/Users/sudhakarthota/lightning/lightning-scala/)
[info] Including from cache: paranamer-2.6.jar
[info] Including from cache: json4s-native_2.10-3.2.9.jar
[info] Including from cache: scalaj-http_2.10-1.1.4.jar
[info] Including from cache: json4s-ast_2.10-3.2.9.jar
[info] Including from cache: json4s-core_2.10-3.2.9.jar
[info] Including from cache: scalap-2.10.0.jar
[info] Including from cache: scala-reflect-2.10.4.jar
[info] Including from cache: scala-library-2.10.4.jar
[info] Including from cache: scalatest_2.10-2.2.1.jar
[info] Including from cache: scala-compiler-2.10.0.jar
[info] LightningThreeSuite:
[info] Exception encountered when attempting to run a suite with class name: org.viz.lightning.LightningThreeSuite *** ABORTED ***
[info] org.json4s.package$MappingException: Do not know how to convert JString(1226f61f-a215-4541-ac14-71f200618224) into int
[info] at org.json4s.Extraction$.convert(Extraction.scala:559)
[info] at org.json4s.Extraction$.extract(Extraction.scala:331)
[info] at org.json4s.Extraction$.extract(Extraction.scala:42)
[info] at org.json4s.ExtractableJsonAstNode.extract(ExtractableJsonAstNode.scala:21)
[info] at org.viz.lightning.Lightning.post(Lightning.scala:88)
[info] at org.viz.lightning.Lightning.createSession(Lightning.scala:29)
[info] at org.viz.lightning.LightningThreeSuite.beforeAll(LightningThreeSuite.scala:12)
[info] at org.scalatest.BeforeAndAfterAll$class.beforeAll(BeforeAndAfterAll.scala:187)
[info] at org.viz.lightning.LightningThreeSuite.beforeAll(LightningThreeSuite.scala:6)
[info] at org.scalatest.BeforeAndAfterAll$class.run(BeforeAndAfterAll.scala:253)
[info] ...
[info] LightningPlotsSuite:
[info] Exception encountered when attempting to run a suite with class name: org.viz.lightning.LightningPlotsSuite *** ABORTED ***
[info] org.json4s.package$MappingException: Do not know how to convert JString(8e69edd8-a76c-4142-8abc-fc7b64fd9840) into int

[info] at org.json4s.Extraction$.convert(Extraction.scala:559)