|
@@ -551,14 +551,14 @@ export const chartSetMixin = {
|
|
|
6: this.setStackOrCombinChart,
|
|
|
};
|
|
|
|
|
|
- chartSetMap[this.chartInfo.ChartType]&&chartSetMap[this.chartInfo.ChartType]()
|
|
|
+ chartSetMap[this.chartInfo.ChartType]&&chartSetMap[this.chartInfo.ChartType](newval)
|
|
|
|
|
|
//myeta内或者数据指标库内
|
|
|
if(this.$route.path === '/mychart'||this.$route.path==='/database') this.showData = true;
|
|
|
},
|
|
|
|
|
|
/* 曲线图设置 */
|
|
|
- setDefaultChart() {
|
|
|
+ setDefaultChart(newval) {
|
|
|
/* 上下限显示和值的设置 */
|
|
|
if([4,6,7,8].includes(this.chartInfo.Source)) {
|
|
|
this.leftIndex = -1;
|
|
@@ -566,9 +566,9 @@ export const chartSetMixin = {
|
|
|
this.rightTwoIndex = -1;
|
|
|
this.chartLimit = {};
|
|
|
}else {
|
|
|
- this.leftIndex = this.tableData.findIndex((item) => item.IsAxis===1);
|
|
|
- this.rightIndex = this.tableData.findIndex((item) => !item.IsAxis);
|
|
|
- this.rightTwoIndex = this.tableData.findIndex((item) => item.IsAxis ===2);
|
|
|
+ this.leftIndex = newval.findIndex((item) => item.IsAxis===1);
|
|
|
+ this.rightIndex = newval.findIndex((item) => !item.IsAxis);
|
|
|
+ this.rightTwoIndex = newval.findIndex((item) => item.IsAxis ===2);
|
|
|
}
|
|
|
|
|
|
/* 主题样式*/
|
|
@@ -578,7 +578,7 @@ export const chartSetMixin = {
|
|
|
let data = [];
|
|
|
let ydata = [];
|
|
|
//有右二轴时排个序 按照左 右 右2的顺序
|
|
|
- let chartData = this.tableData.some(_ =>_.IsAxis===2) ? this.changeEdbOrder(this.tableData) : _.cloneDeep(this.tableData);
|
|
|
+ let chartData = newval.some(_ =>_.IsAxis===2) ? this.changeEdbOrder(newval) : _.cloneDeep(newval);
|
|
|
|
|
|
chartData.forEach((item, index) => {
|
|
|
//轴位置值相同的下标
|
|
@@ -715,7 +715,7 @@ export const chartSetMixin = {
|
|
|
/* 堆叠图/组合图设置
|
|
|
本来和曲线图逻辑基本一致兼容下即可 为了以后便于维护和阅读还是拆开写吧
|
|
|
*/
|
|
|
- setStackOrCombinChart() {
|
|
|
+ setStackOrCombinChart(newval) {
|
|
|
|
|
|
const chartTypeMap = {
|
|
|
3: 'areaspline',
|
|
@@ -731,7 +731,7 @@ export const chartSetMixin = {
|
|
|
let data = [];
|
|
|
let ydata = [];
|
|
|
//有右二轴时排个序 按照左 右 右2的顺序
|
|
|
- let chartData = this.tableData.some(_ =>_.IsAxis===2) ? this.changeEdbOrder(this.tableData) : _.cloneDeep(this.tableData);
|
|
|
+ let chartData = newval.some(_ =>_.IsAxis===2) ? this.changeEdbOrder(newval) : _.cloneDeep(newval);
|
|
|
|
|
|
chartData.forEach((item, index) => {
|
|
|
//轴位置值相同的下标
|
|
@@ -755,13 +755,13 @@ export const chartSetMixin = {
|
|
|
/* 上下限显示的设置 */
|
|
|
this.leftIndex = [3,4].includes(this.chartInfo.ChartType)
|
|
|
? (chartData[serie_yIndex].IsAxis ? serie_yIndex : -1)
|
|
|
- : this.tableData.findIndex((item) => item.IsAxis===1);
|
|
|
+ : newval.findIndex((item) => item.IsAxis===1);
|
|
|
this.rightIndex = [3,4].includes(this.chartInfo.ChartType)
|
|
|
? (chartData[serie_yIndex].IsAxis ? -1 : serie_yIndex)
|
|
|
- : this.tableData.findIndex((item) => !item.IsAxis);
|
|
|
+ : newval.findIndex((item) => !item.IsAxis);
|
|
|
this.rightTwoIndex = [3,4].includes(this.chartInfo.ChartType)
|
|
|
? -1
|
|
|
- : this.tableData.findIndex((item) => item.IsAxis===2);
|
|
|
+ : newval.findIndex((item) => item.IsAxis===2);
|
|
|
|
|
|
//y轴
|
|
|
let yItem = {
|
|
@@ -870,12 +870,12 @@ export const chartSetMixin = {
|
|
|
},
|
|
|
|
|
|
/* 季节图设置 农历 公历 */
|
|
|
- setSeasonChart() {
|
|
|
+ setSeasonChart(newval) {
|
|
|
/* 季节性图的图表配置 */
|
|
|
this.leftIndex = 0;
|
|
|
this.rightIndex = -1;
|
|
|
this.rightTwoIndex = -1;
|
|
|
- const chartData = this.tableData[0];
|
|
|
+ const chartData = newval[0];
|
|
|
// 农历数据需要去除第一项 农历和公历处理逻辑一样
|
|
|
/**
|
|
|
* isPredictorChart - 预测指标的chartInfo.vue组件内定义的变量
|
|
@@ -984,12 +984,12 @@ export const chartSetMixin = {
|
|
|
},
|
|
|
|
|
|
/* 散点图设置 只允许2指标画图第一个指标值为x轴 第二个指标为y轴 */
|
|
|
- setScatterChart() {
|
|
|
- console.log(this.tableData);
|
|
|
+ setScatterChart(newval) {
|
|
|
+ console.log(newval);
|
|
|
this.leftIndex = 0;
|
|
|
this.rightIndex = -1;
|
|
|
this.rightTwoIndex = -1;
|
|
|
- if(this.tableData.length !== 2) {
|
|
|
+ if(newval.length !== 2) {
|
|
|
this.options = {}
|
|
|
return
|
|
|
};
|
|
@@ -1001,8 +1001,8 @@ export const chartSetMixin = {
|
|
|
// 取2个指标中日期相同的数据
|
|
|
let real_data = [];
|
|
|
let tmpData_date = {};//用来取点对应的日期
|
|
|
- let data1 = _.cloneDeep(this.tableData)[0].DataList || [];
|
|
|
- let data2 = _.cloneDeep(this.tableData)[1].DataList || [];
|
|
|
+ let data1 = _.cloneDeep(newval)[0].DataList || [];
|
|
|
+ let data2 = _.cloneDeep(newval)[1].DataList || [];
|
|
|
data1.forEach(_item => {
|
|
|
data2.forEach(_item2 => {
|
|
|
if(_item.DataTimestamp === _item2.DataTimestamp) {
|
|
@@ -1030,21 +1030,21 @@ export const chartSetMixin = {
|
|
|
let tooltip = {
|
|
|
formatter: function() {
|
|
|
return `<strong>${ tmpData_date[this.x+'_'+this.y].length > 4 ? tmpData_date[this.x+'_'+this.y].slice(0,4).join()+'...' : tmpData_date[this.x+'_'+this.y].join() }</strong><br>
|
|
|
- ${this.tableData[0].EdbName}: <span style="font-weight: 600"> ${this.x}</span><br>
|
|
|
- ${this.tableData[1].EdbName}: <span style="font-weight: 600"> ${this.y}</span>
|
|
|
+ ${newval[0].EdbName}: <span style="font-weight: 600"> ${this.x}</span><br>
|
|
|
+ ${newval[1].EdbName}: <span style="font-weight: 600"> ${this.y}</span>
|
|
|
`
|
|
|
},
|
|
|
// 中文
|
|
|
formatterCh: function() {
|
|
|
return `<strong>${ tmpData_date[this.x+'_'+this.y].length > 4 ? tmpData_date[this.x+'_'+this.y].slice(0,4).join()+'...' : tmpData_date[this.x+'_'+this.y].join() }</strong><br>
|
|
|
- ${this.tableData[0].EdbName}: <span style="font-weight: 600"> ${this.x}</span><br>
|
|
|
- ${this.tableData[1].EdbName}: <span style="font-weight: 600"> ${this.y}</span>
|
|
|
+ ${newval[0].EdbName}: <span style="font-weight: 600"> ${this.x}</span><br>
|
|
|
+ ${newval[1].EdbName}: <span style="font-weight: 600"> ${this.y}</span>
|
|
|
`
|
|
|
},
|
|
|
// 英文
|
|
|
formatterEn: function() {
|
|
|
- let str1 = this.tableData[0].EdbNameEn||this.tableData[0].EdbName;
|
|
|
- let str2 = this.tableData[1].EdbNameEn||this.tableData[1].EdbName;
|
|
|
+ let str1 = newval[0].EdbNameEn||newval[0].EdbName;
|
|
|
+ let str2 = newval[1].EdbNameEn||newval[1].EdbName;
|
|
|
return `<strong>${ tmpData_date[this.x+'_'+this.y].length > 4 ? tmpData_date[this.x+'_'+this.y].slice(0,4).join()+'...' : tmpData_date[this.x+'_'+this.y].join() }</strong><br>
|
|
|
${str1}: <span style="font-weight: 600"> ${this.x}</span><br>
|
|
|
${str2}: <span style="font-weight: 600"> ${this.y}</span>
|
|
@@ -1056,20 +1056,20 @@ export const chartSetMixin = {
|
|
|
if(!this.chartInfo.ChartInfoId && this.isSetExtremeValue) {
|
|
|
let maxYData = Math.max(...real_data.map(_ => _.y));
|
|
|
let minYData = Math.min(...real_data.map(_ => _.y));
|
|
|
- this.tableData[0].MaxData = maxYData;
|
|
|
- this.tableData[0].MinData = minYData;
|
|
|
+ newval[0].MaxData = maxYData;
|
|
|
+ newval[0].MinData = minYData;
|
|
|
this.isSetExtremeValue = false;
|
|
|
}
|
|
|
|
|
|
- const { IsOrder,ChartColor } = this.tableData[0];
|
|
|
+ const { IsOrder,ChartColor } = newval[0];
|
|
|
//y轴
|
|
|
let yAxis = {
|
|
|
...basicYAxis,
|
|
|
title: {
|
|
|
- text: `${this.tableData[1].Unit}`,
|
|
|
- textCh:this.tableData[1].Unit,// 中文
|
|
|
+ text: `${newval[1].Unit}`,
|
|
|
+ textCh:newval[1].Unit,// 中文
|
|
|
// 中文不存在,无论英文有无都显示空
|
|
|
- textEn:this.tableData[1].UnitEn||this.tableData[1].Unit, // 英文
|
|
|
+ textEn:newval[1].UnitEn||newval[1].Unit, // 英文
|
|
|
style:{
|
|
|
...chartTheme&&chartTheme.yAxisOptions.style
|
|
|
},
|
|
@@ -1092,8 +1092,8 @@ export const chartSetMixin = {
|
|
|
},
|
|
|
opposite: false,
|
|
|
reversed: IsOrder,
|
|
|
- min: Number(this.tableData[0].MinData),
|
|
|
- max: Number(this.tableData[0].MaxData),
|
|
|
+ min: Number(newval[0].MinData),
|
|
|
+ max: Number(newval[0].MaxData),
|
|
|
tickWidth: 1,
|
|
|
plotBands: this.setAxisPlotAreas(1),
|
|
|
plotLines: this.setAxisPlotLines(1)
|
|
@@ -1103,10 +1103,10 @@ export const chartSetMixin = {
|
|
|
const xAxis = {
|
|
|
...scatterXAxis,
|
|
|
title: {
|
|
|
- text: `${this.tableData[0].Unit}`,
|
|
|
- textCh:this.tableData[0].Unit, // 中文
|
|
|
+ text: `${newval[0].Unit}`,
|
|
|
+ textCh:newval[0].Unit, // 中文
|
|
|
// 中文不存在,无论英文有无都显示空
|
|
|
- textEn:this.tableData[0].UnitEn||this.tableData[0].Unit, // 英文
|
|
|
+ textEn:newval[0].UnitEn||newval[0].Unit, // 英文
|
|
|
style: {
|
|
|
...chartTheme&&chartTheme.xAxisOptions.style
|
|
|
},
|