|
@@ -340,3 +340,35 @@ func CopyChartSeriesAndEdbMapping(seriesList []*ChartSeries, seriesEdbInfoList [
|
|
|
}
|
|
|
return
|
|
|
}
|
|
|
+
|
|
|
+type ChartSectionSeriesValSortAsc []ChartSectionSeriesValSort
|
|
|
+type ChartSectionSeriesValSortDesc []ChartSectionSeriesValSort
|
|
|
+
|
|
|
+type ChartSectionSeriesValSort struct {
|
|
|
+ Index int
|
|
|
+ Value float64
|
|
|
+}
|
|
|
+
|
|
|
+func (s ChartSectionSeriesValSortAsc) Len() int {
|
|
|
+ return len(s)
|
|
|
+}
|
|
|
+
|
|
|
+func (s ChartSectionSeriesValSortAsc) Less(i, j int) bool {
|
|
|
+ return s[i].Value < s[j].Value // 升序排序,如果想要降序则改为 s[i].Value > s[j].Value
|
|
|
+}
|
|
|
+
|
|
|
+func (s ChartSectionSeriesValSortAsc) Swap(i, j int) {
|
|
|
+ s[i], s[j] = s[j], s[i]
|
|
|
+}
|
|
|
+
|
|
|
+func (s ChartSectionSeriesValSortDesc) Len() int {
|
|
|
+ return len(s)
|
|
|
+}
|
|
|
+
|
|
|
+func (s ChartSectionSeriesValSortDesc) Less(i, j int) bool {
|
|
|
+ return s[i].Value > s[j].Value // 升序排序,如果想要降序则改为 s[i].Value > s[j].Value
|
|
|
+}
|
|
|
+
|
|
|
+func (s ChartSectionSeriesValSortDesc) Swap(i, j int) {
|
|
|
+ s[i], s[j] = s[j], s[i]
|
|
|
+}
|