Easy html charts with go
Go
Latest commit adf3e54 May 8, 2014 @agonopol Merge pull request #4 from tragiclifestories/patch-1
Update README.md
Permalink
Failed to load latest commit information.
examples added example image May 2, 2014
.gitignore rename Visualize to Chart May 2, 2014
LICENSE Initial commit May 2, 2014
README.md Update README.md May 8, 2014
gosplat.go added some docs May 2, 2014
template.html.go Created May 2, 2014

README.md

gosplat

Easily generate HTML/Javascript graphs in go with dygraphs/googlecharts etc...

gosplat generates an HTML file with Javascript embedded in the page to plot the data.

More documentation about google charts: https://developers.google.com/chart/

Installation:

go get github.com/agonopol/gosplat

Import:

import "github.com/agonopol/gosplat"

Example:

func Linechart() {
    //Create a frame to put charts in
    f := gosplat.NewFrame("Linechart Example Frame")

    //Create a chart
    v := gosplat.NewChart()

    //Add some random data
    v.Append(map[string]interface{}{"date": "2011/07/23", "thing": 10, "thong": 20, "whatevs": 14})
    v.Append(map[string]interface{}{"date": "2011/07/24", "thing": 12, "thong": 24, "whatevs": 24})
    v.Append(map[string]interface{}{"date": "2011/07/24", "thing": 12, "thong": 7, "whatevs": 11})

    //Add the chart to the Frame
    f.Append("Linechart Example", v.Linechart())

    //Preview generates a tmp html file and opens it with the default browser
    err := f.Preview()
    if err != nil {
        panic(err)
    }

    //Html returns bytes.Buffer of the html
    buffer, err := f.Html()
    if err != nil {
        panic(err)
    }
    println(buffer.String())
}

Supported Charts:

  • barchart
  • candlestick
  • columnchart
  • combochart
  • linechart
  • piechart
  • scatter
  • table
  • timeseries