refactor: update examples
This commit is contained in:
parent
2316689ce5
commit
1258262f2c
4 changed files with 65 additions and 54 deletions
38
README.md
38
README.md
|
|
@ -49,12 +49,25 @@ func writeFile(file string, buf []byte) error {
|
|||
}
|
||||
|
||||
func chartsRender() ([]byte, error) {
|
||||
d, err := charts.Render(charts.ChartOption{
|
||||
Type: charts.ChartOutputPNG,
|
||||
Title: charts.TitleOption{
|
||||
Text: "Line",
|
||||
d, err := charts.LineRender([][]float64{
|
||||
{
|
||||
150,
|
||||
230,
|
||||
224,
|
||||
218,
|
||||
135,
|
||||
147,
|
||||
260,
|
||||
},
|
||||
XAxis: charts.NewXAxisOption([]string{
|
||||
},
|
||||
// output type
|
||||
charts.PNGTypeOption(),
|
||||
// title
|
||||
charts.TitleOptionFunc(charts.TitleOption{
|
||||
Text: "Line",
|
||||
}),
|
||||
// x axis
|
||||
charts.XAxisOptionFunc(charts.NewXAxisOption([]string{
|
||||
"Mon",
|
||||
"Tue",
|
||||
"Wed",
|
||||
|
|
@ -62,19 +75,8 @@ func chartsRender() ([]byte, error) {
|
|||
"Fri",
|
||||
"Sat",
|
||||
"Sun",
|
||||
}),
|
||||
SeriesList: charts.SeriesList{
|
||||
charts.NewSeriesFromValues([]float64{
|
||||
150,
|
||||
230,
|
||||
224,
|
||||
218,
|
||||
135,
|
||||
147,
|
||||
260,
|
||||
}),
|
||||
},
|
||||
})
|
||||
})),
|
||||
)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue