zwxi 8 months ago
parent
commit
16d9f3e997
2 changed files with 5 additions and 5 deletions
  1. 1 1
      models/data_manage/chart_info.go
  2. 4 4
      services/data/chart_info.go

+ 1 - 1
models/data_manage/chart_info.go

@@ -282,7 +282,7 @@ type MarkersLine struct {
 	EdbType          int             `json:"edbType" description:"指标类型 0图中第一个指标 1其他指标 前端回显用"`
 	EdbInfoId        int             `json:"edbInfoId" description:"指标id"`
 	Calculation      int             `json:"calculation" description:"计算方式 1区间均值 2区间均值加N倍标准差 3区间个数分位 4区间数值分位"`
-	CalculationValue int             `json:"calculationValue" description:"计算方式对应的值 2就是几倍标准差 3就是分位值 4就是数值值·"`
+	CalculationValue float64         `json:"calculationValue" description:"计算方式对应的值 2就是几倍标准差 3就是分位值 4就是数值值·"`
 	TimeIntervalType int             `json:"timeInterval" description:"时间区间 0跟随图表 1自定义"`
 	StartDate        MarkersLineTime `json:"startTime" description:"开始时间"`
 	EndDate          MarkersLineTime `json:"endTime" description:"结束时间"`

+ 4 - 4
services/data/chart_info.go

@@ -3666,7 +3666,7 @@ func MarkerLineCalculate(markerLine data_manage.MarkersLine, dataList interface{
 				stdev := utils.CalculateStandardDeviation(faloatList)
 				stdev, _ = decimal.NewFromFloat(stdev).Round(4).Float64()
 
-				value = fmt.Sprintf("%.2f", averge+stdev*float64(markerLine.CalculationValue))
+				value = fmt.Sprintf("%.2f", averge+stdev*markerLine.CalculationValue)
 			}
 
 		} else {
@@ -3688,7 +3688,7 @@ func MarkerLineCalculate(markerLine data_manage.MarkersLine, dataList interface{
 			stdev := utils.CalculateStandardDeviation(floatList)
 			stdev, _ = decimal.NewFromFloat(stdev).Round(4).Float64()
 
-			value = fmt.Sprintf("%.2f", averge+stdev*float64(markerLine.CalculationValue))
+			value = fmt.Sprintf("%.2f", averge+stdev*markerLine.CalculationValue)
 		}
 	} else if markerLine.Calculation == 3 {
 		// 区间个数分位
@@ -3708,7 +3708,7 @@ func MarkerLineCalculate(markerLine data_manage.MarkersLine, dataList interface{
 					}
 				}
 
-				markerLineValue = PercentileAlgorithm(float64(markerLine.CalculationValue), faloatList)
+				markerLineValue = PercentileAlgorithm(markerLine.CalculationValue, faloatList)
 				value = fmt.Sprintf("%.2f", markerLineValue)
 			}
 
@@ -3725,7 +3725,7 @@ func MarkerLineCalculate(markerLine data_manage.MarkersLine, dataList interface{
 				}
 			}
 
-			markerLineValue = PercentileAlgorithm(float64(markerLine.CalculationValue), floatList)
+			markerLineValue = PercentileAlgorithm(markerLine.CalculationValue, floatList)
 			value = fmt.Sprintf("%.2f", markerLineValue)
 		}
 	}