|
@@ -2,7 +2,7 @@
|
|
|
<template>
|
|
|
<div class="chart-show">
|
|
|
<header class="chart-header" @click="openNew">
|
|
|
- <span class="chart-title" @click.stop @dblclick="copyText">{{ language == 'ch'?chartInfo.ChartName: chartInfo.ChartNameEn}}</span>
|
|
|
+ <span class="chart-title" @click.stop @dblclick="copyText">{{ chartInfo.ChartType === 7 ? chartInfo.ChartName : language == 'ch'?chartInfo.ChartName: chartInfo.ChartNameEn}}</span>
|
|
|
</header>
|
|
|
<template v-if="haveData">
|
|
|
<div
|
|
@@ -88,7 +88,13 @@ export default defineComponent({
|
|
|
options: {},
|
|
|
chartInfo: {},
|
|
|
dataList: [],
|
|
|
- sourceName: ''
|
|
|
+ sourceName: '',
|
|
|
+
|
|
|
+ /* 奇怪柱形图 */
|
|
|
+ barDateList: [],//柱形图的绘图数据
|
|
|
+ barXData: [],//柱形图的x轴
|
|
|
+ barEdbData: [],//柱形图的表格数据 只用于取值
|
|
|
+ barLimit: {}
|
|
|
});
|
|
|
|
|
|
onMounted((): void => {
|
|
@@ -135,13 +141,15 @@ export default defineComponent({
|
|
|
loading.value = false;
|
|
|
state.chartInfo = Data.ChartInfo;
|
|
|
state.dataList = Data.EdbInfoList;
|
|
|
- document.title = language.value=='ch'?Data.ChartInfo.ChartName:Data.ChartInfo.ChartNameEn;
|
|
|
+ document.title = state.chartInfo.ChartType === 7
|
|
|
+ ? Data.ChartInfo.ChartName
|
|
|
+ : language.value==='ch'?Data.ChartInfo.ChartName:Data.ChartInfo.ChartNameEn;
|
|
|
haveData.value = true;
|
|
|
//处理英文研报英文设置不全就展示中文
|
|
|
setLangFromEnReport();
|
|
|
|
|
|
dealSourceHandle();
|
|
|
- setOptions();
|
|
|
+ state.chartInfo.ChartType === 7 ? initBarData(Data) : setOptions();
|
|
|
type === 'refresh' && ElMessage.success('刷新成功');
|
|
|
}catch (e) {
|
|
|
loading.value = false;
|
|
@@ -150,6 +158,24 @@ export default defineComponent({
|
|
|
|
|
|
};
|
|
|
|
|
|
+ /* 获取图表详情后赋值柱状图数据 */
|
|
|
+ const initBarData = (data: { XEdbIdValue: number[]; YDataList: any; EdbInfoList: any; ChartInfo: any; }) => {
|
|
|
+ const { XEdbIdValue,YDataList,EdbInfoList,ChartInfo } = data;
|
|
|
+
|
|
|
+ let xData = XEdbIdValue.map((_:number) => EdbInfoList.find((edb: { EdbInfoId: number; }) => edb.EdbInfoId===_).EdbAliasName)
|
|
|
+ console.log(xData)
|
|
|
+
|
|
|
+ state.barDateList = YDataList;
|
|
|
+ state.barXData = xData;
|
|
|
+ state.barEdbData = EdbInfoList;
|
|
|
+ state.barLimit = {
|
|
|
+ min: Number(ChartInfo.LeftMin),
|
|
|
+ max: Number(ChartInfo.LeftMax)
|
|
|
+ }
|
|
|
+
|
|
|
+ setBarChart();
|
|
|
+ }
|
|
|
+
|
|
|
//处理英文研报的图表英文设置不全的情况
|
|
|
const setLangFromEnReport = () => {
|
|
|
//来源于英文研报
|
|
@@ -808,6 +834,81 @@ export default defineComponent({
|
|
|
console.log(state.options)
|
|
|
}
|
|
|
|
|
|
+ /* 奇怪柱状图 和以上逻辑无公用点 依赖数据为单独的数据
|
|
|
+ x轴为指标名称的柱形图 以日期作为series
|
|
|
+ */
|
|
|
+ const setBarChart = () => {
|
|
|
+ const {barDateList,barXData,barLimit} = state;
|
|
|
+ let seriesData: { data: any; type: string; yAxis: number; name: any; color: any; chartType: string; }[] = [];
|
|
|
+ const data = _.cloneDeep(barDateList);
|
|
|
+
|
|
|
+ //x轴
|
|
|
+ let xAxis = {
|
|
|
+ ...scatterXAxis,
|
|
|
+ categories: barXData,
|
|
|
+ tickWidth: 1,
|
|
|
+ title: {
|
|
|
+ text: ``,
|
|
|
+ align: 'high',
|
|
|
+ rotation: 0,
|
|
|
+ x: 0,
|
|
|
+ offset: 20,
|
|
|
+ },
|
|
|
+ }
|
|
|
+
|
|
|
+ const { max,min } = barLimit;
|
|
|
+ console.log(max,min)
|
|
|
+ //y轴
|
|
|
+ let yAxis = {
|
|
|
+ ...basicYAxis,
|
|
|
+ title: {
|
|
|
+ text: ``,
|
|
|
+ align: 'high',
|
|
|
+ rotation: 0,
|
|
|
+ y: -15,
|
|
|
+ offset: 0,
|
|
|
+ },
|
|
|
+ labels: {
|
|
|
+ formatter: function (ctx:any) {
|
|
|
+ let val = ctx.value;
|
|
|
+ return val;
|
|
|
+ },
|
|
|
+ align: 'center',
|
|
|
+ },
|
|
|
+ min: Number(min),
|
|
|
+ max: Number(max),
|
|
|
+ opposite: false,
|
|
|
+ tickWidth: 1,
|
|
|
+ }
|
|
|
+
|
|
|
+ //数据列
|
|
|
+ data.forEach((item: { Value: number; Name: string; Date: string; Color: string; }) => {
|
|
|
+ let serie_item = {
|
|
|
+ data: item.Value,
|
|
|
+ type: 'column',
|
|
|
+ yAxis: 0,
|
|
|
+ name: item.Name || item.Date,
|
|
|
+ color: item.Color,
|
|
|
+ chartType: 'linear'
|
|
|
+ };
|
|
|
+ seriesData.push(serie_item)
|
|
|
+ })
|
|
|
+
|
|
|
+ state.options = {
|
|
|
+ title: {
|
|
|
+ text:''
|
|
|
+ },
|
|
|
+ plotOptions: {
|
|
|
+ column:{
|
|
|
+ stacking: null,
|
|
|
+ },
|
|
|
+ },
|
|
|
+ series: seriesData,
|
|
|
+ yAxis: [ yAxis ],
|
|
|
+ xAxis
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
/* 设置options */
|
|
|
const setOptions = () => {
|
|
|
// ChartType: 1曲线图 2季节图 3面积图 4柱状图 5散点图 6组合图 季节图中公历和农历数据结构不同
|