|
@@ -211,6 +211,10 @@ func GetChartDataByEdbInfo(edbInfoMappingA, edbInfoMappingB *chart_edb_mapping.C
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ // 计算窗口,不包含第一天
|
|
|
+ startDateTime, _ := time.ParseInLocation(utils.FormatDate, startDate, time.Local)
|
|
|
+ startDate = startDateTime.AddDate(0, 0, 1).Format(utils.FormatDate)
|
|
|
+
|
|
|
//// 2023-03-02 时间序列始终以指标B为基准, 始终是A进行平移
|
|
|
//baseEdbInfo := edbInfoMappingB
|
|
|
//changeEdbInfo := edbInfoMappingA
|
|
@@ -286,7 +290,7 @@ func GetChartDataByEdbInfo(edbInfoMappingA, edbInfoMappingB *chart_edb_mapping.C
|
|
|
changeDataList = tmpNewChangeDataList
|
|
|
} else {
|
|
|
changeDataList = bDataList
|
|
|
- for _, v := range baseDataList {
|
|
|
+ for _, v := range bDataList {
|
|
|
changeDataMap[v.DataTime] = v.Value
|
|
|
}
|
|
|
}
|
|
@@ -358,6 +362,10 @@ func GetRollingCorrelationChartDataByEdbInfo(edbInfoMappingA, edbInfoMappingB *c
|
|
|
xDateTimeValue = make([]string, 0)
|
|
|
yData := make([]float64, 0)
|
|
|
|
|
|
+ // 计算窗口,不包含第一天
|
|
|
+ startDateTime, _ := time.ParseInLocation(utils.FormatDate, startDate, time.Local)
|
|
|
+ startDate = startDateTime.AddDate(0, 0, 1).Format(utils.FormatDate)
|
|
|
+
|
|
|
baseEdbInfo := edbInfoMappingA
|
|
|
changeEdbInfo := edbInfoMappingB
|
|
|
|
|
@@ -430,8 +438,15 @@ func GetRollingCorrelationChartDataByEdbInfo(edbInfoMappingA, edbInfoMappingB *c
|
|
|
// 取出对应的基准日期的值
|
|
|
for i := 0; i < calculateDay; i++ {
|
|
|
iDay := currDay.AddDate(0, 0, i).Format(utils.FormatDate)
|
|
|
- baseCalculateData = append(baseCalculateData, baseDataMap[iDay])
|
|
|
- yCalculateData = append(yCalculateData, changeDataMap[iDay])
|
|
|
+
|
|
|
+ tmpBaseValue, ok1 := baseDataMap[iDay]
|
|
|
+ tmpChangeValue, ok2 := changeDataMap[iDay]
|
|
|
+ if ok1 && ok2 {
|
|
|
+ baseCalculateData = append(baseCalculateData, tmpBaseValue)
|
|
|
+ yCalculateData = append(yCalculateData, tmpChangeValue)
|
|
|
+ } else {
|
|
|
+ continue
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
// 公式计算出领先/滞后频度对应点的相关性系数
|
|
@@ -440,7 +455,7 @@ func GetRollingCorrelationChartDataByEdbInfo(edbInfoMappingA, edbInfoMappingB *c
|
|
|
ratio = utils.CalculateCorrelationByIntArr(baseCalculateData, yCalculateData)
|
|
|
}
|
|
|
yData = append(yData, ratio)
|
|
|
- xDateTimeValue = append(xDateTimeValue, currDay.AddDate(0, 0, calculateDay).Format(utils.FormatDate))
|
|
|
+ xDateTimeValue = append(xDateTimeValue, currDay.AddDate(0, 0, calculateDay-1).Format(utils.FormatDate))
|
|
|
}
|
|
|
}
|
|
|
|