|
@@ -97,6 +97,10 @@ export default {
|
|
|
|
|
|
/* 曲线 */
|
|
|
setDefaultChart() {
|
|
|
+
|
|
|
+ /* 主题样式*/
|
|
|
+ const chartTheme = this.chartInfo.ChartThemeStyle ? JSON.parse(this.chartInfo.ChartThemeStyle) : null;
|
|
|
+
|
|
|
//拼接标题 数据列
|
|
|
let data = [],
|
|
|
ydata = [];
|
|
@@ -115,10 +119,12 @@ export default {
|
|
|
text: item.Unit,
|
|
|
textCh:item.Unit,//中文单位
|
|
|
textEn:item.Unit?item.UnitEn:'',//英文单位,但如果无中文单位则不显示
|
|
|
- // text: null,
|
|
|
+ style:{
|
|
|
+ ...chartTheme&&chartTheme.yAxisOptions.style
|
|
|
+ },
|
|
|
align: 'high',
|
|
|
rotation: 0,
|
|
|
- y: -15,
|
|
|
+ y: -12,
|
|
|
x: (item.IsAxis===0 && rightTwoIndex>-1) ? -chartData[rightTwoIndex].Unit.length*12 : 0,
|
|
|
textAlign: item.IsAxis===1 ? 'left' : 'right',
|
|
|
reserveSpace: false
|
|
@@ -131,15 +137,17 @@ export default {
|
|
|
align: 'center',
|
|
|
x: [0,2].includes(item.IsAxis) ? 5 : -5,
|
|
|
style: {
|
|
|
- fontSize: '10px',
|
|
|
- },
|
|
|
+ ...chartTheme&&chartTheme.yAxisOptions.style,
|
|
|
+ }
|
|
|
},
|
|
|
opposite: [0,2].includes(item.IsAxis),
|
|
|
reversed: item.IsOrder,
|
|
|
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)
|
|
|
};
|
|
|
|
|
|
// //拼接标题 判断相同指标名称拼接来源
|
|
@@ -157,19 +165,20 @@ export default {
|
|
|
|
|
|
//中英文名称
|
|
|
const nameCh = 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}`
|
|
|
const nameEn = item.EdbNameEn?`${item.EdbNameEn}${dynamic_tag_en}`:''
|
|
|
//数据列
|
|
|
let obj = {
|
|
|
data: [],
|
|
|
- type: 'spline',
|
|
|
+ type: (chartTheme&&chartTheme.lineOptions.lineType) || 'spline',
|
|
|
+ dashStyle: (chartTheme&&chartTheme.lineOptions.dashStyle)||'Solid',
|
|
|
yAxis: sameSideIndex,
|
|
|
name:nameCh,
|
|
|
nameCh:nameCh,
|
|
|
nameEn:nameEn,
|
|
|
color: item.ChartColor,
|
|
|
- lineWidth: Number(item.ChartWidth),
|
|
|
+ lineWidth: Number(item.ChartWidth)||(chartTheme&&chartTheme.lineOptions.lineWidth),
|
|
|
...predict_params
|
|
|
};
|
|
|
item.DataList = item.DataList || [];
|
|
@@ -191,7 +200,12 @@ export default {
|
|
|
? 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 = {
|
|
@@ -230,6 +244,9 @@ export default {
|
|
|
};
|
|
|
let chartStyle = chartTypeMap[this.chartInfo.ChartType];
|
|
|
|
|
|
+ /* 主题样式*/
|
|
|
+ const chartTheme = this.chartInfo.ChartThemeStyle ? JSON.parse(this.chartInfo.ChartThemeStyle) : null;
|
|
|
+
|
|
|
//拼接标题 数据列
|
|
|
let data = [],
|
|
|
ydata = [];
|
|
@@ -260,14 +277,15 @@ export default {
|
|
|
let yItem = {
|
|
|
...basicYAxis,
|
|
|
title: {
|
|
|
- //text: sameSideIndex !== index ? '' : `${item.Unit}`,
|
|
|
text:item.Unit,
|
|
|
textCh:item.Unit,//中文单位
|
|
|
textEn:item.Unit?item.UnitEn:'',//英文单位,但如果无中文单位则不显示
|
|
|
- // text: null,
|
|
|
+ style:{
|
|
|
+ ...chartTheme&&chartTheme.yAxisOptions.style
|
|
|
+ },
|
|
|
align: 'high',
|
|
|
rotation: 0,
|
|
|
- y: -15,
|
|
|
+ y: -12,
|
|
|
x: (item.IsAxis===0 && rightTwoIndex>-1) ? -chartData[rightTwoIndex].Unit.length*12 : 0,
|
|
|
textAlign: item.IsAxis===1 ? 'left' : 'right',
|
|
|
reserveSpace: false
|
|
@@ -280,15 +298,17 @@ export default {
|
|
|
align: 'center',
|
|
|
x: [0,2].includes(item.IsAxis) ? 5 : -5,
|
|
|
style: {
|
|
|
- fontSize: '10px',
|
|
|
- },
|
|
|
+ ...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,
|
|
|
- visible: serie_yIndex === index && sameSideIndex ===index
|
|
|
+ visible: serie_yIndex === index && sameSideIndex ===index,
|
|
|
+ plotBands: this.setAxisPlotAreas(item.IsAxis),
|
|
|
+ plotLines: this.setAxisPlotLines(item.IsAxis)
|
|
|
};
|
|
|
|
|
|
// //拼接标题 判断相同指标名称拼接来源
|
|
@@ -306,8 +326,8 @@ export default {
|
|
|
|
|
|
//中英文名称
|
|
|
const nameCh = 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}`
|
|
|
const nameEn = item.EdbNameEn?`${item.EdbNameEn}${dynamic_tag_en}`:''
|
|
|
|
|
|
//数据列
|
|
@@ -319,11 +339,11 @@ export default {
|
|
|
nameCh:nameCh,
|
|
|
nameEn:nameEn,
|
|
|
color: item.ChartColor,
|
|
|
- lineWidth: (this.chartInfo.ChartType === 6 && item.ChartStyle === 'spline') ? Number(item.ChartWidth) : 0,
|
|
|
- fillColor: (this.chartInfo.ChartType === 3 || (this.chartInfo.ChartType === 6 && item.ChartStyle === 'areaspline')) ? item.ChartColor : undefined,
|
|
|
+ lineWidth: Number(item.ChartWidth),
|
|
|
+ // 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 || [];
|
|
@@ -339,13 +359,18 @@ export default {
|
|
|
let isLessThanOneYear = this.xTimeDiffer();
|
|
|
let xAxis = {
|
|
|
...defaultOpts.xAxis,
|
|
|
- labels: {
|
|
|
+ labels: {
|
|
|
formatter: function (ctx) {
|
|
|
return isLessThanOneYear
|
|
|
? 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 = {
|
|
@@ -360,6 +385,9 @@ export default {
|
|
|
/* 季节性图的图表配置 */
|
|
|
const chartData = this.dataList[0];
|
|
|
|
|
|
+ /* 主题样式*/
|
|
|
+ const chartTheme = this.chartInfo.ChartThemeStyle ? JSON.parse(this.chartInfo.ChartThemeStyle) : null;
|
|
|
+
|
|
|
|
|
|
// 农历数据需要去除第一项 在ETA1.0.5之后,除了这里 农历和公历处理逻辑一样
|
|
|
const temChartDataList=chartData.DataList||[]
|
|
@@ -367,115 +395,64 @@ export default {
|
|
|
temChartDataList.filter((item, index) => index > 0):
|
|
|
temChartDataList
|
|
|
let seasonYdata = [],
|
|
|
- seasonData = [],
|
|
|
- chart = {
|
|
|
- spacing: [5, 8, 2, 8],
|
|
|
- };
|
|
|
+ seasonData = []
|
|
|
|
|
|
- /* 公历数据处理 处理数据列 y轴 */
|
|
|
- // if (this.chartInfo.Calendar === '公历')
|
|
|
- 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: 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 = chartDataHandle.findIndex(
|
|
|
- (item) => item.ChartLegend === j.ChartLegend
|
|
|
- );
|
|
|
- const s_yItem = {
|
|
|
- title: {
|
|
|
- text: `${chartData.Unit}`,
|
|
|
- textCh:chartData.Unit,
|
|
|
- textEn:chartData.Unit?chartData.UnitEn:'',
|
|
|
- // text: null,
|
|
|
- align: 'high',
|
|
|
- rotation: 0,
|
|
|
- y: -15,
|
|
|
- offset: -(12 * chartData.Unit.length),
|
|
|
- },
|
|
|
- labels: {
|
|
|
- formatter: function (ctx) {
|
|
|
- let val = ctx.value;
|
|
|
- return index !== 0 ? '' : val;
|
|
|
- },
|
|
|
- align: 'center',
|
|
|
- style: {
|
|
|
- fontSize: '10px',
|
|
|
- },
|
|
|
- x: -5,
|
|
|
- },
|
|
|
- max: Number(chartData.MaxData),
|
|
|
- min: Number(chartData.MinData),
|
|
|
- ...seasonOptions.yAxis,
|
|
|
- };
|
|
|
- seasonData.push(serie_item);
|
|
|
- seasonYdata.push(s_yItem);
|
|
|
- }
|
|
|
+ //数据列
|
|
|
+ for (let j of chartDataHandle) {
|
|
|
+ //预测指标配置
|
|
|
+ let predict_params = chartData.EdbInfoCategoryType === 1 ? this.getSeasonPredictParams(j.CuttingDataTimestamp) : {};
|
|
|
|
|
|
- /* 农历数据处理 */
|
|
|
- // let filterArr =
|
|
|
- // this.chartInfo.Calendar === '农历'
|
|
|
- // ? chartData.DataList.List.filter((item, index) => index > 0)
|
|
|
- // : [];
|
|
|
- // if (this.chartInfo.Calendar === '农历')
|
|
|
- // 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.Year,
|
|
|
- // ...predict_params
|
|
|
- // };
|
|
|
- // 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 = {
|
|
|
- // title: {
|
|
|
- // text: `${chartData.Unit}`,
|
|
|
- // textCh:chartData.Unit,
|
|
|
- // textEn:chartData.Unit?chartData.UnitEn:'',
|
|
|
- // // text: null,
|
|
|
- // align: 'high',
|
|
|
- // rotation: 0,
|
|
|
- // y: -15,
|
|
|
- // offset: -(12 * chartData.Unit.length),
|
|
|
- // },
|
|
|
- // labels: {
|
|
|
- // formatter: function (ctx) {
|
|
|
- // let val = ctx.value;
|
|
|
- // return index !== 0 ? '' : val;
|
|
|
- // },
|
|
|
- // align: 'center',
|
|
|
- // style: {
|
|
|
- // fontSize: '10px',
|
|
|
- // },
|
|
|
- // x: -5,
|
|
|
- // },
|
|
|
- // max: Number(chartData.MaxData),
|
|
|
- // min: Number(chartData.MinData),
|
|
|
- // ...seasonOptions.yAxis,
|
|
|
- // };
|
|
|
- // seasonData.push(serie_item);
|
|
|
- // seasonYdata.push(s_yItem);
|
|
|
- // }
|
|
|
+ let serie_item = {
|
|
|
+ data: [],
|
|
|
+ type: (chartTheme&&chartTheme.lineOptions.lineType) || chartData.ChartStyle,
|
|
|
+ dashStyle: (chartTheme&&chartTheme.lineOptions.dashStyle)||'Solid',
|
|
|
+ yAxis: 0,
|
|
|
+ name: j.ChartLegend,
|
|
|
+ lineWidth: (chartTheme&&chartTheme.lineOptions.lineWidth) || 1,
|
|
|
+ ...predict_params
|
|
|
+ };
|
|
|
+ const data_array = _.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 = {
|
|
@@ -485,15 +462,15 @@ export default {
|
|
|
return Highcharts.dateFormat('%m/%d', ctx.value);
|
|
|
},
|
|
|
style: {
|
|
|
- fontSize: '10px',
|
|
|
- },
|
|
|
+ ...chartTheme&&chartTheme.xAxisOptions.style
|
|
|
+ }
|
|
|
},
|
|
|
+ plotBands: this.setAxisPlotAreas(3,'datetime'),
|
|
|
+ plotLines: this.setAxisPlotLines(3,'datetime')
|
|
|
};
|
|
|
|
|
|
- // 季节图提示框显示 月/日
|
|
|
- defaultOpts.tooltip = {
|
|
|
- split: false,
|
|
|
- shared: true,
|
|
|
+ const tooltip = {
|
|
|
+ ...defaultOpts.tooltip,
|
|
|
dateTimeLabelFormats: {
|
|
|
// 时间格式化字符
|
|
|
day: '%m/%d',
|
|
@@ -502,53 +479,15 @@ export default {
|
|
|
year: '%m/%d',
|
|
|
},
|
|
|
xDateFormat: '%m/%d',
|
|
|
- valueDecimals: 2,
|
|
|
- };
|
|
|
-
|
|
|
- //农历默认选中一年数据并隐藏按钮 公历显示全部数据
|
|
|
- // let rangeSelector =
|
|
|
- // this.chartInfo.Calendar === '农历'
|
|
|
- // ? {
|
|
|
- // 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: '全部',
|
|
|
- // },
|
|
|
- // ],
|
|
|
- // }
|
|
|
- // : {
|
|
|
- // 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,
|
|
|
xAxis,
|
|
|
- // rangeSelector
|
|
|
+ tooltip
|
|
|
};
|
|
|
},
|
|
|
|
|
@@ -556,6 +495,9 @@ export default {
|
|
|
setScatterChart() {
|
|
|
const chartData = _.cloneDeep(this.dataList);
|
|
|
|
|
|
+ /* 主题样式*/
|
|
|
+ const chartTheme = this.chartInfo.ChartThemeStyle ? JSON.parse(this.chartInfo.ChartThemeStyle) : null;
|
|
|
+
|
|
|
// 取2个指标中日期相同的数据
|
|
|
let real_data = [];
|
|
|
let tmpData_date = {};//用来取点对应的日期
|
|
@@ -617,10 +559,12 @@ export default {
|
|
|
text: `${chartData[1].Unit}`,
|
|
|
textCh:chartData[1].Unit,
|
|
|
textEn:chartData[1].Unit?chartData[1].UnitEn:'',
|
|
|
- // text: null,
|
|
|
+ style:{
|
|
|
+ ...chartTheme&&chartTheme.yAxisOptions.style
|
|
|
+ },
|
|
|
align: 'high',
|
|
|
rotation: 0,
|
|
|
- y: -15,
|
|
|
+ y: -12,
|
|
|
offset: -(12 * chartData[1].Unit.length),
|
|
|
},
|
|
|
labels: {
|
|
@@ -628,6 +572,9 @@ export default {
|
|
|
return ctx.value;
|
|
|
},
|
|
|
align: 'center',
|
|
|
+ style:{
|
|
|
+ ...chartTheme&&chartTheme.yAxisOptions.style
|
|
|
+ },
|
|
|
},
|
|
|
opposite: false,
|
|
|
reversed: IsOrder,
|
|
@@ -645,7 +592,9 @@ export default {
|
|
|
endOnTick: false,
|
|
|
startOnTick: false,
|
|
|
showLastLabel: true,
|
|
|
- tickPixelInterval: 50
|
|
|
+ tickPixelInterval: 50,
|
|
|
+ plotBands: this.setAxisPlotAreas(1),
|
|
|
+ plotLines: this.setAxisPlotLines(1)
|
|
|
}
|
|
|
|
|
|
//数据列
|
|
@@ -655,8 +604,11 @@ export default {
|
|
|
name: `${this.chartInfo.ChartName}${IsOrder ? '(逆序)' : ''}`,
|
|
|
nameCh:`${this.chartInfo.ChartName}${IsOrder ? '(逆序)' : ''}`,
|
|
|
nameEn:this.chartInfo.ChartNameEn?`${this.chartInfo.ChartNameEn}${IsOrder ? '(reverse)' : ''}`:'',
|
|
|
+ chartType: 'linear',
|
|
|
color: ChartColor,
|
|
|
- lineWidth: 0
|
|
|
+ marker: {
|
|
|
+ radius: (chartTheme&&chartTheme.lineOptions.radius)||5,
|
|
|
+ },
|
|
|
}
|
|
|
real_data.forEach(_ => {
|
|
|
series.data.push([_.x,_.y])
|
|
@@ -674,12 +626,21 @@ export default {
|
|
|
text: `${chartData[0].Unit}`,
|
|
|
textCh:chartData[0].Unit,
|
|
|
textEn:chartData[0].Unit?chartData[0].UnitEn:'',
|
|
|
- // text: null,
|
|
|
+ style: {
|
|
|
+ ...chartTheme&&chartTheme.xAxisOptions.style
|
|
|
+ },
|
|
|
align: 'high',
|
|
|
rotation: 0,
|
|
|
x: 0,
|
|
|
offset: 15,
|
|
|
},
|
|
|
+ labels: {
|
|
|
+ style: {
|
|
|
+ ...chartTheme&&chartTheme.xAxisOptions.style
|
|
|
+ }
|
|
|
+ },
|
|
|
+ plotBands: this.setAxisPlotAreas(3),
|
|
|
+ plotLines: this.setAxisPlotLines(3)
|
|
|
},
|
|
|
tooltip
|
|
|
}
|
|
@@ -693,18 +654,19 @@ export default {
|
|
|
let seriesData = [];
|
|
|
const data = _.cloneDeep(this.barDateList);
|
|
|
|
|
|
+ /* 主题样式*/
|
|
|
+ const chartTheme = this.chartInfo.ChartThemeStyle ? JSON.parse(this.chartInfo.ChartThemeStyle) : null;
|
|
|
+
|
|
|
//x轴
|
|
|
let xAxis = {
|
|
|
...scatterXAxis,
|
|
|
categories: this.barXIdData.map(_ => this.barEdbData.find(edb => edb.EdbInfoId===_).EdbAliasName),
|
|
|
tickWidth: 1,
|
|
|
- title: {
|
|
|
- text: ``,
|
|
|
- align: 'high',
|
|
|
- rotation: 0,
|
|
|
- x: 0,
|
|
|
- offset: 20,
|
|
|
- },
|
|
|
+ labels: {
|
|
|
+ style: {
|
|
|
+ ...chartTheme&&chartTheme.xAxisOptions.style
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
const { max,min } = this.chartLimit;
|
|
@@ -717,8 +679,13 @@ export default {
|
|
|
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) {
|
|
@@ -726,11 +693,16 @@ export default {
|
|
|
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)
|
|
|
}
|
|
|
|
|
|
//数据列
|
|
@@ -786,18 +758,19 @@ export default {
|
|
|
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;
|
|
@@ -810,8 +783,12 @@ export default {
|
|
|
textEn: this.commodityEdbList[0].Unit?(this.commodityEdbList[0].UnitEn||'英文单位'):'',
|
|
|
align: 'high',
|
|
|
rotation: 0,
|
|
|
- y: -15,
|
|
|
- offset: 0,
|
|
|
+ y: -12,
|
|
|
+ textAlign: 'left',
|
|
|
+ reserveSpace: false,
|
|
|
+ style:{
|
|
|
+ ...chartTheme&&chartTheme.yAxisOptions.style
|
|
|
+ },
|
|
|
},
|
|
|
labels: {
|
|
|
formatter: function (ctx) {
|
|
@@ -819,6 +796,9 @@ export default {
|
|
|
return val;
|
|
|
},
|
|
|
align: 'center',
|
|
|
+ style:{
|
|
|
+ ...chartTheme&&chartTheme.yAxisOptions.style
|
|
|
+ },
|
|
|
},
|
|
|
min: Number(min),
|
|
|
max: Number(max),
|
|
@@ -833,14 +813,15 @@ export default {
|
|
|
|
|
|
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
|
|
|
}
|
|
@@ -981,6 +962,10 @@ export default {
|
|
|
|
|
|
/* 相关性图表初始化 */
|
|
|
initRelevanceChartData(){
|
|
|
+
|
|
|
+ /* 主题样式*/
|
|
|
+ const chartTheme = this.chartInfo.ChartThemeStyle ? JSON.parse(this.chartInfo.ChartThemeStyle) : null;
|
|
|
+
|
|
|
// 处理X轴
|
|
|
let xAxis={
|
|
|
categories: this.relevanceChartData.XEdbIdValue,
|
|
@@ -991,9 +976,14 @@ export default {
|
|
|
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,
|
|
@@ -1009,8 +999,12 @@ export default {
|
|
|
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) {
|
|
@@ -1018,12 +1012,12 @@ export default {
|
|
|
return val;
|
|
|
},
|
|
|
align: 'center',
|
|
|
+ style:{
|
|
|
+ ...chartTheme&&chartTheme.yAxisOptions.style
|
|
|
+ },
|
|
|
},
|
|
|
- // min: -1,
|
|
|
- // max: 1,
|
|
|
opposite: false,
|
|
|
tickWidth: 1,
|
|
|
- // tickInterval:0.2,
|
|
|
}
|
|
|
|
|
|
//处理series
|
|
@@ -1031,14 +1025,15 @@ export default {
|
|
|
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
|
|
|
}
|
|
@@ -1094,6 +1089,9 @@ export default {
|
|
|
const { DataList,XName,XNameEn,XUnitName,XUnitNameEn,YName,YNameEn,YUnitName,YUnitNameEn } = 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,
|
|
@@ -1101,15 +1099,23 @@ export default {
|
|
|
text: YName,
|
|
|
textCh:YName,// 中文
|
|
|
textEn:YNameEn,
|
|
|
- style:{},
|
|
|
- styleEn:{cursor:'pointer'},
|
|
|
align: 'middle',
|
|
|
+ style:{
|
|
|
+ ...chartTheme&&chartTheme.yAxisOptions.style
|
|
|
+ },
|
|
|
+ },
|
|
|
+ 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轴
|
|
@@ -1119,12 +1125,20 @@ export default {
|
|
|
text: XName,
|
|
|
textCh:XName,// 中文
|
|
|
textEn:XNameEn,
|
|
|
- style:{},
|
|
|
- styleEn:{cursor:'pointer'},
|
|
|
+ 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)
|
|
|
}
|
|
|
|
|
|
//数据列
|
|
@@ -1140,7 +1154,10 @@ export default {
|
|
|
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({
|
|
@@ -1257,17 +1274,18 @@ export default {
|
|
|
/* 统计频率图 */
|
|
|
setStatisticFrequency() {
|
|
|
|
|
|
+ /* 主题样式*/
|
|
|
+ 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
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -1282,8 +1300,16 @@ export default {
|
|
|
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),
|
|
@@ -1293,13 +1319,14 @@ export default {
|
|
|
|
|
|
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
|
|
|
}
|
|
@@ -1341,6 +1368,9 @@ export default {
|
|
|
|
|
|
const { DataList,XName,YName,XNameEn,YNameEn } = this.crossVarietyChartData;
|
|
|
|
|
|
+ /* 主题样式*/
|
|
|
+ const chartTheme = this.chartInfo.ChartThemeStyle ? JSON.parse(this.chartInfo.ChartThemeStyle) : null;
|
|
|
+
|
|
|
//y轴
|
|
|
let yAxis = {
|
|
|
...basicYAxis,
|
|
@@ -1349,6 +1379,14 @@ export default {
|
|
|
textCh:YName,// 中文
|
|
|
textEn:YNameEn||YName,
|
|
|
align: 'middle',
|
|
|
+ style: {
|
|
|
+ ...chartTheme&&chartTheme.xAxisOptions.style
|
|
|
+ }
|
|
|
+ },
|
|
|
+ labels: {
|
|
|
+ style: {
|
|
|
+ ...chartTheme&&chartTheme.xAxisOptions.style
|
|
|
+ }
|
|
|
},
|
|
|
opposite: false,
|
|
|
reversed: false,
|
|
@@ -1365,6 +1403,14 @@ export default {
|
|
|
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),
|
|
@@ -1381,7 +1427,6 @@ export default {
|
|
|
nameCh: item.Name,
|
|
|
nameEn: item.NameEn||item.Name,
|
|
|
color: item.Color,
|
|
|
- lineWidth: 0,
|
|
|
chartType: 'linear',
|
|
|
zIndex:1
|
|
|
}
|
|
@@ -1548,6 +1593,104 @@ export default {
|
|
|
}]
|
|
|
}
|
|
|
: {}
|
|
|
+ },
|
|
|
+
|
|
|
+ /* 处理轴的标识线结构 在指定轴位置上拼接标识线
|
|
|
+ 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.dataList[0].DataList[1].DataList
|
|
|
+ [0].DataTimestamp).getFullYear() : '';
|
|
|
+ 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.dataList[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
|
|
|
}
|
|
|
},
|
|
|
};
|