mirror of
https://github.com/cuigh/swirl
synced 2024-12-28 14:51:57 +00:00
Fix missing labels of pie charts
This commit is contained in:
parent
ff06c6da12
commit
b040c82a09
24
biz/chart.go
24
biz/chart.go
@ -205,8 +205,7 @@ func (b *chartBiz) fetchMatrixData(chart *model.Chart, key string, start, end ti
|
||||
return nil, err
|
||||
}
|
||||
|
||||
d, err := Metric.GetMatrix(q, m.Legend, start, end)
|
||||
if err != nil {
|
||||
if d, err := Metric.GetMatrix(q, m.Legend, start, end); err != nil {
|
||||
log.Get("metric").Error(err)
|
||||
} else if i == 0 {
|
||||
cmd = d
|
||||
@ -219,12 +218,23 @@ func (b *chartBiz) fetchMatrixData(chart *model.Chart, key string, start, end ti
|
||||
}
|
||||
|
||||
func (b *chartBiz) fetchVectorData(chart *model.Chart, key string, end time.Time) (*model.ChartVectorData, error) {
|
||||
query, err := b.formatQuery(chart.Metrics[0].Query, chart.Dashboard, key)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
var cvd *model.ChartVectorData
|
||||
for i, m := range chart.Metrics {
|
||||
query, err := b.formatQuery(m.Query, chart.Dashboard, key)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return Metric.GetVector(query, chart.Legend, end)
|
||||
if d, err := Metric.GetVector(query, m.Legend, end); err != nil {
|
||||
log.Get("metric").Error(err)
|
||||
} else if i == 0 {
|
||||
cvd = d
|
||||
} else {
|
||||
cvd.Legend = append(cvd.Legend, d.Legend...)
|
||||
cvd.Data = append(cvd.Data, d.Data...)
|
||||
}
|
||||
}
|
||||
return cvd, nil
|
||||
}
|
||||
|
||||
func (b *chartBiz) fetchScalarData(chart *model.Chart, key string, end time.Time) (*model.ChartValue, error) {
|
||||
|
Loading…
Reference in New Issue
Block a user