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.
111 lines
1.3 KiB
111 lines
1.3 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,
|
|
},
|
|
{
|
|
820,
|
|
932,
|
|
901,
|
|
934,
|
|
1290,
|
|
1330,
|
|
1320,
|
|
},
|
|
}
|
|
p, err := charts.LineRender(
|
|
values,
|
|
//charts.SVGTypeOption(),
|
|
charts.ThemeOptionFunc(charts.ThemeGrafana),
|
|
charts.WidthOptionFunc(1080),
|
|
charts.HeightOptionFunc(1920),
|
|
charts.TitleTextOptionFunc("Line"),
|
|
charts.XAxisDataOptionFunc([]string{
|
|
"Mon",
|
|
"Tue",
|
|
"Wed",
|
|
"Thu",
|
|
"Fri",
|
|
"Sat",
|
|
"Sun",
|
|
}),
|
|
charts.LegendLabelsOptionFunc([]string{
|
|
"Email",
|
|
"Union Ads",
|
|
"Video Ads",
|
|
"Direct",
|
|
"Search Engine",
|
|
}, "50"),
|
|
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)
|
|
}
|
|
}
|