|
@@ -780,7 +780,10 @@ const setStackOrCombinChart = () => {
|
|
|
// const chartData = _.cloneDeep(dataList);
|
|
|
//有右二轴时排个序 按照左 右 右2的顺序
|
|
|
let chartData = dataList.some(_ =>_.IsAxis===2) ? changeEdbOrder(dataList) : _.cloneDeep(dataList);
|
|
|
-
|
|
|
+ let ExtraConfig={}
|
|
|
+ if(chartInfo.ChartType===3 && chartInfo.ExtraConfig){
|
|
|
+ ExtraConfig=JSON.parse(chartInfo.ExtraConfig)
|
|
|
+ }
|
|
|
//支持的图表类型
|
|
|
const chartTypeMap: IChartType = {
|
|
|
3: 'areaspline',
|
|
@@ -798,7 +801,7 @@ const setStackOrCombinChart = () => {
|
|
|
|
|
|
//堆叠图的yAxis必须一致 数据列所对应的y轴
|
|
|
let serie_yIndex = index;
|
|
|
- if([3,4].includes(chartInfo.ChartType)) {
|
|
|
+ if([4].includes(chartInfo.ChartType) || (chartInfo.ChartType ===3 && ExtraConfig?.IsHeap==1)) {
|
|
|
// 类型为堆叠图时公用第一个指标y轴
|
|
|
serie_yIndex = 0;
|
|
|
} else if(chartInfo.ChartType ===6 && ['areaspline','column'].includes(item.ChartStyle)) {
|
|
@@ -810,7 +813,7 @@ const setStackOrCombinChart = () => {
|
|
|
item.IsOrder = serie_yIndex === index ? item.IsOrder : chartData[serie_yIndex].IsOrder;
|
|
|
|
|
|
// 右2轴下标
|
|
|
- let rightTwoIndex = [3,4].includes(chartInfo.ChartType)
|
|
|
+ let rightTwoIndex = [4].includes(chartInfo.ChartType)
|
|
|
? -1
|
|
|
: dataList.findIndex(item => item.IsAxis===2);
|
|
|
|
|
@@ -833,7 +836,7 @@ const setStackOrCombinChart = () => {
|
|
|
labels: {
|
|
|
formatter: function (ctx: any) {
|
|
|
let val = ctx.value;
|
|
|
- return sameSideIndex !== index ? '' : val;
|
|
|
+ return sameSideIndex !== index ? '' : chartInfo.ChartType===3&&ExtraConfig?.HeapWay==2?val+'%':val;
|
|
|
},
|
|
|
align: 'center',
|
|
|
x: [0,2].includes(item.IsAxis) ? 5 : -5,
|
|
@@ -856,8 +859,8 @@ const setStackOrCombinChart = () => {
|
|
|
},
|
|
|
opposite: [0,2].includes(item.IsAxis),
|
|
|
reversed: item.IsOrder,
|
|
|
- min: Number(minLimit),
|
|
|
- max: Number(maxLimit),
|
|
|
+ min: chartInfo.ChartType===3&&ExtraConfig?.HeapWay==2?null:Number(minLimit),
|
|
|
+ max: chartInfo.ChartType===3&&ExtraConfig?.HeapWay==2?null:Number(maxLimit),
|
|
|
tickWidth: sameSideIndex !== index ? 0 : 1,
|
|
|
visible: serie_yIndex === index && sameSideIndex ===index,
|
|
|
plotBands: setAxisPlotAreas(item.IsAxis),
|
|
@@ -887,7 +890,7 @@ const setStackOrCombinChart = () => {
|
|
|
const lineIndex = chartTheme ? index%chartTheme.lineOptionList.length : index
|
|
|
let obj = {
|
|
|
data: [] as any[],
|
|
|
- type: chartStyle || item.ChartStyle,
|
|
|
+ type: chartInfo.ChartType!==3?(chartStyle || item.ChartStyle):ExtraConfig?.IsHeap==1?'area':((chartTheme && chartTheme.lineOptionList[lineIndex].lineType) || item.ChartStyle),
|
|
|
yAxis: serie_yIndex,
|
|
|
name,
|
|
|
color: item.ChartColor,
|
|
@@ -897,7 +900,8 @@ const setStackOrCombinChart = () => {
|
|
|
borderWidth: 1,
|
|
|
borderColor: item.ChartColor,
|
|
|
...predict_params,
|
|
|
- stacking:chartInfo.ChartType==6&&DataResp.IsHeap!==1?undefined:'normal',
|
|
|
+ stacking:chartInfo.ChartType==6?DataResp.IsHeap!==1?undefined:'normal':chartInfo.ChartType==3&&ExtraConfig?.IsHeap==1?ExtraConfig?.HeapWay==1?'normal':'percent':undefined,
|
|
|
+ threshold: chartInfo.ChartType==3?item.ChartScale?Number(item.ChartScale):0:null
|
|
|
};
|
|
|
|
|
|
item.DataList = item.DataList || []
|
|
@@ -940,11 +944,31 @@ const setStackOrCombinChart = () => {
|
|
|
plotLines: setAxisPlotLines(3,'datetime')
|
|
|
}
|
|
|
|
|
|
- return {
|
|
|
+ let options={
|
|
|
series: data,
|
|
|
yAxis: ydata,
|
|
|
xAxis
|
|
|
- };
|
|
|
+ }
|
|
|
+
|
|
|
+ //面积图百分比tooltip
|
|
|
+ if(chartInfo.ChartType===3&&ExtraConfig?.HeapWay == 2) {
|
|
|
+ options.tooltip = {
|
|
|
+ split: false,
|
|
|
+ shared: true,
|
|
|
+ dateTimeLabelFormats: {
|
|
|
+ // 时间格式化字符
|
|
|
+ day: '%Y/%m/%d',
|
|
|
+ week: "%Y/%m",
|
|
|
+ month: '%Y/%m',
|
|
|
+ year: '%Y/%m',
|
|
|
+ },
|
|
|
+ xDateFormat:'%Y/%m/%d',
|
|
|
+ className:'chart-tooltips-box',
|
|
|
+ pointFormat: '<span style=\"color:{point.color}\">●</span><span>{series.name}</span>' +':<b>{point.percentage:.1f}%</b> ({point.y:,.1f})<br/>'
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ return options;
|
|
|
}
|
|
|
|
|
|
|