|
@@ -4122,6 +4122,7 @@ func MarkerLineCalculate(markerLine data_manage.MarkersLine, dataList interface{
|
|
|
if markerLine.Calculation == 1 {
|
|
|
|
|
|
averge := 0.0
|
|
|
+ length := 0
|
|
|
|
|
|
if chartInfo.ChartType == 2 && markerLine.EdbType == 0 {
|
|
|
|
|
@@ -4158,12 +4159,13 @@ func MarkerLineCalculate(markerLine data_manage.MarkersLine, dataList interface{
|
|
|
}
|
|
|
if vv.DataTime >= startDate && vv.DataTime <= endDate {
|
|
|
averge += vv.Value
|
|
|
+ length +=1
|
|
|
}
|
|
|
} else {
|
|
|
averge += vv.Value
|
|
|
}
|
|
|
}
|
|
|
- averge = averge / float64(len(quarterData.DataList))
|
|
|
+ averge = averge / float64(length)
|
|
|
value = fmt.Sprintf("%.2f", averge)
|
|
|
}
|
|
|
} else {
|
|
@@ -4199,18 +4201,21 @@ func MarkerLineCalculate(markerLine data_manage.MarkersLine, dataList interface{
|
|
|
}
|
|
|
if dataItem.DataTime >= startDate && dataItem.DataTime <= endDate {
|
|
|
averge += dataItem.Value
|
|
|
+ length += 1
|
|
|
}
|
|
|
} else {
|
|
|
averge += dataItem.Value
|
|
|
+ length += 1
|
|
|
}
|
|
|
}
|
|
|
- averge = averge / float64(len(dataList))
|
|
|
+ averge = averge / float64(length)
|
|
|
|
|
|
value = fmt.Sprintf("%.2f", averge)
|
|
|
}
|
|
|
} else if markerLine.Calculation == 2 {
|
|
|
|
|
|
averge := 0.0
|
|
|
+ length := 0
|
|
|
|
|
|
if chartInfo.ChartType == 2 && markerLine.EdbType == 0 {
|
|
|
|
|
@@ -4247,15 +4252,17 @@ func MarkerLineCalculate(markerLine data_manage.MarkersLine, dataList interface{
|
|
|
endDate, err = HandleDateChange(endDate, markerLine.StartDate.Conf)
|
|
|
}
|
|
|
if vv.DataTime >= startDate && vv.DataTime <= endDate {
|
|
|
- dataList = append(faloatList, vv.Value)
|
|
|
+ faloatList = append(faloatList, vv.Value)
|
|
|
averge += vv.Value
|
|
|
+ length += 1
|
|
|
}
|
|
|
} else {
|
|
|
- dataList = append(faloatList, vv.Value)
|
|
|
+ faloatList = append(faloatList, vv.Value)
|
|
|
averge += vv.Value
|
|
|
+ length += 1
|
|
|
}
|
|
|
}
|
|
|
- averge = averge / float64(len(quarterData.DataList))
|
|
|
+ averge = averge / float64(length)
|
|
|
stdev := utils.CalculateStandardDeviation(faloatList)
|
|
|
stdev, _ = decimal.NewFromFloat(stdev).Round(4).Float64()
|
|
|
|
|
@@ -4297,13 +4304,15 @@ func MarkerLineCalculate(markerLine data_manage.MarkersLine, dataList interface{
|
|
|
if dataItem.DataTime >= startDate && dataItem.DataTime <= endDate {
|
|
|
floatList = append(floatList, dataItem.Value)
|
|
|
averge += dataItem.Value
|
|
|
+ length += 1
|
|
|
}
|
|
|
} else {
|
|
|
floatList = append(floatList, dataItem.Value)
|
|
|
averge += dataItem.Value
|
|
|
+ length += 1
|
|
|
}
|
|
|
}
|
|
|
- averge = averge / float64(len(dataList))
|
|
|
+ averge = averge / float64(length)
|
|
|
|
|
|
stdev := utils.CalculateStandardDeviation(floatList)
|
|
|
stdev, _ = decimal.NewFromFloat(stdev).Round(4).Float64()
|