We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
指定了颜色后 每次刷新 扇区的颜色都会随机变化 看了下源码是因为 range map无序的原因导致的 建议Add方法增加一个数组key 来保证顺序
func (c *Pie) Add(name string, data map[string]interface{},keys []string, options ...seriesOptser) *Pie { nvs := make([]datatypes.NameValueItem, 0) if keys==nil{ keys= make([]string, 0) for k, _ := range data { keys = append(keys, k) } } for _, v := range keys { nvs = append(nvs, datatypes.NameValueItem{Name: v, Value: data[v]}) } series := singleSeries{Name: name, Type: ChartType.Pie, Data: nvs} series.setSingleSeriesOpts(options...) c.Series = append(c.Series, series) c.setColor(options...) return c }
The text was updated successfully, but these errors were encountered:
嗯,确实会出现你描述的问题,但新增参数看起来会破坏兼容性
Sorry, something went wrong.
v2 版本可以通过设置 Itemstyle 的 color 选项来设置颜色
No branches or pull requests
指定了颜色后 每次刷新 扇区的颜色都会随机变化 看了下源码是因为 range map无序的原因导致的
建议Add方法增加一个数组key 来保证顺序
func (c *Pie) Add(name string, data map[string]interface{},keys []string, options ...seriesOptser) *Pie {
nvs := make([]datatypes.NameValueItem, 0)
if keys==nil{
keys= make([]string, 0)
for k, _ := range data {
keys = append(keys, k)
}
}
for _, v := range keys {
nvs = append(nvs, datatypes.NameValueItem{Name: v, Value: data[v]})
}
series := singleSeries{Name: name, Type: ChartType.Pie, Data: nvs}
series.setSingleSeriesOpts(options...)
c.Series = append(c.Series, series)
c.setColor(options...)
return c
}
The text was updated successfully, but these errors were encountered: