|
@@ -139,6 +139,7 @@ export const chartSetMixin = {
|
|
|
|
|
|
chartItemStyleArr:[
|
|
|
{ label: '曲线图', key: 1 ,value: 'spline'},
|
|
|
+ { label: '折线图', key: 2 ,value: 'line'},
|
|
|
// { label: '堆积面积图', key: 3 ,value: 'areaspline'},
|
|
|
{ label: '堆积柱状图', key: 4 ,value: 'column'},
|
|
|
],//组合图可选样式
|
|
@@ -547,7 +548,7 @@ export const chartSetMixin = {
|
|
|
3: this.setStackOrCombinChart,
|
|
|
4: this.setStackOrCombinChart,
|
|
|
5: this.setScatterChart,
|
|
|
- 6: this.setStackOrCombinChart
|
|
|
+ 6: this.setStackOrCombinChart,
|
|
|
};
|
|
|
|
|
|
chartSetMap[this.chartInfo.ChartType]&&chartSetMap[this.chartInfo.ChartType](newval)
|
|
@@ -570,10 +571,12 @@ export const chartSetMixin = {
|
|
|
this.rightTwoIndex = newval.findIndex((item) => item.IsAxis ===2);
|
|
|
}
|
|
|
|
|
|
+ /* 主题样式*/
|
|
|
+ const chartTheme = this.chartInfo.ChartThemeStyle ? JSON.parse(this.chartInfo.ChartThemeStyle) : null;
|
|
|
+
|
|
|
//拼接标题 数据列
|
|
|
let data = [];
|
|
|
let ydata = [];
|
|
|
- // let chartData = _.cloneDeep(newval);
|
|
|
//有右二轴时排个序 按照左 右 右2的顺序
|
|
|
let chartData = newval.some(_ =>_.IsAxis===2) ? this.changeEdbOrder(newval) : _.cloneDeep(newval);
|
|
|
|
|
@@ -591,11 +594,12 @@ export const chartSetMixin = {
|
|
|
textCh:item.Unit, // 中文
|
|
|
// 中文不存在,无论英文有无都显示空
|
|
|
textEn:item.UnitEn||item.Unit, // 英文
|
|
|
- style:{},
|
|
|
- styleEn:{}, // 英文样式
|
|
|
+ style:{
|
|
|
+ ...chartTheme&&chartTheme.yAxisOptions.style
|
|
|
+ },
|
|
|
align: 'high',
|
|
|
rotation: 0,
|
|
|
- y: -15,
|
|
|
+ y: -12,
|
|
|
x: (item.IsAxis===0 && this.rightTwoIndex>-1) ? -chartData[this.rightTwoIndex].Unit.length*12 : 0,
|
|
|
textAlign: item.IsAxis===1 ? 'left' : 'right',
|
|
|
reserveSpace: false
|
|
@@ -605,16 +609,19 @@ export const chartSetMixin = {
|
|
|
return ctx.value;
|
|
|
},
|
|
|
align: 'center',
|
|
|
- x: [0,2].includes(item.IsAxis) ? 5 : -5
|
|
|
+ x: [0,2].includes(item.IsAxis) ? 5 : -5,
|
|
|
+ style: {
|
|
|
+ ...chartTheme&&chartTheme.yAxisOptions.style,
|
|
|
+ }
|
|
|
},
|
|
|
opposite: [0,2].includes(item.IsAxis),
|
|
|
reversed: item.IsOrder,
|
|
|
- // // min: Number(chartData[sameSideIndex].MinData),
|
|
|
- // // max: Number(chartData[sameSideIndex].MaxData),
|
|
|
min: Number(item.MinData),
|
|
|
max: Number(item.MaxData),
|
|
|
tickWidth: 1,
|
|
|
- visible: sameSideIndex === index
|
|
|
+ visible: sameSideIndex === index,
|
|
|
+ plotBands: this.setAxisPlotAreas(item.IsAxis),
|
|
|
+ plotLines: this.setAxisPlotLines(item.IsAxis)
|
|
|
};
|
|
|
|
|
|
//拼接标题 判断相同指标名称拼接来源
|
|
@@ -633,18 +640,19 @@ export const chartSetMixin = {
|
|
|
//数据列
|
|
|
let obj = {
|
|
|
data: [],
|
|
|
- type: 'spline',
|
|
|
+ type: (chartTheme&&chartTheme.lineOptions.lineType) || 'spline',
|
|
|
+ dashStyle: (chartTheme&&chartTheme.lineOptions.dashStyle)||'Solid',
|
|
|
yAxis: sameSideIndex,
|
|
|
name:
|
|
|
dynamic_arr.length > 1
|
|
|
- ? `${item.EdbName}(${item.SourceName})${dynamic_tag}`
|
|
|
- : `${item.EdbName}${dynamic_tag}`,
|
|
|
+ ? `${item.EdbAliasName||item.EdbName}(${item.SourceName})${dynamic_tag}`
|
|
|
+ : `${item.EdbAliasName||item.EdbName}${dynamic_tag}`,
|
|
|
nameCh:dynamic_arr.length > 1
|
|
|
- ? `${item.EdbName}(${item.SourceName})${dynamic_tag}`
|
|
|
- : `${item.EdbName}${dynamic_tag}`,
|
|
|
- nameEn:item.EdbNameEn?`${item.EdbNameEn}${dynamic_tag_en}`:`${item.EdbName}${dynamic_tag}`,
|
|
|
+ ? `${item.EdbAliasName||item.EdbName}(${item.SourceName})${dynamic_tag}`
|
|
|
+ : `${item.EdbAliasName||item.EdbName}${dynamic_tag}`,
|
|
|
+ nameEn:item.EdbNameEn?`${item.EdbNameEn}${dynamic_tag_en}`:`${item.EdbAliasName||item.EdbName}${dynamic_tag}`,
|
|
|
color: item.ChartColor,
|
|
|
- lineWidth: Number(item.ChartWidth),
|
|
|
+ lineWidth: Number(item.ChartWidth)||(chartTheme&&chartTheme.lineOptions.lineWidth),
|
|
|
...predict_params
|
|
|
};
|
|
|
item.DataList = item.DataList || [];
|
|
@@ -666,7 +674,12 @@ export const chartSetMixin = {
|
|
|
? Highcharts.dateFormat('%m/%d', ctx.value)
|
|
|
: Highcharts.dateFormat('%y/%m', ctx.value);
|
|
|
},
|
|
|
- }
|
|
|
+ style: {
|
|
|
+ ...chartTheme&&chartTheme.xAxisOptions.style
|
|
|
+ }
|
|
|
+ },
|
|
|
+ plotBands: this.setAxisPlotAreas(3,'datetime'),
|
|
|
+ plotLines: this.setAxisPlotLines(3,'datetime')
|
|
|
}
|
|
|
|
|
|
this.options = {
|
|
@@ -675,8 +688,6 @@ export const chartSetMixin = {
|
|
|
xAxis
|
|
|
};
|
|
|
|
|
|
- console.log(this.options)
|
|
|
-
|
|
|
//滚动相关性独立tooltip
|
|
|
if(this.chartInfo.Source === 4) {
|
|
|
const { LeadValue,LeadUnit } = this.relevanceChartData.CorrelationChartInfo;
|
|
@@ -705,7 +716,7 @@ export const chartSetMixin = {
|
|
|
本来和曲线图逻辑基本一致兼容下即可 为了以后便于维护和阅读还是拆开写吧
|
|
|
*/
|
|
|
setStackOrCombinChart(newval) {
|
|
|
-
|
|
|
+
|
|
|
const chartTypeMap = {
|
|
|
3: 'areaspline',
|
|
|
4: 'column',
|
|
@@ -713,10 +724,12 @@ export const chartSetMixin = {
|
|
|
};
|
|
|
let chartStyle = chartTypeMap[this.chartInfo.ChartType];
|
|
|
|
|
|
+ /* 主题样式*/
|
|
|
+ const chartTheme = this.chartInfo.ChartThemeStyle ? JSON.parse(this.chartInfo.ChartThemeStyle) : null;
|
|
|
+
|
|
|
//拼接标题 数据列
|
|
|
let data = [];
|
|
|
let ydata = [];
|
|
|
- // let chartData = _.cloneDeep(newval);
|
|
|
//有右二轴时排个序 按照左 右 右2的顺序
|
|
|
let chartData = newval.some(_ =>_.IsAxis===2) ? this.changeEdbOrder(newval) : _.cloneDeep(newval);
|
|
|
|
|
@@ -754,35 +767,38 @@ export const chartSetMixin = {
|
|
|
let yItem = {
|
|
|
...basicYAxis,
|
|
|
title: {
|
|
|
- // text: sameSideIndex !== index ? '' : `${item.Unit}`,
|
|
|
text: item.Unit,
|
|
|
textCh:item.Unit, // 中文
|
|
|
// 中文不存在,无论英文有无都显示空
|
|
|
textEn:item.UnitEn||item.Unit, // 英文
|
|
|
- style:{},
|
|
|
- styleEn:{}, // 英文样式
|
|
|
+ style:{
|
|
|
+ ...chartTheme&&chartTheme.yAxisOptions.style
|
|
|
+ },
|
|
|
align: 'high',
|
|
|
rotation: 0,
|
|
|
- y: -15,
|
|
|
+ y: -12,
|
|
|
x: (item.IsAxis===0 && this.rightTwoIndex>-1) ? -chartData[this.rightTwoIndex].Unit.length*12 : 0,
|
|
|
textAlign: item.IsAxis===1 ? 'left' : 'right',
|
|
|
reserveSpace: false
|
|
|
},
|
|
|
labels: {
|
|
|
formatter: function (ctx) {
|
|
|
- // return sameSideIndex !== index ? '' : ctx.value;
|
|
|
return ctx.value;
|
|
|
},
|
|
|
align: 'center',
|
|
|
- x: [0,2].includes(item.IsAxis) ? 5 : -5
|
|
|
+ x: [0,2].includes(item.IsAxis) ? 5 : -5,
|
|
|
+ style: {
|
|
|
+ ...chartTheme&&chartTheme.yAxisOptions.style
|
|
|
+ }
|
|
|
},
|
|
|
opposite: [0,2].includes(item.IsAxis),
|
|
|
reversed: item.IsOrder,
|
|
|
min: Number(chartData[sameSideIndex].MinData),
|
|
|
max: Number(chartData[sameSideIndex].MaxData),
|
|
|
- // tickWidth: sameSideIndex !== index ? 0 : 1,
|
|
|
tickWidth: 1,
|
|
|
- visible: serie_yIndex === index && sameSideIndex ===index
|
|
|
+ visible: serie_yIndex === index && sameSideIndex ===index,
|
|
|
+ plotBands: this.setAxisPlotAreas(item.IsAxis),
|
|
|
+ plotLines: this.setAxisPlotLines(item.IsAxis)
|
|
|
};
|
|
|
|
|
|
//拼接标题 判断相同指标名称拼接来源
|
|
@@ -805,18 +821,18 @@ export const chartSetMixin = {
|
|
|
yAxis: serie_yIndex,
|
|
|
name:
|
|
|
dynamic_arr.length > 1
|
|
|
- ? `${item.EdbName}(${item.SourceName})${dynamic_tag}`
|
|
|
- : `${item.EdbName}${dynamic_tag}`,
|
|
|
+ ? `${item.EdbAliasName||item.EdbName}(${item.SourceName})${dynamic_tag}`
|
|
|
+ : `${item.EdbAliasName||item.EdbName}${dynamic_tag}`,
|
|
|
nameCh:dynamic_arr.length > 1
|
|
|
- ? `${item.EdbName}(${item.SourceName})${dynamic_tag}`
|
|
|
- : `${item.EdbName}${dynamic_tag}`,
|
|
|
- nameEn:item.EdbNameEn?`${item.EdbNameEn}${dynamic_tag_en}`:`${item.EdbName}${dynamic_tag}`,
|
|
|
+ ? `${item.EdbAliasName||item.EdbName}(${item.SourceName})${dynamic_tag}`
|
|
|
+ : `${item.EdbAliasName||item.EdbName}${dynamic_tag}`,
|
|
|
+ nameEn:item.EdbNameEn?`${item.EdbNameEn}${dynamic_tag_en}`:`${item.EdbAliasName||item.EdbName}${dynamic_tag}`,
|
|
|
color: item.ChartColor,
|
|
|
- lineWidth: (this.chartInfo.ChartType === 6 && item.ChartStyle === 'spline') ? Number(item.ChartWidth) : 0,
|
|
|
+ lineWidth: Number(item.ChartWidth)||(chartTheme&&chartTheme.lineOptions.lineWidth),
|
|
|
fillColor: (this.chartInfo.ChartType === 3 || (this.chartInfo.ChartType === 6 && item.ChartStyle === 'areaspline')) ? item.ChartColor : undefined,
|
|
|
borderWidth: 1,
|
|
|
borderColor: item.ChartColor,
|
|
|
- zIndex: (this.chartInfo.ChartType === 6 && item.ChartStyle === 'spline') ? 1 : 0, //防止组合图曲线被遮住
|
|
|
+ zIndex: (this.chartInfo.ChartType === 6 && ['line','spline'].includes(item.ChartStyle)) ? 1 : 0, //防止组合图曲线被遮住
|
|
|
...predict_params
|
|
|
};
|
|
|
item.DataList = item.DataList || [];
|
|
@@ -837,7 +853,12 @@ export const chartSetMixin = {
|
|
|
? Highcharts.dateFormat('%m/%d', ctx.value)
|
|
|
: Highcharts.dateFormat('%y/%m', ctx.value);
|
|
|
},
|
|
|
- }
|
|
|
+ style: {
|
|
|
+ ...chartTheme&&chartTheme.xAxisOptions.style
|
|
|
+ }
|
|
|
+ },
|
|
|
+ plotBands: this.setAxisPlotAreas(3,'datetime'),
|
|
|
+ plotLines: this.setAxisPlotLines(3,'datetime')
|
|
|
}
|
|
|
|
|
|
this.options = {
|
|
@@ -864,115 +885,82 @@ export const chartSetMixin = {
|
|
|
this.isPredictorChart?chartData.DataList.List.filter((item, index) => index > 0):
|
|
|
chartData.DataList.filter((item, index) => index > 0):
|
|
|
chartData.DataList
|
|
|
+ /* 主题样式*/
|
|
|
+ const chartTheme = this.chartInfo.ChartThemeStyle ? JSON.parse(this.chartInfo.ChartThemeStyle) : null;
|
|
|
|
|
|
let seasonYdata = [],
|
|
|
seasonData = [];
|
|
|
- /* 公历数据处理 处理数据列 y轴 */
|
|
|
- // if (this.calendar_type === '公历')
|
|
|
- for (let j of chartDataHandle) {
|
|
|
- //预测指标配置
|
|
|
- let predict_params = chartData.EdbInfoCategoryType === 1 ? this.getSeasonPredictParams(j.CuttingDataTimestamp) : {};
|
|
|
-
|
|
|
- let serie_item = {
|
|
|
- data: [],
|
|
|
- type: chartData.ChartStyle,
|
|
|
- yAxis: 0,
|
|
|
- name: this.isPredictorChart?j.Year:j.ChartLegend,
|
|
|
- ...predict_params
|
|
|
- };
|
|
|
- const data_array = this.calendar_type === '农历' && this.isPredictorChart?_.cloneDeep(j.Items):_.cloneDeep(j.DataList);
|
|
|
- data_array &&
|
|
|
- data_array.forEach((item) => {
|
|
|
- serie_item.data.push([item.DataTimestamp, item.Value]);
|
|
|
- });
|
|
|
- const index = chartDataHandle.findIndex(
|
|
|
- (item) => this.isPredictorChart?item.Year === j.Year:item.ChartLegend === j.ChartLegend
|
|
|
- );
|
|
|
- const s_yItem = {
|
|
|
- labels: {
|
|
|
- formatter: function () {
|
|
|
- let val = this.value;
|
|
|
- return index !== 0 ? '' : val;
|
|
|
- },
|
|
|
- align: 'center',
|
|
|
- },
|
|
|
- title: {
|
|
|
- text: `${chartData.Unit}`,
|
|
|
- textCh:chartData.Unit, // 中文
|
|
|
- // 中文不存在,无论英文有无都显示空
|
|
|
- textEn:chartData.UnitEn||chartData.Unit, // 英文
|
|
|
- style:{},
|
|
|
- styleEn:{}, // 英文样式
|
|
|
- // text: null,
|
|
|
- align: 'high',
|
|
|
- rotation: 0,
|
|
|
- y: -15,
|
|
|
- offset: -(12 * chartData.Unit.length),
|
|
|
- },
|
|
|
- max: Number(chartData.MaxData),
|
|
|
- min: Number(chartData.MinData),
|
|
|
- ...seasonOptions.yAxis,
|
|
|
- };
|
|
|
- seasonData.push(serie_item);
|
|
|
- seasonYdata.push(s_yItem);
|
|
|
- }
|
|
|
|
|
|
- // /* 农历数据处理 */
|
|
|
- // let filterArr =
|
|
|
- // this.calendar_type === '农历'
|
|
|
- // ? chartData.DataList.filter((item, index) => index > 0)
|
|
|
- // : [];
|
|
|
- // if (this.calendar_type === '农历')
|
|
|
- // for (let j of filterArr) {
|
|
|
- // //预测指标配置
|
|
|
- // let predict_params = chartData.EdbInfoCategoryType === 1 ? this.getSeasonPredictParams(j.CuttingDataTimestamp) : {};
|
|
|
-
|
|
|
- // let serie_item = {
|
|
|
- // data: [],
|
|
|
- // type: chartData.ChartStyle,
|
|
|
- // yAxis: 0,
|
|
|
- // name: j.ChartLegend,
|
|
|
- // ...predict_params
|
|
|
- // };
|
|
|
- // const data_array = _.cloneDeep(j.DataList);
|
|
|
- // data_array &&
|
|
|
- // data_array.forEach((item) => {
|
|
|
- // serie_item.data.push([item.DataTimestamp, item.Value]);
|
|
|
- // });
|
|
|
- // const index = filterArr.findIndex((item) => item.ChartLegend === j.ChartLegend);
|
|
|
- // const s_yItem = {
|
|
|
- // labels: {
|
|
|
- // formatter: function () {
|
|
|
- // let val = this.value;
|
|
|
- // return index !== 0 ? '' : val;
|
|
|
- // },
|
|
|
- // align: 'center',
|
|
|
- // },
|
|
|
- // title: {
|
|
|
- // text: `${chartData.Unit}`,
|
|
|
- // textCh:chartData.Unit, // 中文
|
|
|
- // // 中文不存在,无论英文有无都显示空
|
|
|
- // textEn:chartData.UnitEn||chartData.Unit, // 英文
|
|
|
- // styleEn:{}, // 英文样式
|
|
|
- // // text: null,
|
|
|
- // align: 'high',
|
|
|
- // rotation: 0,
|
|
|
- // y: -15,
|
|
|
- // offset: -(12 * chartData.Unit.length),
|
|
|
- // },
|
|
|
- // max: Number(chartData.MaxData),
|
|
|
- // min: Number(chartData.MinData),
|
|
|
- // ...seasonOptions.yAxis,
|
|
|
- // };
|
|
|
- // seasonData.push(serie_item);
|
|
|
- // seasonYdata.push(s_yItem);
|
|
|
- // }
|
|
|
- /* x轴显示月日 提示框显示月日*/
|
|
|
- defaultOpts.xAxis.labels = {
|
|
|
- formatter: function () {
|
|
|
- return Highcharts.dateFormat('%m/%d', this.value);
|
|
|
+ //数据列
|
|
|
+ for (let j of chartDataHandle) {
|
|
|
+ //预测指标配置
|
|
|
+ let predict_params = chartData.EdbInfoCategoryType === 1 ? this.getSeasonPredictParams(j.CuttingDataTimestamp) : {};
|
|
|
+
|
|
|
+ let serie_item = {
|
|
|
+ data: [],
|
|
|
+ type: (chartTheme&&chartTheme.lineOptions.lineType) || chartData.ChartStyle,
|
|
|
+ dashStyle: (chartTheme&&chartTheme.lineOptions.dashStyle)||'Solid',
|
|
|
+ yAxis: 0,
|
|
|
+ name: this.isPredictorChart?j.Year:j.ChartLegend,
|
|
|
+ lineWidth: (chartTheme&&chartTheme.lineOptions.lineWidth) || 1,
|
|
|
+ ...predict_params
|
|
|
+ };
|
|
|
+ const data_array = this.calendar_type === '农历' && this.isPredictorChart?_.cloneDeep(j.Items):_.cloneDeep(j.DataList);
|
|
|
+ data_array && data_array.forEach((item) => {
|
|
|
+ serie_item.data.push([item.DataTimestamp, item.Value]);
|
|
|
+ });
|
|
|
+ seasonData.push(serie_item);
|
|
|
+ }
|
|
|
+
|
|
|
+ //y轴
|
|
|
+ seasonYdata = [{
|
|
|
+ ...seasonOptions.yAxis,
|
|
|
+ labels: {
|
|
|
+ formatter: function () {
|
|
|
+ let val = this.value;
|
|
|
+ return val;
|
|
|
+ },
|
|
|
+ align: 'center',
|
|
|
+ style: {
|
|
|
+ ...chartTheme&&chartTheme.yAxisOptions.style
|
|
|
+ }
|
|
|
},
|
|
|
- };
|
|
|
+ title: {
|
|
|
+ text: `${chartData.Unit}`,
|
|
|
+ textCh:chartData.Unit, // 中文
|
|
|
+ // 中文不存在,无论英文有无都显示空
|
|
|
+ textEn:chartData.UnitEn||chartData.Unit, // 英文
|
|
|
+ style:{
|
|
|
+ ...chartTheme&&chartTheme.yAxisOptions.style
|
|
|
+ },
|
|
|
+ // text: null,
|
|
|
+ align: 'high',
|
|
|
+ rotation: 0,
|
|
|
+ y: -12,
|
|
|
+ x: 0,
|
|
|
+ textAlign: 'left',
|
|
|
+ reserveSpace: false
|
|
|
+ },
|
|
|
+ max: Number(chartData.MaxData),
|
|
|
+ min: Number(chartData.MinData),
|
|
|
+ plotBands: this.setAxisPlotAreas(1),
|
|
|
+ plotLines: this.setAxisPlotLines(1)
|
|
|
+ }];
|
|
|
+
|
|
|
+ /* x轴显示月日 */
|
|
|
+ const xAxis = {
|
|
|
+ ...defaultOpts.xAxis,
|
|
|
+ labels: {
|
|
|
+ formatter: function () {
|
|
|
+ return Highcharts.dateFormat('%m/%d', this.value);
|
|
|
+ },
|
|
|
+ style: {
|
|
|
+ ...chartTheme&&chartTheme.xAxisOptions.style
|
|
|
+ }
|
|
|
+ },
|
|
|
+ plotBands: this.setAxisPlotAreas(3,'datetime'),
|
|
|
+ plotLines: this.setAxisPlotLines(3,'datetime')
|
|
|
+ }
|
|
|
|
|
|
const tooltip = {
|
|
|
...defaultOpts.tooltip,
|
|
@@ -985,49 +973,13 @@ export const chartSetMixin = {
|
|
|
},
|
|
|
xDateFormat: '%m/%d',
|
|
|
}
|
|
|
- let rangeSelector =
|
|
|
- this.calendar_type === '农历' && this.isPredictorChart
|
|
|
- ? {
|
|
|
- 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 colors = chartTheme&&chartTheme.colorsOptions.reverse();
|
|
|
this.options = {
|
|
|
- colors:seasonOptions.colors.slice(-chartDataHandle.length),
|
|
|
+ colors: colors.slice(-chartDataHandle.length),
|
|
|
series: seasonData,
|
|
|
yAxis: seasonYdata,
|
|
|
- rangeSelector,
|
|
|
+ xAxis,
|
|
|
tooltip
|
|
|
};
|
|
|
if(this.currentLang=='en') this.changeOptions()
|
|
@@ -1045,6 +997,9 @@ export const chartSetMixin = {
|
|
|
};
|
|
|
console.log('===========:',this.isSetExtremeValue)
|
|
|
|
|
|
+ /* 主题样式*/
|
|
|
+ const chartTheme = this.chartInfo.ChartThemeStyle ? JSON.parse(this.chartInfo.ChartThemeStyle) : null;
|
|
|
+
|
|
|
// 取2个指标中日期相同的数据
|
|
|
let real_data = [];
|
|
|
let tmpData_date = {};//用来取点对应的日期
|
|
@@ -1117,12 +1072,15 @@ export const chartSetMixin = {
|
|
|
textCh:newval[1].Unit,// 中文
|
|
|
// 中文不存在,无论英文有无都显示空
|
|
|
textEn:newval[1].UnitEn||newval[1].Unit, // 英文
|
|
|
- style:{},
|
|
|
- styleEn:{}, // 英文样式
|
|
|
+ style:{
|
|
|
+ ...chartTheme&&chartTheme.yAxisOptions.style
|
|
|
+ },
|
|
|
align: 'high',
|
|
|
rotation: 0,
|
|
|
- y: -15,
|
|
|
- offset: -(12 * newval[1].Unit.length),
|
|
|
+ y: -12,
|
|
|
+ x:0,
|
|
|
+ textAlign: 'left',
|
|
|
+ reserveSpace: false
|
|
|
},
|
|
|
labels: {
|
|
|
formatter: function (ctx) {
|
|
@@ -1130,12 +1088,42 @@ export const chartSetMixin = {
|
|
|
return val;
|
|
|
},
|
|
|
align: 'center',
|
|
|
+ style:{
|
|
|
+ ...chartTheme&&chartTheme.yAxisOptions.style
|
|
|
+ },
|
|
|
},
|
|
|
opposite: false,
|
|
|
reversed: IsOrder,
|
|
|
min: Number(newval[0].MinData),
|
|
|
max: Number(newval[0].MaxData),
|
|
|
tickWidth: 1,
|
|
|
+ plotBands: this.setAxisPlotAreas(1),
|
|
|
+ plotLines: this.setAxisPlotLines(1)
|
|
|
+ }
|
|
|
+
|
|
|
+ //x轴
|
|
|
+ const xAxis = {
|
|
|
+ ...scatterXAxis,
|
|
|
+ title: {
|
|
|
+ text: `${newval[0].Unit}`,
|
|
|
+ textCh:newval[0].Unit, // 中文
|
|
|
+ // 中文不存在,无论英文有无都显示空
|
|
|
+ textEn:newval[0].UnitEn||newval[0].Unit, // 英文
|
|
|
+ style: {
|
|
|
+ ...chartTheme&&chartTheme.xAxisOptions.style
|
|
|
+ },
|
|
|
+ align: 'high',
|
|
|
+ rotation: 0,
|
|
|
+ x: 0,
|
|
|
+ offset: 20,
|
|
|
+ },
|
|
|
+ labels: {
|
|
|
+ style: {
|
|
|
+ ...chartTheme&&chartTheme.xAxisOptions.style
|
|
|
+ }
|
|
|
+ },
|
|
|
+ plotBands: this.setAxisPlotAreas(3),
|
|
|
+ plotLines: this.setAxisPlotLines(3)
|
|
|
}
|
|
|
|
|
|
//数据列
|
|
@@ -1146,7 +1134,10 @@ export const chartSetMixin = {
|
|
|
nameCh: `${this.chartInfo.ChartName}${IsOrder ? '(逆序)' : ''}`,
|
|
|
nameEn: `${this.chartInfo.ChartNameEn||this.chartInfo.ChartName}${IsOrder ? '(reverse)' : ''}`,
|
|
|
color: ChartColor,
|
|
|
- lineWidth: 0
|
|
|
+ chartType: 'linear',
|
|
|
+ marker: {
|
|
|
+ radius: (chartTheme&&chartTheme.lineOptions.radius)||5,
|
|
|
+ },
|
|
|
}
|
|
|
real_data.forEach(_ => {
|
|
|
series.data.push([_.x,_.y])
|
|
@@ -1158,22 +1149,7 @@ export const chartSetMixin = {
|
|
|
},
|
|
|
series: [ series ],
|
|
|
yAxis,
|
|
|
- xAxis: {
|
|
|
- ...scatterXAxis,
|
|
|
- title: {
|
|
|
- text: `${newval[0].Unit}`,
|
|
|
- textCh:newval[0].Unit, // 中文
|
|
|
- // 中文不存在,无论英文有无都显示空
|
|
|
- textEn:newval[0].UnitEn||newval[0].Unit, // 英文
|
|
|
- style:{},
|
|
|
- styleEn:{}, // 英文样式
|
|
|
- // text: null,
|
|
|
- align: 'high',
|
|
|
- rotation: 0,
|
|
|
- x: 0,
|
|
|
- offset: 20,
|
|
|
- },
|
|
|
- },
|
|
|
+ xAxis,
|
|
|
tooltip
|
|
|
}
|
|
|
if(this.currentLang=='en') this.changeOptions()
|
|
@@ -1186,18 +1162,19 @@ export const chartSetMixin = {
|
|
|
let seriesData = [];
|
|
|
const data = _.cloneDeep(this.barDateList);
|
|
|
|
|
|
+ /* 主题样式*/
|
|
|
+ const chartTheme = this.chartInfo.ChartThemeStyle ? JSON.parse(this.chartInfo.ChartThemeStyle) : null;
|
|
|
+
|
|
|
//x轴
|
|
|
let xAxis = {
|
|
|
...scatterXAxis,
|
|
|
categories: this.barXData,
|
|
|
tickWidth: 1,
|
|
|
- title: {
|
|
|
- text: ``,
|
|
|
- align: 'high',
|
|
|
- rotation: 0,
|
|
|
- x: 0,
|
|
|
- offset: 20,
|
|
|
- },
|
|
|
+ labels: {
|
|
|
+ style: {
|
|
|
+ ...chartTheme&&chartTheme.xAxisOptions.style
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
const { max,min } = this.chartLimit;
|
|
@@ -1211,8 +1188,13 @@ export const chartSetMixin = {
|
|
|
textEn: this.chartInfo.UnitEn,
|
|
|
align: 'high',
|
|
|
rotation: 0,
|
|
|
- y: -15,
|
|
|
- offset: 0,
|
|
|
+ y: -12,
|
|
|
+ x:0,
|
|
|
+ textAlign: 'left',
|
|
|
+ reserveSpace: false,
|
|
|
+ style:{
|
|
|
+ ...chartTheme&&chartTheme.yAxisOptions.style
|
|
|
+ },
|
|
|
},
|
|
|
labels: {
|
|
|
formatter: function (ctx) {
|
|
@@ -1220,11 +1202,16 @@ export const chartSetMixin = {
|
|
|
return val;
|
|
|
},
|
|
|
align: 'center',
|
|
|
+ style:{
|
|
|
+ ...chartTheme&&chartTheme.yAxisOptions.style
|
|
|
+ },
|
|
|
},
|
|
|
min: Number(min),
|
|
|
max: Number(max),
|
|
|
opposite: false,
|
|
|
tickWidth: 1,
|
|
|
+ plotBands: this.setAxisPlotAreas(1),
|
|
|
+ plotLines: this.setAxisPlotLines(1)
|
|
|
}
|
|
|
|
|
|
//数据列
|
|
@@ -1268,18 +1255,19 @@ export const chartSetMixin = {
|
|
|
let seriesData = [];
|
|
|
const data = _.cloneDeep(this.commodityChartData);
|
|
|
|
|
|
+ /* 主题样式*/
|
|
|
+ const chartTheme = this.chartInfo.ChartThemeStyle ? JSON.parse(this.chartInfo.ChartThemeStyle) : null;
|
|
|
+
|
|
|
//x轴
|
|
|
let xAxis = {
|
|
|
...scatterXAxis,
|
|
|
categories: this.commodityXData.map(_ =>_.Name),
|
|
|
tickWidth: 1,
|
|
|
- title: {
|
|
|
- text: ``,
|
|
|
- align: 'high',
|
|
|
- rotation: 0,
|
|
|
- x: 0,
|
|
|
- offset: 20,
|
|
|
- },
|
|
|
+ labels: {
|
|
|
+ style: {
|
|
|
+ ...chartTheme&&chartTheme.xAxisOptions.style
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
const { max,min } = this.chartLimit;
|
|
@@ -1290,10 +1278,14 @@ export const chartSetMixin = {
|
|
|
text: this.commodityEdbList[0].Unit,
|
|
|
textCh: this.commodityEdbList[0].Unit,
|
|
|
textEn: this.commodityEdbList[0].UnitEn||this.commodityEdbList[0].Unit,
|
|
|
+ style:{
|
|
|
+ ...chartTheme&&chartTheme.yAxisOptions.style
|
|
|
+ },
|
|
|
align: 'high',
|
|
|
rotation: 0,
|
|
|
- y: -15,
|
|
|
- offset: 0,
|
|
|
+ y: -12,
|
|
|
+ textAlign: 'left',
|
|
|
+ reserveSpace: false
|
|
|
},
|
|
|
labels: {
|
|
|
formatter: function (ctx) {
|
|
@@ -1301,6 +1293,9 @@ export const chartSetMixin = {
|
|
|
return val;
|
|
|
},
|
|
|
align: 'center',
|
|
|
+ style:{
|
|
|
+ ...chartTheme&&chartTheme.yAxisOptions.style
|
|
|
+ },
|
|
|
},
|
|
|
min: Number(min),
|
|
|
max: Number(max),
|
|
@@ -1316,14 +1311,15 @@ export const chartSetMixin = {
|
|
|
|
|
|
let serie_item = {
|
|
|
data: filterData,
|
|
|
- type: 'spline',
|
|
|
+ type: (chartTheme&&chartTheme.lineOptions.lineType) || 'spline',
|
|
|
+ dashStyle: (chartTheme&&chartTheme.lineOptions.dashStyle)||'Solid',
|
|
|
yAxis: 0,
|
|
|
name: item.Name,
|
|
|
nameCh: item.Name,
|
|
|
nameEn: item.NameEn,
|
|
|
color: item.Color,
|
|
|
chartType: 'linear',
|
|
|
- lineWidth: 3,
|
|
|
+ lineWidth: (chartTheme&&chartTheme.lineOptions.lineWidth) || 3,
|
|
|
marker: {
|
|
|
enabled: false
|
|
|
}
|
|
@@ -1488,6 +1484,10 @@ export const chartSetMixin = {
|
|
|
this.leftIndex = -1;
|
|
|
this.rightIndex = -1;
|
|
|
this.rightTwoIndex = -1;
|
|
|
+
|
|
|
+ /* 主题样式*/
|
|
|
+ const chartTheme = this.chartInfo.ChartThemeStyle ? JSON.parse(this.chartInfo.ChartThemeStyle) : null;
|
|
|
+
|
|
|
// 处理X轴
|
|
|
let xAxis={
|
|
|
categories: this.relevanceChartData.XEdbIdValue,
|
|
@@ -1498,9 +1498,14 @@ export const chartSetMixin = {
|
|
|
textEn:this.relevanceChartData.ChartInfo.Source===3 ? `stage(${this.relevanceUnitEnMap[this.relevanceChartData.CorrelationChartInfo.LeadUnit]})`:null,
|
|
|
align: 'high',
|
|
|
rotation: 0,
|
|
|
- x: 0,
|
|
|
- y:10,
|
|
|
- offset: 20
|
|
|
+ style: {
|
|
|
+ ...chartTheme&&chartTheme.xAxisOptions.style
|
|
|
+ }
|
|
|
+ },
|
|
|
+ labels: {
|
|
|
+ style: {
|
|
|
+ ...chartTheme&&chartTheme.xAxisOptions.style
|
|
|
+ }
|
|
|
},
|
|
|
tickInterval: 1,
|
|
|
offset:0,
|
|
@@ -1516,8 +1521,12 @@ export const chartSetMixin = {
|
|
|
textEn: 'Correlation coefficient',
|
|
|
align: 'high',
|
|
|
rotation: 0,
|
|
|
- y: -15,
|
|
|
- offset: 0,
|
|
|
+ y: -12,
|
|
|
+ textAlign: 'left',
|
|
|
+ reserveSpace: false,
|
|
|
+ style:{
|
|
|
+ ...chartTheme&&chartTheme.yAxisOptions.style
|
|
|
+ },
|
|
|
},
|
|
|
labels: {
|
|
|
formatter: function (ctx) {
|
|
@@ -1525,12 +1534,12 @@ export const chartSetMixin = {
|
|
|
return val;
|
|
|
},
|
|
|
align: 'center',
|
|
|
+ style:{
|
|
|
+ ...chartTheme&&chartTheme.yAxisOptions.style
|
|
|
+ },
|
|
|
},
|
|
|
- // min: -1,
|
|
|
- // max: 1,
|
|
|
opposite: false,
|
|
|
tickWidth: 1,
|
|
|
- // tickInterval:0.2,
|
|
|
}
|
|
|
|
|
|
//处理series
|
|
@@ -1538,14 +1547,15 @@ export const chartSetMixin = {
|
|
|
this.relevanceChartData.YDataList.forEach(item=>{
|
|
|
let serie_item = {
|
|
|
data: item.Value,
|
|
|
- type: 'spline',
|
|
|
+ type: (chartTheme&&chartTheme.lineOptions.lineType) || 'spline',
|
|
|
+ dashStyle: (chartTheme&&chartTheme.lineOptions.dashStyle)||'Solid',
|
|
|
yAxis: 0,
|
|
|
name: item.Name,
|
|
|
nameCh: item.Name,
|
|
|
nameEn: item.NameEn,
|
|
|
color: item.Color,
|
|
|
chartType: 'linear',
|
|
|
- lineWidth: 3,
|
|
|
+ lineWidth: (chartTheme&&chartTheme.lineOptions.lineWidth) || 3,
|
|
|
marker: {
|
|
|
enabled: false
|
|
|
}
|
|
@@ -1605,6 +1615,9 @@ export const chartSetMixin = {
|
|
|
const { DataList,XName,XNameEn,YName,YNameEn } = this.sectionScatterData;
|
|
|
const { min,max,x_min,x_max } = this.chartLimit;
|
|
|
|
|
|
+ /* 主题样式*/
|
|
|
+ const chartTheme = this.chartInfo.ChartThemeStyle ? JSON.parse(this.chartInfo.ChartThemeStyle) : null;
|
|
|
+
|
|
|
//y轴
|
|
|
let yAxis = {
|
|
|
...basicYAxis,
|
|
@@ -1612,15 +1625,23 @@ export const chartSetMixin = {
|
|
|
text: YName,
|
|
|
textCh:YName,// 中文
|
|
|
textEn:YNameEn||YName,
|
|
|
- style:{},
|
|
|
- styleEn:{},
|
|
|
+ style:{
|
|
|
+ ...chartTheme&&chartTheme.yAxisOptions.style
|
|
|
+ },
|
|
|
align: 'middle',
|
|
|
},
|
|
|
+ labels: {
|
|
|
+ style:{
|
|
|
+ ...chartTheme&&chartTheme.yAxisOptions.style
|
|
|
+ },
|
|
|
+ },
|
|
|
opposite: false,
|
|
|
reversed: false,
|
|
|
min: Number(min),
|
|
|
max: Number(max),
|
|
|
tickWidth: 1,
|
|
|
+ plotBands: this.setAxisPlotAreas(1),
|
|
|
+ plotLines: this.setAxisPlotLines(1)
|
|
|
}
|
|
|
|
|
|
//x轴
|
|
@@ -1630,12 +1651,20 @@ export const chartSetMixin = {
|
|
|
text: XName,
|
|
|
textCh:XName,// 中文
|
|
|
textEn:XNameEn || XName,
|
|
|
- style:{},
|
|
|
- styleEn:{},
|
|
|
+ style: {
|
|
|
+ ...chartTheme&&chartTheme.xAxisOptions.style
|
|
|
+ },
|
|
|
align: 'middle',
|
|
|
},
|
|
|
+ labels: {
|
|
|
+ style:{
|
|
|
+ ...chartTheme&&chartTheme.xAxisOptions.style
|
|
|
+ },
|
|
|
+ },
|
|
|
min: Number(x_min),
|
|
|
max: Number(x_max),
|
|
|
+ plotBands: this.setAxisPlotAreas(3),
|
|
|
+ plotLines: this.setAxisPlotLines(3)
|
|
|
}
|
|
|
|
|
|
//数据列
|
|
@@ -1649,9 +1678,11 @@ export const chartSetMixin = {
|
|
|
nameCh: item.Name,
|
|
|
nameEn: item.NameEn||item.Name,
|
|
|
color: item.Color,
|
|
|
- lineWidth: 0,
|
|
|
chartType: 'linear',
|
|
|
- zIndex:1
|
|
|
+ zIndex:1,
|
|
|
+ marker: {
|
|
|
+ radius: (chartTheme&&chartTheme.lineOptions.radius)||5,
|
|
|
+ },
|
|
|
}
|
|
|
item.EdbInfoList.forEach(_ => {
|
|
|
series_item.data.push({
|
|
@@ -1773,17 +1804,18 @@ export const chartSetMixin = {
|
|
|
this.rightIndex = -1;
|
|
|
this.rightTwoIndex = -1;
|
|
|
|
|
|
+ /* 主题样式*/
|
|
|
+ const chartTheme = this.chartInfo.ChartThemeStyle ? JSON.parse(this.chartInfo.ChartThemeStyle) : null;
|
|
|
+
|
|
|
const { DataList,LeftMaxValue,LeftMinValue,RightMaxValue,RightMinValue } = this.statisticFrequencyData;
|
|
|
|
|
|
let xAxis = {
|
|
|
...scatterXAxis,
|
|
|
tickWidth: 1,
|
|
|
- title: {
|
|
|
- text: ``,
|
|
|
- align: 'high',
|
|
|
- rotation: 0,
|
|
|
- x: 0,
|
|
|
- offset: 20,
|
|
|
+ labels: {
|
|
|
+ style: {
|
|
|
+ ...chartTheme&&chartTheme.xAxisOptions.style
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -1798,8 +1830,16 @@ export const chartSetMixin = {
|
|
|
textEn:item.UnitEn||item.Unit,
|
|
|
align: 'high',
|
|
|
rotation: 0,
|
|
|
- y: -15,
|
|
|
- offset: 0,
|
|
|
+ y: -12,
|
|
|
+ reserveSpace: false,
|
|
|
+ style:{
|
|
|
+ ...chartTheme&&chartTheme.yAxisOptions.style
|
|
|
+ },
|
|
|
+ },
|
|
|
+ labels: {
|
|
|
+ style:{
|
|
|
+ ...chartTheme&&chartTheme.yAxisOptions.style
|
|
|
+ },
|
|
|
},
|
|
|
opposite: item.IsAxis===1?false:true,
|
|
|
min: index===0? Number(LeftMinValue):Number(RightMinValue),
|
|
@@ -1809,13 +1849,14 @@ export const chartSetMixin = {
|
|
|
|
|
|
let series_item = {
|
|
|
data: item.Value.map(_ =>[_.X,_.Y]),
|
|
|
- type: 'spline',
|
|
|
+ dashStyle: (chartTheme&&chartTheme.lineOptions.dashStyle)||'Solid',
|
|
|
+ type: (chartTheme&&chartTheme.lineOptions.lineType) || 'spline',
|
|
|
yAxis: index,
|
|
|
name: item.Name,
|
|
|
nameCh: item.Name,
|
|
|
nameEn: item.NameEn||item.Name,
|
|
|
color: item.Color,
|
|
|
- lineWidth: 3,
|
|
|
+ lineWidth: (chartTheme&&chartTheme.lineOptions.lineWidth)||3,
|
|
|
chartType: 'linear',
|
|
|
zIndex:1
|
|
|
}
|
|
@@ -1857,6 +1898,9 @@ export const chartSetMixin = {
|
|
|
this.rightIndex = -1;
|
|
|
this.rightTwoIndex = -1;
|
|
|
|
|
|
+ /* 主题样式*/
|
|
|
+ const chartTheme = this.chartInfo.ChartThemeStyle ? JSON.parse(this.chartInfo.ChartThemeStyle) : null;
|
|
|
+
|
|
|
const { min,max,x_min,x_max } = this.chartLimit;
|
|
|
|
|
|
const { DataList,XName,YName,XNameEn,YNameEn } = this.crossVarietyChartData;
|
|
@@ -1869,6 +1913,14 @@ export const chartSetMixin = {
|
|
|
textCh:YName,// 中文
|
|
|
textEn:YNameEn||YName,
|
|
|
align: 'middle',
|
|
|
+ style: {
|
|
|
+ ...chartTheme&&chartTheme.xAxisOptions.style
|
|
|
+ }
|
|
|
+ },
|
|
|
+ labels: {
|
|
|
+ style: {
|
|
|
+ ...chartTheme&&chartTheme.xAxisOptions.style
|
|
|
+ }
|
|
|
},
|
|
|
opposite: false,
|
|
|
reversed: false,
|
|
@@ -1885,6 +1937,14 @@ export const chartSetMixin = {
|
|
|
textCh:XName,// 中文
|
|
|
textEn:XNameEn || XName,
|
|
|
align: 'middle',
|
|
|
+ style: {
|
|
|
+ ...chartTheme&&chartTheme.xAxisOptions.style
|
|
|
+ }
|
|
|
+ },
|
|
|
+ labels: {
|
|
|
+ style: {
|
|
|
+ ...chartTheme&&chartTheme.xAxisOptions.style
|
|
|
+ }
|
|
|
},
|
|
|
min: Number(x_min),
|
|
|
max: Number(x_max),
|
|
@@ -1901,7 +1961,6 @@ export const chartSetMixin = {
|
|
|
nameCh: item.Name,
|
|
|
nameEn: item.NameEn||item.Name,
|
|
|
color: item.Color,
|
|
|
- lineWidth: 0,
|
|
|
chartType: 'linear',
|
|
|
zIndex:1
|
|
|
}
|
|
@@ -2278,6 +2337,7 @@ export const chartSetMixin = {
|
|
|
sourceMap[this.chartInfo.Source]();
|
|
|
}
|
|
|
},
|
|
|
+
|
|
|
// 设置 起始日期 和 最新日期
|
|
|
setExtremumDate(){
|
|
|
//过滤、排序 拿到起始日期
|
|
@@ -2291,6 +2351,105 @@ export const chartSetMixin = {
|
|
|
.sort((a,b)=> new Date(b).getTime() - new Date(a).getTime())
|
|
|
this.latestDate = endDateList[0]
|
|
|
console.log(this.earliestDate,this.latestDate,'this.latestDate');
|
|
|
+ },
|
|
|
+
|
|
|
+ /* 处理轴的标识线结构 在指定轴位置上拼接标识线
|
|
|
+ 0:右轴 1:左轴 2:右2轴 x轴固定3
|
|
|
+ axisType表示x轴类型 处理时间轴的值 datetime/null
|
|
|
+ */
|
|
|
+ setAxisPlotLines(axis,axisType=null) {
|
|
|
+ const { MarkersLines,ChartType } = this.chartInfo;
|
|
|
+ if(!MarkersLines) return []
|
|
|
+
|
|
|
+ let markerLines = JSON.parse(MarkersLines);
|
|
|
+
|
|
|
+ let arr = markerLines.filter(_ => _.isShow&&_.axis===axis)
|
|
|
+ let plotLines = arr.map(_ => {
|
|
|
+ //是否是x时间轴
|
|
|
+ let isXDateAxis = axis===3&&axisType==='datetime';
|
|
|
+ let markerValue='';
|
|
|
+ if(isXDateAxis) {
|
|
|
+ //季节图x轴额外拼个年份
|
|
|
+ let nowYear = ChartType===2 ? new Date(this.tableData[0].DataList[1].DataList
|
|
|
+[0].DataTimestamp).getFullYear() : '';
|
|
|
+ console.log(nowYear)
|
|
|
+ markerValue = ChartType===2
|
|
|
+ ? new Date(`${nowYear}-${_.value}`).getTime()
|
|
|
+ : new Date(_.value).getTime()
|
|
|
+ }else {
|
|
|
+ markerValue = Number(_.value)
|
|
|
+ }
|
|
|
+
|
|
|
+ return {
|
|
|
+ value: markerValue,
|
|
|
+ dashStyle: _.dashStyle,
|
|
|
+ width: Number(_.lineWidth),
|
|
|
+ color: _.color,
|
|
|
+ label: {
|
|
|
+ text: _.text||'',
|
|
|
+ verticalAlign: _.textPosition,
|
|
|
+ style: {
|
|
|
+ color: _.textColor,
|
|
|
+ fontSize: _.textFontSize
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ })
|
|
|
+ return plotLines
|
|
|
+ },
|
|
|
+
|
|
|
+ /* 处理标识区拼接 axisType表示x轴类型处理时间轴的值 datetime/null */
|
|
|
+ setAxisPlotAreas(axis,axisType=null) {
|
|
|
+ const { MarkersAreas,ChartType } = this.chartInfo;
|
|
|
+ if(!MarkersAreas) return []
|
|
|
+
|
|
|
+ let markerAreas = JSON.parse(MarkersAreas);
|
|
|
+
|
|
|
+ let arr = markerAreas.filter(_ => _.isShow&&_.axis===axis)
|
|
|
+ let plotBands = arr.map(_ => {
|
|
|
+ //是否是x时间轴
|
|
|
+ let isXDateAxis = axis===3&&axisType==='datetime';
|
|
|
+ let fromMarkerValue='',toMarkerValue='';
|
|
|
+ if(isXDateAxis) {
|
|
|
+ //季节图x轴额外拼个年份
|
|
|
+ let nowYear = ChartType===2 ? new Date(this.tableData[0].DataList[1].DataList
|
|
|
+ [0].DataTimestamp).getFullYear() : '';
|
|
|
+ fromMarkerValue = ChartType===2
|
|
|
+ ? new Date(`${nowYear}-${_.fromValue}`).getTime()
|
|
|
+ : new Date(_.fromValue).getTime()
|
|
|
+
|
|
|
+ toMarkerValue = ChartType===2
|
|
|
+ ? new Date(`${nowYear}-${_.toValue}`).getTime()
|
|
|
+ : new Date(_.toValue).getTime()
|
|
|
+ }else {
|
|
|
+ fromMarkerValue = Number(_.fromValue);
|
|
|
+ toMarkerValue = Number(_.toValue);
|
|
|
+ }
|
|
|
+
|
|
|
+ //默认label有些偏移 重新归正下
|
|
|
+ let positionMapValue = {
|
|
|
+ 'top': 12,
|
|
|
+ 'middle': 0,
|
|
|
+ 'bottom': -10
|
|
|
+ }
|
|
|
+
|
|
|
+ return {
|
|
|
+ from: fromMarkerValue,
|
|
|
+ to: toMarkerValue,
|
|
|
+ color: _.color,
|
|
|
+ label: {
|
|
|
+ text: _.text||'',
|
|
|
+ verticalAlign: _.textPosition,
|
|
|
+ style: {
|
|
|
+ color: _.textColor,
|
|
|
+ fontSize: _.textFontSize
|
|
|
+ },
|
|
|
+ y: positionMapValue[_.textPosition]
|
|
|
+ }
|
|
|
+ }
|
|
|
+ })
|
|
|
+
|
|
|
+ return plotBands
|
|
|
}
|
|
|
}
|
|
|
}
|