|
@@ -597,8 +597,8 @@ export const chartSetMixin = {
|
|
|
const useTableLimit = ['/predictEdb','/chartThemeSet'].includes(this.$route.path)
|
|
|
let minLimit = 0,maxLimit = 0
|
|
|
if(useTableLimit){
|
|
|
- minLimit = this.tableData[sameSideIndex].MinData
|
|
|
- maxLimit = this.tableData[sameSideIndex].MaxData
|
|
|
+ minLimit = newval[sameSideIndex].MinData
|
|
|
+ maxLimit = newval[sameSideIndex].MaxData
|
|
|
}else{
|
|
|
const limitMap = {
|
|
|
0:this.rightLimitData||[],
|
|
@@ -787,21 +787,22 @@ export const chartSetMixin = {
|
|
|
? -1
|
|
|
: newval.findIndex((item) => item.IsAxis===2);
|
|
|
|
|
|
- //在添加编辑页,min max为重新计算过的min max 其他页面不管
|
|
|
- const isCalcLimit = ['/addchart','/editchart'].includes(this.$route.path)
|
|
|
+
|
|
|
+ //获取对应轴的上下限
|
|
|
+ //预测指标-走势图;图表配置-主题设置;不使用自定义上下限,剔除
|
|
|
+ const useTableLimit = ['/predictEdb','/chartThemeSet'].includes(this.$route.path)
|
|
|
let minLimit = 0,maxLimit = 0
|
|
|
- //如果该图表没标记过
|
|
|
- if(isCalcLimit&&!this.chartInfo.hasLimitEdit){
|
|
|
+ if(useTableLimit){
|
|
|
+ minLimit = chartData[sameSideIndex].MinData
|
|
|
+ maxLimit = chartData[sameSideIndex].MaxData
|
|
|
+ }else{
|
|
|
const limitMap = {
|
|
|
0:this.rightLimitData||[],
|
|
|
1:this.leftLimitData||[],
|
|
|
2:this.rightTwoLimitData||[]
|
|
|
}
|
|
|
- if(limitMap[chartData[sameSideIndex].IsAxis]){
|
|
|
- const arr = limitMap[chartData[sameSideIndex].IsAxis]
|
|
|
- minLimit = arr[1]||0
|
|
|
- maxLimit = arr[0]||0
|
|
|
- }
|
|
|
+ minLimit = limitMap[item.IsAxis][1]||0
|
|
|
+ maxLimit = limitMap[item.IsAxis][0]||0
|
|
|
}
|
|
|
|
|
|
//y轴
|
|
@@ -834,8 +835,8 @@ export const chartSetMixin = {
|
|
|
},
|
|
|
opposite: [0,2].includes(item.IsAxis),
|
|
|
reversed: item.IsOrder,
|
|
|
- min: (isCalcLimit&&!this.chartInfo.hasLimitEdit)?Number(minLimit):Number(chartData[sameSideIndex].MinData),
|
|
|
- max: (isCalcLimit&&!this.chartInfo.hasLimitEdit)?Number(maxLimit):Number(chartData[sameSideIndex].MaxData),
|
|
|
+ min: Number(minLimit),
|
|
|
+ max: Number(maxLimit),
|
|
|
tickWidth: 1,
|
|
|
visible: serie_yIndex === index && sameSideIndex ===index,
|
|
|
plotBands: this.setAxisPlotAreas(item.IsAxis),
|
|
@@ -932,6 +933,18 @@ export const chartSetMixin = {
|
|
|
let seasonYdata = [],
|
|
|
seasonData = [];
|
|
|
|
|
|
+ //获取对应轴的上下限
|
|
|
+ //预测指标-走势图;图表配置-主题设置;不使用自定义上下限,剔除
|
|
|
+ const useTableLimit = ['/predictEdb','/chartThemeSet'].includes(this.$route.path)
|
|
|
+ let minLimit = 0,maxLimit = 0
|
|
|
+ if(useTableLimit){
|
|
|
+ minLimit = chartData.MinData
|
|
|
+ maxLimit = chartData.MaxData
|
|
|
+ }else{
|
|
|
+ minLimit = this.leftLimitData[1]||0
|
|
|
+ maxLimit = this.leftLimitData[0]||0
|
|
|
+ }
|
|
|
+
|
|
|
//数据列
|
|
|
for (let j of chartDataHandle) {
|
|
|
//预测指标配置
|
|
@@ -982,8 +995,8 @@ export const chartSetMixin = {
|
|
|
textAlign: 'left',
|
|
|
reserveSpace: false
|
|
|
},
|
|
|
- max: Number(chartData.MaxData),
|
|
|
- min: Number(chartData.MinData),
|
|
|
+ max: Number(maxLimit),
|
|
|
+ min: Number(minLimit),
|
|
|
plotBands: this.setAxisPlotAreas(1),
|
|
|
plotLines: this.setAxisPlotLines(1)
|
|
|
}];
|
|
@@ -1104,6 +1117,18 @@ export const chartSetMixin = {
|
|
|
this.isSetExtremeValue = false;
|
|
|
}
|
|
|
|
|
|
+ //获取对应轴的上下限
|
|
|
+ //预测指标-走势图;图表配置-主题设置;不使用自定义上下限,剔除
|
|
|
+ const useTableLimit = ['/predictEdb','/chartThemeSet'].includes(this.$route.path)
|
|
|
+ let minLimit = 0,maxLimit = 0
|
|
|
+ if(useTableLimit){
|
|
|
+ minLimit = Math.max(...real_data.map(_ => _.y));
|
|
|
+ maxLimit = Math.min(...real_data.map(_ => _.y));
|
|
|
+ }else{
|
|
|
+ minLimit = this.leftLimitData[1]||0
|
|
|
+ maxLimit = this.leftLimitData[0]||0
|
|
|
+ }
|
|
|
+
|
|
|
const { IsOrder,ChartColor } = newval[0];
|
|
|
//y轴
|
|
|
let yAxis = {
|
|
@@ -2699,37 +2724,41 @@ export const chartSetMixin = {
|
|
|
this.leftLimitData = [Number(LeftMax),Number(LeftMin)]
|
|
|
this.rightLimitData = [Number(RightMax),Number(RightMin)]
|
|
|
this.rightTwoLimitData = [Number(Right2Max),Number(Right2Min)]
|
|
|
- //若轴的上下限均为0,则不管用户有没有修改过,都重新赋值
|
|
|
- if(this.leftLimitData[0]===0&&this.leftLimitData[1]===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.checkLimit(tableData)
|
|
|
+ }else{
|
|
|
+ this.calcYAxislimit(tableData)
|
|
|
+ }
|
|
|
+ },
|
|
|
+ checkLimit(tableData=[]){
|
|
|
+ //若轴的上下限均为0,则不管用户有没有修改过,都重新赋值
|
|
|
+ if(Number(this.leftLimitData[0])===0&&Number(this.leftLimitData[1])===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]
|
|
|
}
|
|
|
- if(this.rightLimitData[0]===0&&this.rightLimitData[1]===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]
|
|
|
- }
|
|
|
+ }
|
|
|
+ if(Number(this.rightLimitData[0])===0&&Number(this.rightLimitData[1])===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]
|
|
|
}
|
|
|
- if(this.rightTwoLimitData[0]===0&&this.rightTwoLimitData[1]===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]
|
|
|
- }
|
|
|
+ }
|
|
|
+ if(Number(this.rightTwoLimitData[0])===0&&Number(this.rightTwoLimitData[1])===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]
|
|
|
}
|
|
|
- }else{
|
|
|
- this.calcYAxislimit(tableData)
|
|
|
}
|
|
|
- }
|
|
|
+ },
|
|
|
}
|
|
|
}
|