Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions src/main/scala/org/viz/lightning/Lightning.scala
Original file line number Diff line number Diff line change
Expand Up @@ -96,9 +96,7 @@ class Lightning (var host: String) extends Plots with Three with Linked {

val blob = Map("data" -> data, "type" -> name)
val payload = Serialization.write(blob)

post(url, payload, method)

}

}
Expand Down
11 changes: 10 additions & 1 deletion src/main/scala/org/viz/lightning/Visualization.scala
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
package org.viz.lightning

import org.json4s.DefaultFormats
import org.json4s.native.Serialization
import scala.language.dynamics

import scalaj.http._

class Visualization(val lgn: Lightning, val id: Int, val name: String) {
Expand Down Expand Up @@ -50,4 +51,12 @@ class Visualization(val lgn: Lightning, val id: Int, val name: String) {
request.asString.body
}

def appendData(data : Array[Array[Double]]) : Int = {
val url = lgn.host + "/sessions/" + lgn.session + "/visualizations/" + this.id + "/data/"
implicit val formats = DefaultFormats
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you forgot to include the imports here, and also two lines below

val blob = Map("data" -> Map("series" -> data.toList))
val payload = Serialization.write(blob)
lgn.post(url, payload)
}

}
21 changes: 21 additions & 0 deletions src/main/scala/org/viz/lightning/types/Plots.scala
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,27 @@ trait Plots extends Base {

}

/**
* One or more one-dimensional series data streamed as lines.
*/
def lineStreaming(series: Array[Array[Double]],
size: Array[Double],
color: Array[Array[Double]] = Array[Array[Double]](),
alpha: Array[Double] = Array[Double] (),
label: Array[Int] = Array[Int](),
xaxis: String = "",
yaxis: String = ""): Visualization = {

val data = Map("series" -> series.toList, "color" -> color.toList)

val settings = new Settings()
.append(List(Label(label), Size(size), Alpha(alpha)))
.append(List(Axis(xaxis, "xaxis"), Axis(yaxis, "yaxis")))

plot("line-streaming", data ++ settings.toMap)

}

/**
* Force-directed network from connectivity.
*/
Expand Down