You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
101 lines
1.2 KiB
101 lines
1.2 KiB
package goCharts
|
|
|
|
/*
|
|
*
|
|
@author: sre
|
|
@date: 2022/9/17 0017
|
|
@desc: todo
|
|
*
|
|
*/
|
|
|
|
import (
|
|
"github.com/vicanso/go-charts/v2"
|
|
)
|
|
|
|
func Draw() {
|
|
values := [][]float64{
|
|
{
|
|
120,
|
|
132,
|
|
101,
|
|
// 134,
|
|
//charts.GetNullValue(),
|
|
134,
|
|
90,
|
|
230,
|
|
210,
|
|
},
|
|
{
|
|
220,
|
|
182,
|
|
191,
|
|
234,
|
|
290,
|
|
330,
|
|
310,
|
|
},
|
|
{
|
|
150,
|
|
232,
|
|
201,
|
|
154,
|
|
190,
|
|
330,
|
|
410,
|
|
},
|
|
{
|
|
320,
|
|
332,
|
|
301,
|
|
334,
|
|
390,
|
|
330,
|
|
320,
|
|
},
|
|
}
|
|
p, err := charts.LineRender(
|
|
values,
|
|
//charts.SVGTypeOption(),
|
|
charts.ThemeOptionFunc(charts.ThemeGrafana),
|
|
charts.WidthOptionFunc(720),
|
|
charts.HeightOptionFunc(1280),
|
|
charts.TitleTextOptionFunc("symbol price"),
|
|
charts.XAxisDataOptionFunc([]string{
|
|
"Mon",
|
|
"Tue",
|
|
"Wed",
|
|
"Thu",
|
|
"Fri",
|
|
"Sat",
|
|
"Sun",
|
|
}),
|
|
charts.LegendLabelsOptionFunc([]string{
|
|
"BTC",
|
|
"ETH",
|
|
"BNB",
|
|
"TRX",
|
|
}, "150"),
|
|
func(opt *charts.ChartOption) {
|
|
opt.Legend.Padding = charts.Box{
|
|
Top: 5,
|
|
Bottom: 10,
|
|
}
|
|
opt.SymbolShow = charts.FalseFlag()
|
|
opt.LineStrokeWidth = 1
|
|
},
|
|
)
|
|
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
|
|
buf, err := p.Bytes()
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
err = writeFile(buf)
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
}
|