Open lyphper opened 4 months ago
调用charts.PieRender方法生成扇形图,怎么自定义各个扇面的颜色,以下是生成扇面图的代码:
assert := assert.New(t) values := []float64{ 1048, 735, 580, 484, 300, } p, err := PieRender( values, SVGTypeOption(), TitleOptionFunc(TitleOption{ Text: "Rainfall vs Evaporation", Subtext: "Fake Data", Left: PositionCenter, }), PaddingOptionFunc(Box{ Top: 20, Right: 20, Bottom: 20, Left: 20, }), LegendOptionFunc(LegendOption{ Orient: OrientVertical, Data: []string{ "Search Engine", "Direct", "Email", "Union Ads", "Video Ads", }, Left: PositionLeft, }), PieSeriesShowLabel(), )
可以先添加自定义的主题配色,再指定使用该主题。 https://github.com/vicanso/go-charts/blob/main/theme.go#L182
调用charts.PieRender方法生成扇形图,怎么自定义各个扇面的颜色,以下是生成扇面图的代码: