~eliasnaur/gio

giocanvas/chart

Details
Message ID
<CAD1K+A+t+xNCyyLaA1hZAQLjtR+2GdtFw29Oe9sj=qtjG5pv=g@mail.gmail.com>
DKIM signature
pass
Download raw message
The giocanvas package now includes a charting package,
giocanvas/chart.  It supports line, area, scatter, and bar charts,
with titles and configurable axes.

The package reads data into a ChartBox structure (name, value pairs
(tab-separated) with metadata).

type ChartBox struct {
    Title                    string
    Data                     []NameValue
    Color                    color.RGBA
    Top, Bottom, Left, Right float64
    Minvalue, Maxvalue       float64
    Zerobased                bool
}

import (
    "github.com/ajstarks/giocanvas"
    "github.com/ajstarks/giocanvas/chart"
)

canvas := giocanvas.NewCanvas(...)
...
mychart, err := chart.DataRead(os.Stdin)
...
mychart.Top = 90
mychart.Left = 20
mychart.Bar(canvas, 0.2)
mychart.Scatter(canvas, 0.5)
mychart.Label(canvas, 1.5, 2)
mychart.YAxis(canvas, 1.5, 0,100,20,"%.1f",true)
Export thread (mbox)