switching to generators

This commit is contained in:
Will Charczuk 2019-09-09 21:02:48 -07:00
parent 2d5aeaf824
commit 45fad0cfb8
94 changed files with 402 additions and 691 deletions

View file

@ -0,0 +1,53 @@
package main
import (
"os"
"github.com/wcharczuk/go-chart"
)
func main() {
sbc := chart.StackedBarChart{
Title: "Test Stacked Bar Chart",
Background: chart.Style{
Padding: chart.Box{
Top: 40,
},
},
Height: 512,
Bars: []chart.StackedBar{
{
Name: "This is a very long string to test word break wrapping.",
Values: []chart.Value{
{Value: 5, Label: "Blue"},
{Value: 5, Label: "Green"},
{Value: 4, Label: "Gray"},
{Value: 3, Label: "Orange"},
{Value: 3, Label: "Test"},
{Value: 2, Label: "??"},
{Value: 1, Label: "!!"},
},
},
{
Name: "Test",
Values: []chart.Value{
{Value: 10, Label: "Blue"},
{Value: 5, Label: "Green"},
{Value: 1, Label: "Gray"},
},
},
{
Name: "Test 2",
Values: []chart.Value{
{Value: 10, Label: "Blue"},
{Value: 6, Label: "Green"},
{Value: 4, Label: "Gray"},
},
},
},
}
f, _ := os.Create("output.png")
defer f.Close()
sbc.Render(chart.PNG, f)
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB