数据分析平台 测试图表模块调整
This commit is contained in:
parent
c8bd5f921e
commit
21912904c6
@ -442,7 +442,7 @@ func Histogram(req *request.Histogram) ([]*model.Histogram, error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Scatter 散点图
|
// Scatter 散点图
|
||||||
func Scatter(req *request.Scatter) ([]*model.Scatter, model.ScatterLimit, model.ScatterLimit, error) {
|
func Scatter(req *request.Scatter) ([]*model.Scatter, []model.ScatterLimit, []model.ScatterLimit, error) {
|
||||||
var groups []string
|
var groups []string
|
||||||
|
|
||||||
if len(req.SubBatch) == 0 && len(req.WaferID) == 0 {
|
if len(req.SubBatch) == 0 && len(req.WaferID) == 0 {
|
||||||
@ -472,7 +472,8 @@ func Scatter(req *request.Scatter) ([]*model.Scatter, model.ScatterLimit, model.
|
|||||||
}
|
}
|
||||||
|
|
||||||
var scatters []*model.Scatter
|
var scatters []*model.Scatter
|
||||||
var xScatterLimit, yScatterLimit model.ScatterLimit
|
var xScatterLimitArray, yScatterLimitArray []model.ScatterLimit
|
||||||
|
//var xScatterLimit, yScatterLimit model.ScatterLimit
|
||||||
if len(req.Site) == 0 {
|
if len(req.Site) == 0 {
|
||||||
scatterFieldMap := make(map[string]int)
|
scatterFieldMap := make(map[string]int)
|
||||||
counter := make(map[string]map[string]int)
|
counter := make(map[string]map[string]int)
|
||||||
@ -510,46 +511,90 @@ func Scatter(req *request.Scatter) ([]*model.Scatter, model.ScatterLimit, model.
|
|||||||
Field: xySelection.X + "," + xySelection.Y + " All Site", Datas: [][]string{}}
|
Field: xySelection.X + "," + xySelection.Y + " All Site", Datas: [][]string{}}
|
||||||
scatterFieldMap[xySelection.X+","+xySelection.Y] = len(scatters)
|
scatterFieldMap[xySelection.X+","+xySelection.Y] = len(scatters)
|
||||||
scatters = append(scatters, scatter)
|
scatters = append(scatters, scatter)
|
||||||
|
xScatterLimitArray = append(xScatterLimitArray, model.ScatterLimit{
|
||||||
|
Max: "",
|
||||||
|
Min: "",
|
||||||
|
})
|
||||||
|
yScatterLimitArray = append(yScatterLimitArray, model.ScatterLimit{
|
||||||
|
Max: "",
|
||||||
|
Min: "",
|
||||||
|
})
|
||||||
}
|
}
|
||||||
scatters[scatterFieldMap[xySelection.X+","+xySelection.Y]].Datas = append(
|
scatters[scatterFieldMap[xySelection.X+","+xySelection.Y]].Datas = append(
|
||||||
scatters[scatterFieldMap[xySelection.X+","+xySelection.Y]].Datas,
|
scatters[scatterFieldMap[xySelection.X+","+xySelection.Y]].Datas,
|
||||||
[]string{data[fieldMap[xySelection.X]], data[fieldMap[xySelection.Y]]})
|
[]string{data[fieldMap[xySelection.X]], data[fieldMap[xySelection.Y]]})
|
||||||
if xScatterLimit.Min == "" {
|
if xScatterLimitArray[scatterFieldMap[xySelection.X+","+xySelection.Y]].Min == "" {
|
||||||
xScatterLimit.Min = data[fieldMap[xySelection.X]]
|
xScatterLimitArray[scatterFieldMap[xySelection.X+","+xySelection.Y]].Min = data[fieldMap[xySelection.X]]
|
||||||
} else {
|
} else {
|
||||||
xScatterLimitFloat, _ := strconv.ParseFloat(xScatterLimit.Min, 8)
|
xScatterLimitFloat, _ := strconv.ParseFloat(xScatterLimitArray[scatterFieldMap[xySelection.X+","+xySelection.Y]].Min, 8)
|
||||||
dataFloat, _ := strconv.ParseFloat(data[fieldMap[xySelection.X]], 8)
|
dataFloat, _ := strconv.ParseFloat(data[fieldMap[xySelection.X]], 8)
|
||||||
if xScatterLimitFloat > dataFloat {
|
if xScatterLimitFloat > dataFloat {
|
||||||
xScatterLimit.Min = data[fieldMap[xySelection.X]]
|
xScatterLimitArray[scatterFieldMap[xySelection.X+","+xySelection.Y]].Min = data[fieldMap[xySelection.X]]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if xScatterLimit.Max == "" {
|
if xScatterLimitArray[scatterFieldMap[xySelection.X+","+xySelection.Y]].Max == "" {
|
||||||
xScatterLimit.Max = data[fieldMap[xySelection.X]]
|
xScatterLimitArray[scatterFieldMap[xySelection.X+","+xySelection.Y]].Max = data[fieldMap[xySelection.X]]
|
||||||
} else {
|
} else {
|
||||||
xScatterLimitFloat, _ := strconv.ParseFloat(xScatterLimit.Max, 8)
|
xScatterLimitFloat, _ := strconv.ParseFloat(xScatterLimitArray[scatterFieldMap[xySelection.X+","+xySelection.Y]].Max, 8)
|
||||||
dataFloat, _ := strconv.ParseFloat(data[fieldMap[xySelection.X]], 8)
|
dataFloat, _ := strconv.ParseFloat(data[fieldMap[xySelection.X]], 8)
|
||||||
if xScatterLimitFloat < dataFloat {
|
if xScatterLimitFloat < dataFloat {
|
||||||
xScatterLimit.Max = data[fieldMap[xySelection.X]]
|
xScatterLimitArray[scatterFieldMap[xySelection.X+","+xySelection.Y]].Max = data[fieldMap[xySelection.X]]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if yScatterLimit.Min == "" {
|
if yScatterLimitArray[scatterFieldMap[xySelection.X+","+xySelection.Y]].Min == "" {
|
||||||
yScatterLimit.Min = data[fieldMap[xySelection.Y]]
|
yScatterLimitArray[scatterFieldMap[xySelection.X+","+xySelection.Y]].Min = data[fieldMap[xySelection.Y]]
|
||||||
} else {
|
} else {
|
||||||
yScatterLimitFloat, _ := strconv.ParseFloat(yScatterLimit.Min, 8)
|
yScatterLimitFloat, _ := strconv.ParseFloat(yScatterLimitArray[scatterFieldMap[xySelection.X+","+xySelection.Y]].Min, 8)
|
||||||
dataFloat, _ := strconv.ParseFloat(data[fieldMap[xySelection.Y]], 8)
|
dataFloat, _ := strconv.ParseFloat(data[fieldMap[xySelection.Y]], 8)
|
||||||
if yScatterLimitFloat > dataFloat {
|
if yScatterLimitFloat > dataFloat {
|
||||||
yScatterLimit.Min = data[fieldMap[xySelection.Y]]
|
yScatterLimitArray[scatterFieldMap[xySelection.X+","+xySelection.Y]].Min = data[fieldMap[xySelection.Y]]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if yScatterLimit.Max == "" {
|
if yScatterLimitArray[scatterFieldMap[xySelection.X+","+xySelection.Y]].Max == "" {
|
||||||
yScatterLimit.Max = data[fieldMap[xySelection.Y]]
|
yScatterLimitArray[scatterFieldMap[xySelection.X+","+xySelection.Y]].Max = data[fieldMap[xySelection.Y]]
|
||||||
} else {
|
} else {
|
||||||
yScatterLimitFloat, _ := strconv.ParseFloat(yScatterLimit.Max, 8)
|
yScatterLimitFloat, _ := strconv.ParseFloat(yScatterLimitArray[scatterFieldMap[xySelection.X+","+xySelection.Y]].Max, 8)
|
||||||
dataFloat, _ := strconv.ParseFloat(data[fieldMap[xySelection.Y]], 8)
|
dataFloat, _ := strconv.ParseFloat(data[fieldMap[xySelection.Y]], 8)
|
||||||
if yScatterLimitFloat < dataFloat {
|
if yScatterLimitFloat < dataFloat {
|
||||||
yScatterLimit.Max = data[fieldMap[xySelection.Y]]
|
yScatterLimitArray[scatterFieldMap[xySelection.X+","+xySelection.Y]].Max = data[fieldMap[xySelection.Y]]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
//if xScatterLimit.Min == "" {
|
||||||
|
// xScatterLimit.Min = data[fieldMap[xySelection.X]]
|
||||||
|
//} else {
|
||||||
|
// xScatterLimitFloat, _ := strconv.ParseFloat(xScatterLimit.Min, 8)
|
||||||
|
// dataFloat, _ := strconv.ParseFloat(data[fieldMap[xySelection.X]], 8)
|
||||||
|
// if xScatterLimitFloat > dataFloat {
|
||||||
|
// xScatterLimit.Min = data[fieldMap[xySelection.X]]
|
||||||
|
// }
|
||||||
|
//}
|
||||||
|
//if xScatterLimit.Max == "" {
|
||||||
|
// xScatterLimit.Max = data[fieldMap[xySelection.X]]
|
||||||
|
//} else {
|
||||||
|
// xScatterLimitFloat, _ := strconv.ParseFloat(xScatterLimit.Max, 8)
|
||||||
|
// dataFloat, _ := strconv.ParseFloat(data[fieldMap[xySelection.X]], 8)
|
||||||
|
// if xScatterLimitFloat < dataFloat {
|
||||||
|
// xScatterLimit.Max = data[fieldMap[xySelection.X]]
|
||||||
|
// }
|
||||||
|
//}
|
||||||
|
//if yScatterLimit.Min == "" {
|
||||||
|
// yScatterLimit.Min = data[fieldMap[xySelection.Y]]
|
||||||
|
//} else {
|
||||||
|
// yScatterLimitFloat, _ := strconv.ParseFloat(yScatterLimit.Min, 8)
|
||||||
|
// dataFloat, _ := strconv.ParseFloat(data[fieldMap[xySelection.Y]], 8)
|
||||||
|
// if yScatterLimitFloat > dataFloat {
|
||||||
|
// yScatterLimit.Min = data[fieldMap[xySelection.Y]]
|
||||||
|
// }
|
||||||
|
//}
|
||||||
|
//if yScatterLimit.Max == "" {
|
||||||
|
// yScatterLimit.Max = data[fieldMap[xySelection.Y]]
|
||||||
|
//} else {
|
||||||
|
// yScatterLimitFloat, _ := strconv.ParseFloat(yScatterLimit.Max, 8)
|
||||||
|
// dataFloat, _ := strconv.ParseFloat(data[fieldMap[xySelection.Y]], 8)
|
||||||
|
// if yScatterLimitFloat < dataFloat {
|
||||||
|
// yScatterLimit.Max = data[fieldMap[xySelection.Y]]
|
||||||
|
// }
|
||||||
|
//}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -596,6 +641,14 @@ func Scatter(req *request.Scatter) ([]*model.Scatter, model.ScatterLimit, model.
|
|||||||
Field: xySelection.X + "," + xySelection.Y + "-Site" + site, Datas: [][]string{}}
|
Field: xySelection.X + "," + xySelection.Y + "-Site" + site, Datas: [][]string{}}
|
||||||
scatterFieldMap[xySelection.X+","+xySelection.Y+"-Site"+site] = len(scatters)
|
scatterFieldMap[xySelection.X+","+xySelection.Y+"-Site"+site] = len(scatters)
|
||||||
scatters = append(scatters, scatter)
|
scatters = append(scatters, scatter)
|
||||||
|
xScatterLimitArray = append(xScatterLimitArray, model.ScatterLimit{
|
||||||
|
Max: "",
|
||||||
|
Min: "",
|
||||||
|
})
|
||||||
|
yScatterLimitArray = append(yScatterLimitArray, model.ScatterLimit{
|
||||||
|
Max: "",
|
||||||
|
Min: "",
|
||||||
|
})
|
||||||
}
|
}
|
||||||
scatters[scatterFieldMap[xySelection.X+","+xySelection.Y+"-Site"+site]].Datas = append(
|
scatters[scatterFieldMap[xySelection.X+","+xySelection.Y+"-Site"+site]].Datas = append(
|
||||||
scatters[scatterFieldMap[xySelection.X+","+xySelection.Y+"-Site"+site]].Datas,
|
scatters[scatterFieldMap[xySelection.X+","+xySelection.Y+"-Site"+site]].Datas,
|
||||||
@ -610,49 +663,86 @@ func Scatter(req *request.Scatter) ([]*model.Scatter, model.ScatterLimit, model.
|
|||||||
//scatters[scatterFieldMap[xySelection.X+","+xySelection.Y]].Datas = append(
|
//scatters[scatterFieldMap[xySelection.X+","+xySelection.Y]].Datas = append(
|
||||||
// scatters[scatterFieldMap[xySelection.X+","+xySelection.Y]].Datas,
|
// scatters[scatterFieldMap[xySelection.X+","+xySelection.Y]].Datas,
|
||||||
// []string{data[fieldMap[xySelection.X]], data[fieldMap[xySelection.Y]]})
|
// []string{data[fieldMap[xySelection.X]], data[fieldMap[xySelection.Y]]})
|
||||||
if xScatterLimit.Min == "" {
|
|
||||||
xScatterLimit.Min = data[fieldMap[xySelection.X]]
|
if xScatterLimitArray[scatterFieldMap[xySelection.X+","+xySelection.Y]].Min == "" {
|
||||||
|
xScatterLimitArray[scatterFieldMap[xySelection.X+","+xySelection.Y]].Min = data[fieldMap[xySelection.X]]
|
||||||
} else {
|
} else {
|
||||||
xScatterLimitFloat, _ := strconv.ParseFloat(xScatterLimit.Min, 8)
|
xScatterLimitFloat, _ := strconv.ParseFloat(xScatterLimitArray[scatterFieldMap[xySelection.X+","+xySelection.Y]].Min, 8)
|
||||||
dataFloat, _ := strconv.ParseFloat(data[fieldMap[xySelection.X]], 8)
|
dataFloat, _ := strconv.ParseFloat(data[fieldMap[xySelection.X]], 8)
|
||||||
if xScatterLimitFloat > dataFloat {
|
if xScatterLimitFloat > dataFloat {
|
||||||
xScatterLimit.Min = data[fieldMap[xySelection.X]]
|
xScatterLimitArray[scatterFieldMap[xySelection.X+","+xySelection.Y]].Min = data[fieldMap[xySelection.X]]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if xScatterLimit.Max == "" {
|
if xScatterLimitArray[scatterFieldMap[xySelection.X+","+xySelection.Y]].Max == "" {
|
||||||
xScatterLimit.Max = data[fieldMap[xySelection.X]]
|
xScatterLimitArray[scatterFieldMap[xySelection.X+","+xySelection.Y]].Max = data[fieldMap[xySelection.X]]
|
||||||
} else {
|
} else {
|
||||||
xScatterLimitFloat, _ := strconv.ParseFloat(xScatterLimit.Max, 8)
|
xScatterLimitFloat, _ := strconv.ParseFloat(xScatterLimitArray[scatterFieldMap[xySelection.X+","+xySelection.Y]].Max, 8)
|
||||||
dataFloat, _ := strconv.ParseFloat(data[fieldMap[xySelection.X]], 8)
|
dataFloat, _ := strconv.ParseFloat(data[fieldMap[xySelection.X]], 8)
|
||||||
if xScatterLimitFloat < dataFloat {
|
if xScatterLimitFloat < dataFloat {
|
||||||
xScatterLimit.Max = data[fieldMap[xySelection.X]]
|
xScatterLimitArray[scatterFieldMap[xySelection.X+","+xySelection.Y]].Max = data[fieldMap[xySelection.X]]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if yScatterLimit.Min == "" {
|
if yScatterLimitArray[scatterFieldMap[xySelection.X+","+xySelection.Y]].Min == "" {
|
||||||
yScatterLimit.Min = data[fieldMap[xySelection.Y]]
|
yScatterLimitArray[scatterFieldMap[xySelection.X+","+xySelection.Y]].Min = data[fieldMap[xySelection.Y]]
|
||||||
} else {
|
} else {
|
||||||
yScatterLimitFloat, _ := strconv.ParseFloat(yScatterLimit.Min, 8)
|
yScatterLimitFloat, _ := strconv.ParseFloat(yScatterLimitArray[scatterFieldMap[xySelection.X+","+xySelection.Y]].Min, 8)
|
||||||
dataFloat, _ := strconv.ParseFloat(data[fieldMap[xySelection.Y]], 8)
|
dataFloat, _ := strconv.ParseFloat(data[fieldMap[xySelection.Y]], 8)
|
||||||
if yScatterLimitFloat > dataFloat {
|
if yScatterLimitFloat > dataFloat {
|
||||||
yScatterLimit.Min = data[fieldMap[xySelection.Y]]
|
yScatterLimitArray[scatterFieldMap[xySelection.X+","+xySelection.Y]].Min = data[fieldMap[xySelection.Y]]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if yScatterLimit.Max == "" {
|
if yScatterLimitArray[scatterFieldMap[xySelection.X+","+xySelection.Y]].Max == "" {
|
||||||
yScatterLimit.Max = data[fieldMap[xySelection.Y]]
|
yScatterLimitArray[scatterFieldMap[xySelection.X+","+xySelection.Y]].Max = data[fieldMap[xySelection.Y]]
|
||||||
} else {
|
} else {
|
||||||
yScatterLimitFloat, _ := strconv.ParseFloat(yScatterLimit.Max, 8)
|
yScatterLimitFloat, _ := strconv.ParseFloat(yScatterLimitArray[scatterFieldMap[xySelection.X+","+xySelection.Y]].Max, 8)
|
||||||
dataFloat, _ := strconv.ParseFloat(data[fieldMap[xySelection.Y]], 8)
|
dataFloat, _ := strconv.ParseFloat(data[fieldMap[xySelection.Y]], 8)
|
||||||
if yScatterLimitFloat < dataFloat {
|
if yScatterLimitFloat < dataFloat {
|
||||||
yScatterLimit.Max = data[fieldMap[xySelection.Y]]
|
yScatterLimitArray[scatterFieldMap[xySelection.X+","+xySelection.Y]].Max = data[fieldMap[xySelection.Y]]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
//if xScatterLimit.Min == "" {
|
||||||
|
// xScatterLimit.Min = data[fieldMap[xySelection.X]]
|
||||||
|
//} else {
|
||||||
|
// xScatterLimitFloat, _ := strconv.ParseFloat(xScatterLimit.Min, 8)
|
||||||
|
// dataFloat, _ := strconv.ParseFloat(data[fieldMap[xySelection.X]], 8)
|
||||||
|
// if xScatterLimitFloat > dataFloat {
|
||||||
|
// xScatterLimit.Min = data[fieldMap[xySelection.X]]
|
||||||
|
// }
|
||||||
|
//}
|
||||||
|
//if xScatterLimit.Max == "" {
|
||||||
|
// xScatterLimit.Max = data[fieldMap[xySelection.X]]
|
||||||
|
//} else {
|
||||||
|
// xScatterLimitFloat, _ := strconv.ParseFloat(xScatterLimit.Max, 8)
|
||||||
|
// dataFloat, _ := strconv.ParseFloat(data[fieldMap[xySelection.X]], 8)
|
||||||
|
// if xScatterLimitFloat < dataFloat {
|
||||||
|
// xScatterLimit.Max = data[fieldMap[xySelection.X]]
|
||||||
|
// }
|
||||||
|
//}
|
||||||
|
//if yScatterLimit.Min == "" {
|
||||||
|
// yScatterLimit.Min = data[fieldMap[xySelection.Y]]
|
||||||
|
//} else {
|
||||||
|
// yScatterLimitFloat, _ := strconv.ParseFloat(yScatterLimit.Min, 8)
|
||||||
|
// dataFloat, _ := strconv.ParseFloat(data[fieldMap[xySelection.Y]], 8)
|
||||||
|
// if yScatterLimitFloat > dataFloat {
|
||||||
|
// yScatterLimit.Min = data[fieldMap[xySelection.Y]]
|
||||||
|
// }
|
||||||
|
//}
|
||||||
|
//if yScatterLimit.Max == "" {
|
||||||
|
// yScatterLimit.Max = data[fieldMap[xySelection.Y]]
|
||||||
|
//} else {
|
||||||
|
// yScatterLimitFloat, _ := strconv.ParseFloat(yScatterLimit.Max, 8)
|
||||||
|
// dataFloat, _ := strconv.ParseFloat(data[fieldMap[xySelection.Y]], 8)
|
||||||
|
// if yScatterLimitFloat < dataFloat {
|
||||||
|
// yScatterLimit.Max = data[fieldMap[xySelection.Y]]
|
||||||
|
// }
|
||||||
|
//}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return scatters, xScatterLimit, yScatterLimit, nil
|
return scatters, xScatterLimitArray, yScatterLimitArray, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func Pie(req *request.Pie) ([]*model.Pie, error) {
|
func Pie(req *request.Pie) ([]*model.Pie, error) {
|
||||||
|
@ -1148,11 +1148,19 @@ func ExportScatter(req *request.Scatter) string {
|
|||||||
scatterFile.SetSheetName("Sheet1", "All")
|
scatterFile.SetSheetName("Sheet1", "All")
|
||||||
sheetName := scatterFile.GetSheetName(0)
|
sheetName := scatterFile.GetSheetName(0)
|
||||||
selectionValueMap := make(map[string][]int)
|
selectionValueMap := make(map[string][]int)
|
||||||
|
selectionXLimitMap := make(map[string][]float64)
|
||||||
|
selectionYLimitMap := make(map[string][]float64)
|
||||||
|
|
||||||
rowIndex := 1
|
rowIndex := 1
|
||||||
for _, selection := range req.XYSelection {
|
for _, selection := range req.XYSelection {
|
||||||
for k := range selectionPointsMap {
|
for k := range selectionPointsMap {
|
||||||
if strings.Contains(k, selection.X+","+selection.Y) {
|
if strings.Contains(k, selection.X+","+selection.Y) {
|
||||||
|
if _, ok := selectionXLimitMap[k]; !ok {
|
||||||
|
selectionXLimitMap[k] = []float64{math.MinInt64, math.MaxFloat64}
|
||||||
|
}
|
||||||
|
if _, ok := selectionYLimitMap[k]; !ok {
|
||||||
|
selectionYLimitMap[k] = []float64{math.MinInt64, math.MaxFloat64}
|
||||||
|
}
|
||||||
sheetX := []interface{}{k, selection.X}
|
sheetX := []interface{}{k, selection.X}
|
||||||
sheetY := []interface{}{"", selection.Y}
|
sheetY := []interface{}{"", selection.Y}
|
||||||
for point := range selectionPointsMap[k] {
|
for point := range selectionPointsMap[k] {
|
||||||
@ -1163,6 +1171,18 @@ func ExportScatter(req *request.Scatter) string {
|
|||||||
y, _ := yDecimal.Float64()
|
y, _ := yDecimal.Float64()
|
||||||
sheetX = append(sheetX, x)
|
sheetX = append(sheetX, x)
|
||||||
sheetY = append(sheetY, y)
|
sheetY = append(sheetY, y)
|
||||||
|
if x > selectionXLimitMap[k][0] {
|
||||||
|
selectionXLimitMap[k][0] = x
|
||||||
|
}
|
||||||
|
if x < selectionXLimitMap[k][1] {
|
||||||
|
selectionXLimitMap[k][1] = x
|
||||||
|
}
|
||||||
|
if y > selectionYLimitMap[k][0] {
|
||||||
|
selectionYLimitMap[k][0] = y
|
||||||
|
}
|
||||||
|
if y < selectionYLimitMap[k][1] {
|
||||||
|
selectionYLimitMap[k][1] = y
|
||||||
|
}
|
||||||
}
|
}
|
||||||
for idx, row := range [][]interface{}{
|
for idx, row := range [][]interface{}{
|
||||||
sheetX,
|
sheetX,
|
||||||
@ -1188,6 +1208,14 @@ func ExportScatter(req *request.Scatter) string {
|
|||||||
if strings.Contains(k, selection.X+","+selection.Y) {
|
if strings.Contains(k, selection.X+","+selection.Y) {
|
||||||
if err := scatterFile.AddChart("All", utils.NumToRow(strconv.Itoa(b))+strconv.Itoa(a), &excelize.Chart{
|
if err := scatterFile.AddChart("All", utils.NumToRow(strconv.Itoa(b))+strconv.Itoa(a), &excelize.Chart{
|
||||||
Type: excelize.Scatter,
|
Type: excelize.Scatter,
|
||||||
|
XAxis: excelize.ChartAxis{
|
||||||
|
Maximum: &selectionXLimitMap[k][0],
|
||||||
|
Minimum: &selectionXLimitMap[k][1],
|
||||||
|
},
|
||||||
|
YAxis: excelize.ChartAxis{
|
||||||
|
Maximum: &selectionYLimitMap[k][0],
|
||||||
|
Minimum: &selectionYLimitMap[k][1],
|
||||||
|
},
|
||||||
Series: []excelize.ChartSeries{
|
Series: []excelize.ChartSeries{
|
||||||
{
|
{
|
||||||
Name: "All" + "!$A$1",
|
Name: "All" + "!$A$1",
|
||||||
@ -1276,11 +1304,19 @@ func ExportScatter(req *request.Scatter) string {
|
|||||||
|
|
||||||
scatterFile.NewSheet(group)
|
scatterFile.NewSheet(group)
|
||||||
selectionValueMap := make(map[string][]int)
|
selectionValueMap := make(map[string][]int)
|
||||||
|
selectionXLimitMap := make(map[string][]float64)
|
||||||
|
selectionYLimitMap := make(map[string][]float64)
|
||||||
|
|
||||||
rowIndex := 1
|
rowIndex := 1
|
||||||
for _, selection := range req.XYSelection {
|
for _, selection := range req.XYSelection {
|
||||||
for k := range selectionPointsMap {
|
for k := range selectionPointsMap {
|
||||||
if strings.Contains(k, selection.X+","+selection.Y) {
|
if strings.Contains(k, selection.X+","+selection.Y) {
|
||||||
|
if _, ok := selectionXLimitMap[k]; !ok {
|
||||||
|
selectionXLimitMap[k] = []float64{math.MinInt64, math.MaxFloat64}
|
||||||
|
}
|
||||||
|
if _, ok := selectionYLimitMap[k]; !ok {
|
||||||
|
selectionYLimitMap[k] = []float64{math.MinInt64, math.MaxFloat64}
|
||||||
|
}
|
||||||
sheetX := []interface{}{k, selection.X}
|
sheetX := []interface{}{k, selection.X}
|
||||||
sheetY := []interface{}{"", selection.Y}
|
sheetY := []interface{}{"", selection.Y}
|
||||||
for point := range selectionPointsMap[k] {
|
for point := range selectionPointsMap[k] {
|
||||||
@ -1291,6 +1327,18 @@ func ExportScatter(req *request.Scatter) string {
|
|||||||
y, _ := yDecimal.Float64()
|
y, _ := yDecimal.Float64()
|
||||||
sheetX = append(sheetX, x)
|
sheetX = append(sheetX, x)
|
||||||
sheetY = append(sheetY, y)
|
sheetY = append(sheetY, y)
|
||||||
|
if x > selectionXLimitMap[k][0] {
|
||||||
|
selectionXLimitMap[k][0] = x
|
||||||
|
}
|
||||||
|
if x < selectionXLimitMap[k][1] {
|
||||||
|
selectionXLimitMap[k][1] = x
|
||||||
|
}
|
||||||
|
if y > selectionYLimitMap[k][0] {
|
||||||
|
selectionYLimitMap[k][0] = y
|
||||||
|
}
|
||||||
|
if y < selectionYLimitMap[k][1] {
|
||||||
|
selectionYLimitMap[k][1] = y
|
||||||
|
}
|
||||||
}
|
}
|
||||||
for idx, row := range [][]interface{}{
|
for idx, row := range [][]interface{}{
|
||||||
sheetX,
|
sheetX,
|
||||||
@ -1316,6 +1364,14 @@ func ExportScatter(req *request.Scatter) string {
|
|||||||
if strings.Contains(k, selection.X+","+selection.Y) {
|
if strings.Contains(k, selection.X+","+selection.Y) {
|
||||||
if err := scatterFile.AddChart(group, utils.NumToRow(strconv.Itoa(b))+strconv.Itoa(a), &excelize.Chart{
|
if err := scatterFile.AddChart(group, utils.NumToRow(strconv.Itoa(b))+strconv.Itoa(a), &excelize.Chart{
|
||||||
Type: excelize.Scatter,
|
Type: excelize.Scatter,
|
||||||
|
XAxis: excelize.ChartAxis{
|
||||||
|
Maximum: &selectionXLimitMap[k][0],
|
||||||
|
Minimum: &selectionXLimitMap[k][1],
|
||||||
|
},
|
||||||
|
YAxis: excelize.ChartAxis{
|
||||||
|
Maximum: &selectionYLimitMap[k][0],
|
||||||
|
Minimum: &selectionYLimitMap[k][1],
|
||||||
|
},
|
||||||
Series: []excelize.ChartSeries{
|
Series: []excelize.ChartSeries{
|
||||||
{
|
{
|
||||||
Name: group + "!$A$1",
|
Name: group + "!$A$1",
|
||||||
|
Loading…
Reference in New Issue
Block a user