|
@@ -2,6 +2,7 @@ package data_manage
|
|
|
|
|
|
import (
|
|
|
"encoding/json"
|
|
|
+ "errors"
|
|
|
"eta/eta_api/controllers"
|
|
|
"eta/eta_api/models"
|
|
|
"eta/eta_api/models/data_manage"
|
|
@@ -1370,6 +1371,8 @@ func (this *ChartInfoController) PreviewChartInfoDetail() {
|
|
|
extraConfigStr = chartInfo.BarConfig
|
|
|
} else if chartInfo != nil && chartInfo.ChartType == utils.CHART_TYPE_SECTION_COMBINE {
|
|
|
extraConfigStr = req.ExtraConfig
|
|
|
+ } else if chartInfo != nil && chartInfo.ChartType == utils.CHART_TYPE_AREA {
|
|
|
+ extraConfigStr = req.ExtraConfig
|
|
|
}
|
|
|
|
|
|
// 获取图表中的指标数据
|
|
@@ -1397,6 +1400,11 @@ func (this *ChartInfoController) PreviewChartInfoDetail() {
|
|
|
chartInfo.WarnMsg = `图表引用指标异常,异常指标:` + strings.Join(warnEdbList, ",")
|
|
|
}
|
|
|
|
|
|
+ // 面积图 面积堆积 数据处理
|
|
|
+ if req.ChartType == utils.CHART_TYPE_AREA {
|
|
|
+ fillAreaGraphData(extraConfigStr, edbList)
|
|
|
+ }
|
|
|
+
|
|
|
//图表操作权限
|
|
|
chartInfo.IsEdit = data.CheckOpChartPermission(sysUser, chartInfo.SysUserId, true)
|
|
|
//判断是否需要展示英文标识
|
|
@@ -1489,6 +1497,62 @@ func (this *ChartInfoController) PreviewChartInfoDetail() {
|
|
|
br.Data = resp
|
|
|
}
|
|
|
|
|
|
+func fillAreaGraphData(extraConfigStr string, edbDataList []*data_manage.ChartEdbInfoMapping) (edbList []*data_manage.ChartEdbInfoMapping, err error, errMsg string) {
|
|
|
+
|
|
|
+ var tmpConfig data_manage.AreaExtraConf
|
|
|
+ if extraConfigStr != `` {
|
|
|
+ err := json.Unmarshal([]byte(extraConfigStr), &tmpConfig)
|
|
|
+ if err != nil {
|
|
|
+ errMsg = "面积图配置异常"
|
|
|
+ err = errors.New(errMsg)
|
|
|
+ return
|
|
|
+ }
|
|
|
+ if tmpConfig.StandardEdbInfoId <= 0 {
|
|
|
+ errMsg = "面积图配置异常"
|
|
|
+ err = errors.New(errMsg)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if tmpConfig.IsHeap == 1 {
|
|
|
+ standardIndexMap := make(map[string]*data_manage.EdbDataList)
|
|
|
+ for _, v := range edbDataList {
|
|
|
+ // 判断是否为基准指标
|
|
|
+ if v.EdbInfoId == tmpConfig.StandardEdbInfoId {
|
|
|
+ if dataList, ok := v.DataList.([]*data_manage.EdbDataList); ok {
|
|
|
+ for _, dataObject := range dataList {
|
|
|
+ standardIndexMap[dataObject.DataTime] = dataObject
|
|
|
+ }
|
|
|
+ }
|
|
|
+ break
|
|
|
+ }
|
|
|
+ }
|
|
|
+ switch tmpConfig.NullDealWay {
|
|
|
+ case 1:
|
|
|
+ // 插值填充
|
|
|
+ //interpolate()
|
|
|
+
|
|
|
+ case 2:
|
|
|
+ // 前值填充
|
|
|
+ //fillWithPrevious()
|
|
|
+ // 按自然日补充,再根据基准指标取对应数据
|
|
|
+
|
|
|
+ case 3:
|
|
|
+ // 后值填充
|
|
|
+ fillWithNext()
|
|
|
+ case 4:
|
|
|
+ // 等于0
|
|
|
+ setToZero()
|
|
|
+ case 5:
|
|
|
+ // 删除日期
|
|
|
+ deleteDate()
|
|
|
+ default:
|
|
|
+ fmt.Println("Unknown NullDealWay:", tmpConfig.NullDealWay)
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ return nil, nil, ""
|
|
|
+}
|
|
|
+
|
|
|
// ChartInfoDetailV2
|
|
|
// @Title 获取图表详情
|
|
|
// @Description 获取图表详情接口
|