|
@@ -196,7 +196,7 @@ func GetChartEdbInfoFormat(chartInfoId int, edbInfoMappingA, edbInfoMappingB *mo
|
|
|
}
|
|
|
|
|
|
// GetChartDataByEdbInfo 相关性图表-根据指标信息获取x轴和y轴
|
|
|
-func GetChartDataByEdbInfo(edbInfoMappingA, edbInfoMappingB *models.ChartEdbInfoMapping, leadValue int, leadUnit, startDate, endDate string) (xEdbIdValue []int, yDataList []models.YData, err error) {
|
|
|
+func GetChartDataByEdbInfo(edbInfoMappingA, edbInfoMappingB *models.ChartEdbInfoMapping, leadValue int, leadUnit, startDate, endDate, extraConfig string) (xEdbIdValue []int, yDataList []models.YData, err error) {
|
|
|
xData := make([]int, 0)
|
|
|
yData := make([]float64, 0)
|
|
|
if leadValue == 0 {
|
|
@@ -372,13 +372,30 @@ func GetChartDataByEdbInfo(edbInfoMappingA, edbInfoMappingB *models.ChartEdbInfo
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ // 图例
|
|
|
+ var extra data_manage.CorrelationChartInfoExtraConfig
|
|
|
+ legend := new(data_manage.CorrelationChartLegend)
|
|
|
+ if extraConfig != "" {
|
|
|
+ if e := json.Unmarshal([]byte(extraConfig), &extra); e != nil {
|
|
|
+ err = fmt.Errorf("图例解析异常, err: %v", e)
|
|
|
+ return
|
|
|
+ }
|
|
|
+ if len(extra.LegendConfig) > 0 {
|
|
|
+ legend = extra.LegendConfig[0]
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
xEdbIdValue = xData
|
|
|
yDataList = make([]models.YData, 0)
|
|
|
yDate := "0000-00-00"
|
|
|
- yDataList = append(yDataList, models.YData{
|
|
|
- Date: yDate,
|
|
|
- Value: yData,
|
|
|
- })
|
|
|
+ var y models.YData
|
|
|
+ y.Date = yDate
|
|
|
+ y.Value = yData
|
|
|
+ if legend != nil {
|
|
|
+ y.Name = legend.LegendName
|
|
|
+ y.Color = legend.Color
|
|
|
+ }
|
|
|
+ yDataList = append(yDataList, y)
|
|
|
return
|
|
|
}
|
|
|
|