|
@@ -537,17 +537,12 @@ export default {
|
|
|
setSeasonOptions() {
|
|
|
console.log(this.tableData)
|
|
|
const chartData = _.cloneDeep(this.tableData);
|
|
|
-
|
|
|
- // 农历数据需要去除第一项 在ETA1.0.5之后,除了这里 农历和公历处理逻辑一样
|
|
|
- const chartDataHandle=this.calendar_type === '农历'?
|
|
|
- chartData.List.filter((item, index) => index > 0):
|
|
|
- chartData
|
|
|
let seasonYdata = [],
|
|
|
seasonData = [];
|
|
|
|
|
|
/* 公历数据处理 处理数据列 y轴 */
|
|
|
- // if (this.calendar_type === '公历')
|
|
|
- for (let j of chartDataHandle) {
|
|
|
+ if (this.calendar_type === '公历')
|
|
|
+ for (let j of chartData) {
|
|
|
|
|
|
let serie_item = {
|
|
|
data: [],
|
|
@@ -560,7 +555,7 @@ export default {
|
|
|
data_array.forEach((item) => {
|
|
|
serie_item.data.push([item.DataTimestamp, item.Value]);
|
|
|
});
|
|
|
- const index = chartDataHandle.findIndex(
|
|
|
+ const index = chartData.findIndex(
|
|
|
(item) => item.Year === j.Year
|
|
|
);
|
|
|
const s_yItem = {
|
|
@@ -588,48 +583,48 @@ export default {
|
|
|
}
|
|
|
|
|
|
/* 农历数据处理 */
|
|
|
- // let filterArr =
|
|
|
- // this.calendar_type === '农历'
|
|
|
- // ? chartData.List.filter((item, index) => index > 0)
|
|
|
- // : [];
|
|
|
- // if (this.calendar_type === '农历')
|
|
|
- // for (let j of filterArr) {
|
|
|
-
|
|
|
- // let serie_item = {
|
|
|
- // data: [],
|
|
|
- // type: 'spline',
|
|
|
- // yAxis: 0,
|
|
|
- // name: j.Year
|
|
|
- // };
|
|
|
- // const data_array = _.cloneDeep(j.Items);
|
|
|
- // data_array &&
|
|
|
- // data_array.forEach((item) => {
|
|
|
- // serie_item.data.push([item.DataTimestamp, item.Value]);
|
|
|
- // });
|
|
|
- // const index = filterArr.findIndex((item) => item.Year === j.Year);
|
|
|
- // const s_yItem = {
|
|
|
- // labels: {
|
|
|
- // formatter: function () {
|
|
|
- // let val = this.value;
|
|
|
- // return index !== 0 ? '' : val;
|
|
|
- // },
|
|
|
- // align: 'center',
|
|
|
- // },
|
|
|
- // title: {
|
|
|
- // text: this.chartLang=='ch'?this.chartInfo.Unit:
|
|
|
- // !this.chartInfo.UnitEn && this.chartInfo.Unit && this.chartInfo.Unit!='无' ? '英文单位':this.chartInfo.UnitEn,
|
|
|
- // align: 'high',
|
|
|
- // rotation: 0,
|
|
|
- // y: -15,
|
|
|
- // offset: -(12 * this.chartInfo.Unit.length),
|
|
|
- // },
|
|
|
- // max: Number(this.chartInfo.MaxValue),
|
|
|
- // min: Number(this.chartInfo.MinValue),
|
|
|
- // ...seasonOptions.yAxis,
|
|
|
- // };
|
|
|
- // seasonData.push(serie_item);
|
|
|
- // seasonYdata.push(s_yItem);
|
|
|
- // }
|
|
|
+ let filterArr =
|
|
|
+ this.calendar_type === '农历'
|
|
|
+ ? chartData.List.filter((item, index) => index > 0)
|
|
|
+ : [];
|
|
|
+ if (this.calendar_type === '农历')
|
|
|
+ for (let j of filterArr) {
|
|
|
+
|
|
|
+ let serie_item = {
|
|
|
+ data: [],
|
|
|
+ type: 'spline',
|
|
|
+ yAxis: 0,
|
|
|
+ name: j.Year
|
|
|
+ };
|
|
|
+ const data_array = _.cloneDeep(j.Items);
|
|
|
+ data_array &&
|
|
|
+ data_array.forEach((item) => {
|
|
|
+ serie_item.data.push([item.DataTimestamp, item.Value]);
|
|
|
+ });
|
|
|
+ const index = filterArr.findIndex((item) => item.Year === j.Year);
|
|
|
+ const s_yItem = {
|
|
|
+ labels: {
|
|
|
+ formatter: function () {
|
|
|
+ let val = this.value;
|
|
|
+ return index !== 0 ? '' : val;
|
|
|
+ },
|
|
|
+ align: 'center',
|
|
|
+ },
|
|
|
+ title: {
|
|
|
+ text: this.chartLang=='ch'?this.chartInfo.Unit:
|
|
|
+ !this.chartInfo.UnitEn && this.chartInfo.Unit && this.chartInfo.Unit!='无' ? '英文单位':this.chartInfo.UnitEn,
|
|
|
+ align: 'high',
|
|
|
+ rotation: 0,
|
|
|
+ y: -15,
|
|
|
+ offset: -(12 * this.chartInfo.Unit.length),
|
|
|
+ },
|
|
|
+ max: Number(this.chartInfo.MaxValue),
|
|
|
+ min: Number(this.chartInfo.MinValue),
|
|
|
+ ...seasonOptions.yAxis,
|
|
|
+ };
|
|
|
+ seasonData.push(serie_item);
|
|
|
+ seasonYdata.push(s_yItem);
|
|
|
+ }
|
|
|
|
|
|
/* x轴显示月日 提示框显示月日*/
|
|
|
defaultOpts.xAxis.labels = {
|
|
@@ -649,49 +644,52 @@ export default {
|
|
|
},
|
|
|
xDateFormat: '%m/%d',
|
|
|
}
|
|
|
- // let rangeSelector =
|
|
|
- // this.calendar_type === '农历'
|
|
|
- // ? {
|
|
|
- // enabled: true,
|
|
|
- // selected: 0,
|
|
|
- // inputStyle: {
|
|
|
- // display: 'none',
|
|
|
- // },
|
|
|
- // labelStyle: {
|
|
|
- // display: 'none',
|
|
|
- // },
|
|
|
- // buttonTheme: {
|
|
|
- // style: {
|
|
|
- // display: 'none',
|
|
|
- // },
|
|
|
- // },
|
|
|
- // buttons: [
|
|
|
- // {
|
|
|
- // type: 'month',
|
|
|
- // count: 12,
|
|
|
- // text: '12月',
|
|
|
- // },
|
|
|
- // {
|
|
|
- // type: 'month',
|
|
|
- // count: 15,
|
|
|
- // text: '15月',
|
|
|
- // },
|
|
|
- // {
|
|
|
- // type: 'all',
|
|
|
- // text: '全部',
|
|
|
- // type: 'all',
|
|
|
- // },
|
|
|
- // ],
|
|
|
- // }
|
|
|
- // : {
|
|
|
- // enabled: false,
|
|
|
- // };
|
|
|
+ let rangeSelector =
|
|
|
+ this.calendar_type === '农历'
|
|
|
+ ? {
|
|
|
+ enabled: true,
|
|
|
+ selected: 0,
|
|
|
+ inputStyle: {
|
|
|
+ display: 'none',
|
|
|
+ },
|
|
|
+ labelStyle: {
|
|
|
+ display: 'none',
|
|
|
+ },
|
|
|
+ buttonTheme: {
|
|
|
+ style: {
|
|
|
+ display: 'none',
|
|
|
+ },
|
|
|
+ },
|
|
|
+ buttons: [
|
|
|
+ {
|
|
|
+ type: 'month',
|
|
|
+ count: 12,
|
|
|
+ text: '12月',
|
|
|
+ },
|
|
|
+ {
|
|
|
+ type: 'month',
|
|
|
+ count: 15,
|
|
|
+ text: '15月',
|
|
|
+ },
|
|
|
+ {
|
|
|
+ type: 'all',
|
|
|
+ text: '全部',
|
|
|
+ type: 'all',
|
|
|
+ },
|
|
|
+ ],
|
|
|
+ }
|
|
|
+ : {
|
|
|
+ enabled: false,
|
|
|
+ };
|
|
|
|
|
|
this.options = {
|
|
|
- colors:seasonOptions.colors.slice(-chartDataHandle.length),
|
|
|
+ colors:
|
|
|
+ this.calendar_type === '公历'
|
|
|
+ ? seasonOptions.colors.slice(-chartData.length)
|
|
|
+ : seasonOptions.colors.slice(-filterArr.length),
|
|
|
series: seasonData,
|
|
|
yAxis: seasonYdata,
|
|
|
- // rangeSelector,
|
|
|
+ rangeSelector,
|
|
|
tooltip
|
|
|
};
|
|
|
console.log(this.options)
|