|
@@ -80,26 +80,49 @@ export function chartRender({data,renderId,lang='zh',changeLangIsCheck,showChart
|
|
|
RenderDomId.value=renderId
|
|
|
chartData.value=data
|
|
|
|
|
|
- if([1,3,4,5,6].includes(data.ChartInfo.ChartType)){
|
|
|
+ // if([1,3,4,5,6].includes(data.ChartInfo.ChartType)){
|
|
|
+ // const chartSetMap = {
|
|
|
+ // 1: setSplineOpt,
|
|
|
+ // 3: setStackOrCombinChart,
|
|
|
+ // 4: setStackOrCombinChart,
|
|
|
+ // 5: setScatterOptions,
|
|
|
+ // 6: setStackOrCombinChart
|
|
|
+ // };
|
|
|
+ // chartOpt=chartSetMap[data.ChartInfo.ChartType](data)
|
|
|
+ // }else if(data.ChartInfo.ChartType ===2 ) {
|
|
|
+ // chartOpt=setSeasonOpt(data)
|
|
|
+ // }else if(data.ChartInfo.ChartType ===7){//奇怪柱形图依赖数据
|
|
|
+ // chartOpt=initBarData(data);
|
|
|
+ // }else if(data.ChartInfo.ChartType ===8){//商品价格曲线
|
|
|
+ // chartOpt=initCommodityData(data);
|
|
|
+ // }else if(data.ChartInfo.ChartType ===9){//相关性图
|
|
|
+ // chartOpt=initRelevanceChart(data);
|
|
|
+ // }else if(data.ChartInfo.ChartType ===10){//截面散点图
|
|
|
+ // chartOpt=setSectionScatterChart(data);
|
|
|
+ // }
|
|
|
+ if(data.ChartInfo.Source===1){
|
|
|
const chartSetMap = {
|
|
|
1: setSplineOpt,
|
|
|
+ 2: setSeasonOpt,
|
|
|
3: setStackOrCombinChart,
|
|
|
4: setStackOrCombinChart,
|
|
|
5: setScatterOptions,
|
|
|
- 6: setStackOrCombinChart
|
|
|
+ 6: setStackOrCombinChart,
|
|
|
+ 7: initBarData,
|
|
|
};
|
|
|
chartOpt=chartSetMap[data.ChartInfo.ChartType](data)
|
|
|
- }else if(data.ChartInfo.ChartType ===2 ) {
|
|
|
- chartOpt=setSeasonOpt(data)
|
|
|
- }else if(data.ChartInfo.ChartType ===7){//奇怪柱形图依赖数据
|
|
|
- chartOpt=initBarData(data);
|
|
|
- }else if(data.ChartInfo.ChartType ===8){//商品价格曲线
|
|
|
+ }else if([2,5].includes(data.ChartInfo.Source)){//商品价格曲线
|
|
|
chartOpt=initCommodityData(data);
|
|
|
- }else if(data.ChartInfo.ChartType ===9){//相关性图
|
|
|
+ }else if([3,4].includes(data.ChartInfo.Source)){//相关性 滚动相关性
|
|
|
chartOpt=initRelevanceChart(data);
|
|
|
- }else if(data.ChartInfo.ChartType ===10){//截面散点图
|
|
|
- chartOpt=setSectionScatterChart(data);
|
|
|
+ }else if([6,7,8].includes(data.ChartInfo.Source)){//拟合方程 标准差 百分比
|
|
|
+ chartOpt=setSplineOpt(data);
|
|
|
+ }else if([9].includes(data.ChartInfo.Source)){//统计频率
|
|
|
+ chartOpt=setStatisticFrequency(data);
|
|
|
}
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
options.value={...chartDefaultOpts,...chartOpt}
|
|
|
// 设置图标题
|
|
|
setChartTitle(showChartTitle)
|
|
@@ -343,9 +366,92 @@ function setChartTitle(showChartTitle){
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+//统计频率图
|
|
|
+function setStatisticFrequency(e){
|
|
|
+ axisLimitState.leftIndex=-1
|
|
|
+ axisLimitState.rightIndex=-1
|
|
|
+ axisLimitState.rightTwoIndex=-1
|
|
|
+
|
|
|
+ const { DataList,LeftMaxValue,LeftMinValue,RightMaxValue,RightMinValue } = e.DataResp;
|
|
|
+
|
|
|
+ const xAxis = {
|
|
|
+ ...scatterXAxis,
|
|
|
+ tickWidth: 1,
|
|
|
+ title: {
|
|
|
+ text: ``,
|
|
|
+ align: 'high',
|
|
|
+ rotation: 0,
|
|
|
+ x: 0,
|
|
|
+ offset: 20,
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ //y和系列
|
|
|
+ let yAxis = [],series = [];
|
|
|
+ DataList.forEach((item,index) => {
|
|
|
+ let y_item = {
|
|
|
+ ...basicYAxis,
|
|
|
+ title: {
|
|
|
+ text: item.Unit,
|
|
|
+ textCh:item.Unit,// 中文
|
|
|
+ textEn:item.UnitEn||item.Unit,
|
|
|
+ align: 'high',
|
|
|
+ rotation: 0,
|
|
|
+ y: -15,
|
|
|
+ offset: 0,
|
|
|
+ },
|
|
|
+ opposite: item.IsAxis===1?false:true,
|
|
|
+ min: index===0? Number(LeftMinValue):Number(RightMinValue),
|
|
|
+ max: index===0? Number(LeftMaxValue):Number(RightMaxValue),
|
|
|
+ tickWidth: 1,
|
|
|
+ }
|
|
|
+
|
|
|
+ let series_item = {
|
|
|
+ data: item.Value.map(_ =>[_.X,_.Y]),
|
|
|
+ type: 'spline',
|
|
|
+ yAxis: index,
|
|
|
+ name: item.Name,
|
|
|
+ nameCh: item.Name,
|
|
|
+ nameEn: item.NameEn||item.Name,
|
|
|
+ color: item.Color,
|
|
|
+ lineWidth: 3,
|
|
|
+ chartType: 'linear',
|
|
|
+ zIndex:1
|
|
|
+ }
|
|
|
+
|
|
|
+ series.push(series_item);
|
|
|
+ yAxis.push(y_item)
|
|
|
+ })
|
|
|
+
|
|
|
+ let tooltip = {
|
|
|
+ formatter: function() {
|
|
|
+ let xList = DataList[0].Value.map(_ =>_.X);
|
|
|
+ let step = xList[1]-xList[0];
|
|
|
+ let data_interval = `[${this.x},${this.x+step}]`;
|
|
|
+
|
|
|
+ let str=`<b>${ data_interval }</b>`;
|
|
|
+ this.points.forEach(item => {
|
|
|
+ str += `<br><span style="color:${item.color}">\u25CF</span>${item.series.name}: ${item.y}%<br>`
|
|
|
+ })
|
|
|
+ return str
|
|
|
+ },
|
|
|
+ shared: true
|
|
|
+ }
|
|
|
+
|
|
|
+ return {
|
|
|
+ title: {
|
|
|
+ text:''
|
|
|
+ },
|
|
|
+ tooltip,
|
|
|
+ series,
|
|
|
+ yAxis,
|
|
|
+ xAxis
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
//曲线图
|
|
|
function setSplineOpt(e){
|
|
|
- const data=e.ChartInfo.Source===6?[e.DataResp]:e.EdbInfoList
|
|
|
+ const data=[6,7,8].includes(e.ChartInfo.Source)?[e.DataResp]:e.EdbInfoList
|
|
|
let series=[]
|
|
|
let yAxis=[]
|
|
|
let xAxis = {}
|