Two-dimensional bar charts.

Example

The dataset:

val sales = Map(
  "apple" -> 83.8,
  "banana" -> 77.9,
  "coconut" -> 10.1
)
// sales: scala.collection.immutable.Map[String,Double] = Map(apple -> 83.8, banana -> 77.9, coconut -> 10.1)

Define a bar chart visualization

import axle.visualize.BarChart
import axle.visualize.Color.lightGray
import spire.implicits.DoubleAlgebra
import cats.implicits._
val chart = BarChart[String, Double, Map[String, Double], String](
  () => sales,
  title = Some("fruit sales"),
  hoverOf = (c: String) => Some(c),
  linkOf = (c: String) => Some((new java.net.URL(s"http://wikipedia.org/wiki/$c"), lightGray))
)
// chart: axle.visualize.BarChart[String,Double,Map[String,Double],String] = BarChart(<function0>,true,700,600,50,0.8,20,50,80,Some(fruit sales),None,Courier New,12,Palatino,20,None,None,None,Some(UnittedQuantity(36.0,UnitOfMeasurement(degree,°,Some(http://en.wikipedia.org/wiki/Degree_(angle))))),<function1>,<function1>,<function1>)

Create the SVG

import axle.web._
svg(chart, "fruitsales.svg")