/geckoboard-scala

Geckoboard API for Scala

Primary LanguageScalaApache License 2.0Apache-2.0

Geckoboard Scala API

geckoboard-scala is a small set of case classes that make constructing the JSON output for Geckoboard easier and more type safe. It has been tested with lift-json as the JSON serializer but should be usable with other JSON libraries that support case class serialization. It is also not tied to any particular web framework. Scalatra with Lift-JSON is recommended.

Suggested Usage

import net.liftweb.json._
import JsonDSL._

import org.zeroturnaround.geckoboard._

object MyAPI {
  // implicitly convert all case classes to JSON
  private implicit def product2json(obj: Product) = Extraction.decompose(obj)(DefaultFormats)

  def myPieChart: JValue = {
    val values: List[(Long, String)] = ... acquire values ...
    PieChart(for ((value, label) <- values) yield LabelValue(value, label, colour = Some("ffffff")))
  }

}

Building

Build with Maven. Or just copy the source code into your own project.

Geckoboard Widgets and Charts covered by the API

  • Custom Widgets
    • Map (Mapping)
    • Number & Secondary Stat (NumberAndSecondaryStat)
    • RAG Column & Numbers (RAGNumbers)
    • RAG Numbers (RAGNumbers)
    • Text (Text)
  • Custom Charts
    • Pie chart (PieChart)
    • Line chart (LineChart)
    • Geck-O-Meter (GeckOMeter)
    • Funnel chart (Funnel)
    • Other charts might be added later