|
@@ -134,9 +134,6 @@ export const chartSetMixin = {
|
|
|
leftIndex: -1, //左侧上下限对应下标
|
|
|
rightIndex: -1, //右侧上下限对应下标
|
|
|
rightTwoIndex: -1,//右2上下限对应下标
|
|
|
- leftLimitData:[0,0],//左轴上下限
|
|
|
- rightLimitData:[0,0],//右轴上下限
|
|
|
- rightTwoLimitData:[0,0],//右二轴上下限
|
|
|
left_extreme: [],
|
|
|
right_extreme: [],
|
|
|
|
|
@@ -161,7 +158,15 @@ export const chartSetMixin = {
|
|
|
barXData: [],//柱形图的x轴
|
|
|
barXIdList: [],//x轴id数组 用于切换英文遍历用
|
|
|
barEdbData: [],//柱形图的表格数据 只用于取值
|
|
|
- chartLimit: {},
|
|
|
+ chartLimit: {
|
|
|
+ min:'', //左轴上下限
|
|
|
+ max:'',
|
|
|
+ rightMin:'',//右轴上下限
|
|
|
+ rightMax:'',
|
|
|
+ rightTwoMin:'',//右二轴上下限
|
|
|
+ rightTwoMax:'',
|
|
|
+
|
|
|
+ },
|
|
|
|
|
|
/* 商品价格曲线 本来逻辑分开写 但需求又得加入myeta和eta图库共存 还是写一块算了 */
|
|
|
commodityChartData: [],
|
|
@@ -605,12 +610,15 @@ export const chartSetMixin = {
|
|
|
}
|
|
|
if(!useTableLimit&&isETASource){
|
|
|
const limitMap = {
|
|
|
- 0:this.rightLimitData||[],
|
|
|
- 1:this.leftLimitData||[],
|
|
|
- 2:this.rightTwoLimitData||[]
|
|
|
+ 0:['rightMin','rightMax'],
|
|
|
+ 1:['min','max'],
|
|
|
+ 2:['rightTwoMin','rightTwoMax']
|
|
|
+ }
|
|
|
+ if(limitMap[item.IsAxis]){
|
|
|
+ minLimit = this.chartLimit[`${limitMap[item.IsAxis][0]}`]||0
|
|
|
+ maxLimit = this.chartLimit[`${limitMap[item.IsAxis][1]}`]||0
|
|
|
}
|
|
|
- minLimit = limitMap[item.IsAxis][1]||0
|
|
|
- maxLimit = limitMap[item.IsAxis][0]||0
|
|
|
+ console.log('test',minLimit,maxLimit)
|
|
|
}
|
|
|
|
|
|
|
|
@@ -803,12 +811,15 @@ export const chartSetMixin = {
|
|
|
maxLimit = chartData[sameSideIndex].MaxData
|
|
|
}else{
|
|
|
const limitMap = {
|
|
|
- 0:this.rightLimitData||[],
|
|
|
- 1:this.leftLimitData||[],
|
|
|
- 2:this.rightTwoLimitData||[]
|
|
|
+ 0:['rightMin','rightMax'],
|
|
|
+ 1:['min','max'],
|
|
|
+ 2:['rightTwoMin','rightTwoMax']
|
|
|
}
|
|
|
- minLimit = limitMap[item.IsAxis][1]||0
|
|
|
- maxLimit = limitMap[item.IsAxis][0]||0
|
|
|
+ if(limitMap[item.IsAxis]){
|
|
|
+ minLimit = this.chartLimit[`${limitMap[item.IsAxis][0]}`]||0
|
|
|
+ maxLimit = this.chartLimit[`${limitMap[item.IsAxis][1]}`]||0
|
|
|
+ }
|
|
|
+ console.log('test堆积',minLimit,maxLimit)
|
|
|
}
|
|
|
|
|
|
//y轴
|
|
@@ -949,8 +960,8 @@ export const chartSetMixin = {
|
|
|
minLimit = chartData.MinData
|
|
|
maxLimit = chartData.MaxData
|
|
|
}else{
|
|
|
- minLimit = this.leftLimitData[1]||0
|
|
|
- maxLimit = this.leftLimitData[0]||0
|
|
|
+ minLimit = this.chartLimit.min||0
|
|
|
+ maxLimit = this.chartLimit.max||0
|
|
|
}
|
|
|
|
|
|
//数据列
|
|
@@ -1137,8 +1148,8 @@ export const chartSetMixin = {
|
|
|
minLimit = Math.min(...real_data.map(_ => _.y));
|
|
|
maxLimit = Math.max(...real_data.map(_ => _.y));
|
|
|
}else{
|
|
|
- minLimit = this.leftLimitData[1]||0
|
|
|
- maxLimit = this.leftLimitData[0]||0
|
|
|
+ minLimit = this.chartLimit.min||0
|
|
|
+ maxLimit = this.chartLimit.max||0
|
|
|
}
|
|
|
|
|
|
const { IsOrder,ChartColor } = newval[0];
|
|
@@ -2518,6 +2529,12 @@ export const chartSetMixin = {
|
|
|
changeLimit() {
|
|
|
//source1 eta图库的类型对应
|
|
|
const typeMap = {
|
|
|
+ 1: this.setDefaultChart,
|
|
|
+ 2: this.setSeasonChart,
|
|
|
+ 3: this.setStackOrCombinChart,
|
|
|
+ 4: this.setStackOrCombinChart,
|
|
|
+ 5: this.setScatterChart,
|
|
|
+ 6: this.setStackOrCombinChart,
|
|
|
7: this.setBarChart,
|
|
|
10: this.setSectionScatterChart,
|
|
|
11: this.setRadarChart
|
|
@@ -2529,7 +2546,13 @@ export const chartSetMixin = {
|
|
|
// 3:
|
|
|
}
|
|
|
if(this.chartInfo.Source === 1) {
|
|
|
- typeMap[this.chartInfo.ChartType]()
|
|
|
+ if([7,10,11].includes(this.chartInfo.ChartType)){
|
|
|
+ typeMap[this.chartInfo.ChartType]()
|
|
|
+ }else{
|
|
|
+ this.setAddChartDefault&&this.setAddChartDefault();
|
|
|
+ typeMap[this.chartInfo.ChartType](this.tableData)
|
|
|
+ }
|
|
|
+
|
|
|
}else {
|
|
|
sourceMap[this.chartInfo.Source]();
|
|
|
}
|
|
@@ -2667,7 +2690,8 @@ export const chartSetMixin = {
|
|
|
//散点图单独处理
|
|
|
if(this.chartInfo.ChartType===5){
|
|
|
if(tableData[1]){
|
|
|
- this.leftLimitData = [tableData[1].MaxData,tableData[1].MinData]
|
|
|
+ this.chartLimit.min = tableData[1].MinData
|
|
|
+ this.chartLimit.max = tableData[1].MaxData
|
|
|
}
|
|
|
return
|
|
|
}
|
|
@@ -2681,45 +2705,51 @@ export const chartSetMixin = {
|
|
|
Max,
|
|
|
Min
|
|
|
} = this.calcLimit(leftData.flat())
|
|
|
- this.leftLimitData = [Max, Min]
|
|
|
+ this.chartLimit.min=Min
|
|
|
+ this.chartLimit.max=Max
|
|
|
} else {
|
|
|
this.leftIndex = -1
|
|
|
- this.leftLimitData = [0, 0]
|
|
|
+ this.chartLimit.min=0
|
|
|
+ this.chartLimit.max=0
|
|
|
}
|
|
|
if (rightData.length) {
|
|
|
const {
|
|
|
Max,
|
|
|
Min
|
|
|
} = this.calcLimit(rightData.flat())
|
|
|
- this.rightLimitData = [Max, Min]
|
|
|
+ this.chartLimit.rightMin = Min
|
|
|
+ this.chartLimit.rightMax = Max
|
|
|
} else {
|
|
|
this.rightIndex = -1
|
|
|
- this.rightLimitData = [0, 0]
|
|
|
+ this.chartLimit.rightMin = 0
|
|
|
+ this.chartLimit.rightMax = 0
|
|
|
}
|
|
|
if (rightTwoData.length) {
|
|
|
const {
|
|
|
Max,
|
|
|
Min
|
|
|
} = this.calcLimit(rightTwoData.flat())
|
|
|
- this.rightTwoLimitData = [Max, Min]
|
|
|
+ this.chartLimit.rightTwoMin = Min
|
|
|
+ this.chartLimit.rightTwoMax = Max
|
|
|
} else {
|
|
|
this.rightTwoIndex = -1
|
|
|
- this.rightTwoLimitData = [0, 0]
|
|
|
+ this.chartLimit.rightTwoMin = 0
|
|
|
+ this.chartLimit.rightTwoMax = 0
|
|
|
}
|
|
|
console.table([{
|
|
|
'y轴': '左轴',
|
|
|
- '最大值': this.leftLimitData[0],
|
|
|
- '最小值': this.leftLimitData[1]
|
|
|
+ '最大值': this.chartLimit.max,
|
|
|
+ '最小值': this.chartLimit.min
|
|
|
},
|
|
|
{
|
|
|
'y轴': '右轴',
|
|
|
- '最大值': this.rightLimitData[0],
|
|
|
- '最小值': this.rightLimitData[1]
|
|
|
+ '最大值': this.chartLimit.rightMax,
|
|
|
+ '最小值': this.chartLimit.rightMin
|
|
|
},
|
|
|
{
|
|
|
'y轴': '右二轴',
|
|
|
- '最大值': this.rightTwoLimitData[0],
|
|
|
- '最小值': this.rightTwoLimitData[1]
|
|
|
+ '最大值': this.chartLimit.rightTwoMax,
|
|
|
+ '最小值': this.chartLimit.rightTwoMin
|
|
|
}
|
|
|
])
|
|
|
},
|
|
@@ -2729,11 +2759,6 @@ export const chartSetMixin = {
|
|
|
Min: Math.min(...arr)
|
|
|
}
|
|
|
},
|
|
|
- //输入框改变上下限时触发
|
|
|
- changeAxisLimit() {
|
|
|
- this.setAddChartDefault&&this.setAddChartDefault();
|
|
|
- this.setChartOptionHandle(this.tableData);
|
|
|
- },
|
|
|
//图表详情-设置图表上下限
|
|
|
setLimitData(tableData=[]){
|
|
|
const {
|
|
@@ -2744,51 +2769,56 @@ export const chartSetMixin = {
|
|
|
MinMaxSave
|
|
|
} = this.chartInfo
|
|
|
if(MinMaxSave){
|
|
|
- this.leftLimitData = [Number(LeftMax),Number(LeftMin)]
|
|
|
- this.rightLimitData = [Number(RightMax),Number(RightMin)]
|
|
|
- this.rightTwoLimitData = [Number(Right2Max),Number(Right2Min)]
|
|
|
+ this.chartLimit.min = Number(LeftMin)
|
|
|
+ this.chartLimit.max = Number(LeftMax)
|
|
|
+ this.chartLimit.rightMin = Number(RightMin)
|
|
|
+ this.chartLimit.rightMax = Number(RightMax)
|
|
|
+ this.chartLimit.rightTwoMin = Number(Right2Min)
|
|
|
+ this.chartLimit.rightTwoMax = Number(Right2Max)
|
|
|
//若用户修改过,则检测轴的上下限是否为空,若为空,则需要计算对应轴的上下限
|
|
|
- this.checkLimit(tableData)
|
|
|
+ this.checkChartLimit(tableData)
|
|
|
}else{
|
|
|
this.calcYAxislimit(tableData)
|
|
|
}
|
|
|
},
|
|
|
- checkLimit(tableData=[]){
|
|
|
+ checkChartLimit(tableData=[]){
|
|
|
//散点图单独处理
|
|
|
if(this.chartInfo.ChartType===5){
|
|
|
if(tableData[1]){
|
|
|
- if(Number(this.leftLimitData[0])===0&&Number(this.leftLimitData[1])===0){
|
|
|
- this.leftLimitData = [tableData[1].MaxData,tableData[1].MinData]
|
|
|
+ const {min,max} = this.chartLimit
|
|
|
+ if(Number(min)===0&&Number(max)===0){
|
|
|
+ this.chartLimit.min = tableData[1].MinData
|
|
|
+ this.chartLimit.max = tableData[1].MaxData
|
|
|
}
|
|
|
}
|
|
|
return
|
|
|
}
|
|
|
+ const {
|
|
|
+ min,max,rightMin,rightMax,rightTwoMin,rightTwoMax
|
|
|
+ } = this.chartLimit
|
|
|
//若轴的上下限均为0,则不管用户有没有修改过,都重新赋值
|
|
|
- if(Number(this.leftLimitData[0])===0&&Number(this.leftLimitData[1])===0){
|
|
|
+ if(Number(min)===0&&Number(max)===0){
|
|
|
const leftData = tableData.filter(i=>i.IsAxis===1).map(i=>[Number(i.MinData),Number(i.MaxData)])
|
|
|
if(leftData.length){
|
|
|
const {Max,Min} = this.calcLimit(leftData.flat())
|
|
|
- this.leftLimitData = [Max,Min]
|
|
|
- }else{
|
|
|
- this.leftLimitData = [0,0]
|
|
|
+ this.chartLimit.min=Min
|
|
|
+ this.chartLimit.max=Max
|
|
|
}
|
|
|
}
|
|
|
- if(Number(this.rightLimitData[0])===0&&Number(this.rightLimitData[1])===0){
|
|
|
+ if(Number(rightMin)===0&&Number(rightMax)===0){
|
|
|
const rightData = tableData.filter(i => !i.IsAxis).map(i=>[Number(i.MinData),Number(i.MaxData)])
|
|
|
if(rightData.length){
|
|
|
const {Max,Min} = this.calcLimit(rightData.flat())
|
|
|
- this.rightLimitData = [Max,Min]
|
|
|
- }else{
|
|
|
- this.rightLimitData = [0,0]
|
|
|
+ this.chartLimit.rightMin = Min
|
|
|
+ this.chartLimit.rightMax = Max
|
|
|
}
|
|
|
}
|
|
|
- if(Number(this.rightTwoLimitData[0])===0&&Number(this.rightTwoLimitData[1])===0){
|
|
|
+ if(Number(rightTwoMin)===0&&Number(rightTwoMax)===0){
|
|
|
const rightTwoData = tableData.filter(i=>i.IsAxis===2).map(i=>[Number(i.MinData),Number(i.MaxData)])
|
|
|
if(rightTwoData.length){
|
|
|
const {Max,Min} = this.calcLimit(rightTwoData.flat())
|
|
|
- this.rightTwoLimitData = [Max,Min]
|
|
|
- }else{
|
|
|
- this.rightTwoLimitData = [0,0]
|
|
|
+ this.chartLimit.rightTwoMin = Min
|
|
|
+ this.chartLimit.rightTwoMax = Max
|
|
|
}
|
|
|
}
|
|
|
},
|