Authored by 王涛

Merge branch 'master-500-dev-lushangqing' into 'master-500-dev'

自定义折现堆叠图-数据格式修改



See merge request !25
@@ -138,12 +138,16 @@ export default { @@ -138,12 +138,16 @@ export default {
138 const ananysicData = {}; 138 const ananysicData = {};
139 let xAxisList = []; 139 let xAxisList = [];
140 let series = []; 140 let series = [];
  141 + let kpiUnit='';
141 if(data && data[0]){ 142 if(data && data[0]){
142 if(data[0].data.names && data[0].data.names.length>0){ 143 if(data[0].data.names && data[0].data.names.length>0){
143 xAxisList=data[0].data.names; 144 xAxisList=data[0].data.names;
144 }else{ 145 }else{
145 xAxisList=['00:00', '01:00', '02:00', '03:00', '04:00', '05:00', '06:00', '07:00', '08:00', '09:00', '10:00', '11:00', '12:00'] 146 xAxisList=['00:00', '01:00', '02:00', '03:00', '04:00', '05:00', '06:00', '07:00', '08:00', '09:00', '10:00', '11:00', '12:00']
146 } 147 }
  148 + if(data[0].data.kpiUnit){
  149 + kpiUnit=data[0].data.kpiUnit;
  150 + }
147 if(data[0].data.series && data[0].data.series.length>0){ 151 if(data[0].data.series && data[0].data.series.length>0){
148 series = data[0].data.series; 152 series = data[0].data.series;
149 153
@@ -156,6 +160,7 @@ export default { @@ -156,6 +160,7 @@ export default {
156 } 160 }
157 ananysicData["xAxis"] = xAxisList; 161 ananysicData["xAxis"] = xAxisList;
158 ananysicData["series"] = series; 162 ananysicData["series"] = series;
  163 + ananysicData["kpiUnit"] = kpiUnit;
159 return ananysicData; 164 return ananysicData;
160 }, 165 },
161 // 柱状图、折线图、柱线图 166 // 柱状图、折线图、柱线图
@@ -205,17 +210,40 @@ export default { @@ -205,17 +210,40 @@ export default {
205 210
206 if(yAxisListNew && yAxisListNew.length>0){ 211 if(yAxisListNew && yAxisListNew.length>0){
207 yAxisListNew.map(item=>{ 212 yAxisListNew.map(item=>{
208 - series.push({  
209 - name: item.name,  
210 - type: item.type,  
211 - data: item.data,  
212 - }) 213 + if(item.type=='bar'){
  214 + series.push({
  215 + name: item.name,
  216 + type: item.type,
  217 + data: item.data,
  218 + })
  219 + }else{
  220 + series.push({
  221 + name: item.flag,
  222 + type: 'line',
  223 + data: item.datas,
  224 + })
  225 + }
  226 +
213 }) 227 })
214 228
215 } 229 }
216 - ananysicData["xAxis"] = xAxisList[0]; 230 + if(xAxisList[0]){
  231 + ananysicData["xAxis"] = xAxisList[0];
  232 + }else{
  233 + ananysicData["xAxis"] = newData.data.names;
  234 + }
217 ananysicData["series"] = series; 235 ananysicData["series"] = series;
218 - ananysicData["kpiMap"] = newData.kpiMap; 236 + if(newData.kpiMap){
  237 + ananysicData["kpiMap"] = newData.kpiMap;
  238 + }
  239 + if(newData.kpiUnit){
  240 + ananysicData["kpiUnit"] = newData.kpiUnit;
  241 + }else if(newData.data){
  242 + ananysicData["kpiUnit"] = newData.data.kpiUnit;
  243 +
  244 + }else{
  245 + ananysicData["kpiUnit"] = '';
  246 + }
219 return ananysicData; 247 return ananysicData;
220 }, 248 },
221 //堆叠图 249 //堆叠图
@@ -38,6 +38,21 @@ export const monitorCustomLineStack = { @@ -38,6 +38,21 @@ export const monitorCustomLineStack = {
38 placeholder: '', 38 placeholder: '',
39 value: '' 39 value: ''
40 }, 40 },
  41 + {
  42 + type: 'el-select',
  43 + label: 'kpiId',
  44 + name: 'kpiId',
  45 + required: false,
  46 + placeholder: '',
  47 + selectOptions: [
  48 + {code: 'KPI449F5365', name: 'KPI449F5365(文件系统使用率)'},
  49 + {code: 'KPI97373ED0', name: 'KPI97373ED0(磁盘IO读速率)'},
  50 + {code: 'KPI95378FE0', name: 'KPI95378FE0(磁盘IO写速率)'},
  51 + {code: 'KPI66BD013F', name: 'KPI66BD013F(磁盘IO处理时间)'},
  52 + {code: 'KPI3E6ED38B', name: 'KPI3E6ED38B(磁盘IO响应时间)'}
  53 + ],
  54 + value: 'KPI449F5365',
  55 + },
41 [ 56 [
42 { 57 {
43 name: '折线设置', 58 name: '折线设置',
@@ -56,7 +71,7 @@ export const monitorCustomLineStack = { @@ -56,7 +71,7 @@ export const monitorCustomLineStack = {
56 name: 'pointSize', 71 name: 'pointSize',
57 required: false, 72 required: false,
58 placeholder: '', 73 placeholder: '',
59 - value: 5, 74 + value: 6,
60 }, 75 },
61 { 76 {
62 type: 'el-switch', 77 type: 'el-switch',
@@ -88,7 +103,7 @@ export const monitorCustomLineStack = { @@ -88,7 +103,7 @@ export const monitorCustomLineStack = {
88 name: 'lineWidth', 103 name: 'lineWidth',
89 required: false, 104 required: false,
90 placeholder: '', 105 placeholder: '',
91 - value: 4, 106 + value: 1,
92 }, 107 },
93 ], 108 ],
94 }, 109 },
@@ -109,7 +124,7 @@ export const monitorCustomLineStack = { @@ -109,7 +124,7 @@ export const monitorCustomLineStack = {
109 name: 'titleText', 124 name: 'titleText',
110 required: false, 125 required: false,
111 placeholder: '', 126 placeholder: '',
112 - value: '', 127 + value: '文件系统使用率',
113 }, 128 },
114 { 129 {
115 type: 'vue-color', 130 type: 'vue-color',
@@ -117,7 +132,7 @@ export const monitorCustomLineStack = { @@ -117,7 +132,7 @@ export const monitorCustomLineStack = {
117 name: 'textColor', 132 name: 'textColor',
118 required: false, 133 required: false,
119 placeholder: '', 134 placeholder: '',
120 - value: '#FFD700' 135 + value: '#1e9fff'
121 }, 136 },
122 { 137 {
123 type: 'el-select', 138 type: 'el-select',
@@ -131,7 +146,7 @@ export const monitorCustomLineStack = { @@ -131,7 +146,7 @@ export const monitorCustomLineStack = {
131 {code: 'bolder', name: '特粗体'}, 146 {code: 'bolder', name: '特粗体'},
132 {code: 'lighter', name: '细体'} 147 {code: 'lighter', name: '细体'}
133 ], 148 ],
134 - value: 'normal' 149 + value: 'bold'
135 }, 150 },
136 { 151 {
137 type: 'el-input-number', 152 type: 'el-input-number',
@@ -139,7 +154,7 @@ export const monitorCustomLineStack = { @@ -139,7 +154,7 @@ export const monitorCustomLineStack = {
139 name: 'textFontSize', 154 name: 'textFontSize',
140 required: false, 155 required: false,
141 placeholder: '', 156 placeholder: '',
142 - value: 20 157 + value: 16
143 }, 158 },
144 { 159 {
145 type: 'el-select', 160 type: 'el-select',
@@ -152,7 +167,7 @@ export const monitorCustomLineStack = { @@ -152,7 +167,7 @@ export const monitorCustomLineStack = {
152 {code: 'left', name: '左对齐'}, 167 {code: 'left', name: '左对齐'},
153 {code: 'right', name: '右对齐'}, 168 {code: 'right', name: '右对齐'},
154 ], 169 ],
155 - value: 'center' 170 + value: 'left'
156 }, 171 },
157 { 172 {
158 type: 'el-input-text', 173 type: 'el-input-text',
@@ -259,7 +274,7 @@ export const monitorCustomLineStack = { @@ -259,7 +274,7 @@ export const monitorCustomLineStack = {
259 name: 'Xcolor', 274 name: 'Xcolor',
260 required: false, 275 required: false,
261 placeholder: '', 276 placeholder: '',
262 - value: '#fff', 277 + value: '#666',
263 }, 278 },
264 { 279 {
265 type: 'el-input-number', 280 type: 'el-input-number',
@@ -275,7 +290,7 @@ export const monitorCustomLineStack = { @@ -275,7 +290,7 @@ export const monitorCustomLineStack = {
275 name: 'lineColorX', 290 name: 'lineColorX',
276 required: false, 291 required: false,
277 placeholder: '', 292 placeholder: '',
278 - value: '#fff', 293 + value: '#c9c9c9',
279 }, 294 },
280 { 295 {
281 type: 'el-switch', 296 type: 'el-switch',
@@ -293,7 +308,23 @@ export const monitorCustomLineStack = { @@ -293,7 +308,23 @@ export const monitorCustomLineStack = {
293 placeholder: '', 308 placeholder: '',
294 value: '#fff', 309 value: '#fff',
295 310
296 - } 311 + },
  312 + {
  313 + type: 'el-switch',
  314 + label: '分割区显示',
  315 + name: 'splitArea',
  316 + require: false,
  317 + placeholder: '',
  318 + value: true,
  319 + },
  320 + {
  321 + type: 'vue-color',
  322 + label: '分割区颜色',
  323 + name: 'splitAreaColor',
  324 + required: false,
  325 + placeholder: '',
  326 + value: 'rgba(200,200,200,0.1)',
  327 + },
297 ], 328 ],
298 }, 329 },
299 { 330 {
@@ -353,7 +384,7 @@ export const monitorCustomLineStack = { @@ -353,7 +384,7 @@ export const monitorCustomLineStack = {
353 name: 'colorY', 384 name: 'colorY',
354 required: false, 385 required: false,
355 placeholder: '', 386 placeholder: '',
356 - value: '#fff', 387 + value: '#666',
357 }, 388 },
358 { 389 {
359 type: 'el-input-number', 390 type: 'el-input-number',
@@ -369,7 +400,7 @@ export const monitorCustomLineStack = { @@ -369,7 +400,7 @@ export const monitorCustomLineStack = {
369 name: 'lineColorY', 400 name: 'lineColorY',
370 required: false, 401 required: false,
371 placeholder: '', 402 placeholder: '',
372 - value: '#fff', 403 + value: '#c9c9c9',
373 }, { 404 }, {
374 type: 'el-switch', 405 type: 'el-switch',
375 label: '分割线显示', 406 label: '分割线显示',
@@ -413,7 +444,7 @@ export const monitorCustomLineStack = { @@ -413,7 +444,7 @@ export const monitorCustomLineStack = {
413 name: 'subTextColor', 444 name: 'subTextColor',
414 required: false, 445 required: false,
415 placeholder: '', 446 placeholder: '',
416 - value: '#fff' 447 + value: '#666'
417 }, 448 },
418 { 449 {
419 type: 'el-select', 450 type: 'el-select',
@@ -497,12 +528,20 @@ export const monitorCustomLineStack = { @@ -497,12 +528,20 @@ export const monitorCustomLineStack = {
497 value: true, 528 value: true,
498 }, 529 },
499 { 530 {
  531 + type: 'el-switch',
  532 + label: '图例文字显示',
  533 + name: 'isShowLegendText',
  534 + required: false,
  535 + placeholder: '',
  536 + value: false,
  537 + },
  538 + {
500 type: 'vue-color', 539 type: 'vue-color',
501 label: '字体颜色', 540 label: '字体颜色',
502 name: 'lengedColor', 541 name: 'lengedColor',
503 required: false, 542 required: false,
504 placeholder: '', 543 placeholder: '',
505 - value: '#fff', 544 + value: '#666',
506 }, 545 },
507 { 546 {
508 type: 'el-input-number', 547 type: 'el-input-number',
@@ -510,7 +549,7 @@ export const monitorCustomLineStack = { @@ -510,7 +549,7 @@ export const monitorCustomLineStack = {
510 name: 'lengedFontSize', 549 name: 'lengedFontSize',
511 required: false, 550 required: false,
512 placeholder: '', 551 placeholder: '',
513 - value: 16, 552 + value: 14,
514 }, 553 },
515 { 554 {
516 type: 'el-input-number', 555 type: 'el-input-number',
@@ -567,7 +606,8 @@ export const monitorCustomLineStack = { @@ -567,7 +606,8 @@ export const monitorCustomLineStack = {
567 label: '', 606 label: '',
568 name: 'customColor', 607 name: 'customColor',
569 required: false, 608 required: false,
570 - value: [{color: '#ff7f50'}, {color: '#87cefa'}, {color: '#da70d6'}, {color: '#32cd32'}, {color: '#6495ed'}], 609 + value: [{color: '#facf5b'}, {color: '#C04DD8'}, {color: '#F5A1EB'}, {color: '#F36093'},
  610 + {color: '#C2E74D'},{color:'#3DC3FF'},{color:'#B850ED'}],
571 }, 611 },
572 ], 612 ],
573 }, 613 },
@@ -626,7 +666,7 @@ export const monitorCustomLineStack = { @@ -626,7 +666,7 @@ export const monitorCustomLineStack = {
626 placeholder: '', 666 placeholder: '',
627 relactiveDom: 'dataType', 667 relactiveDom: 'dataType',
628 relactiveDomValue: 'dynamicData', 668 relactiveDomValue: 'dynamicData',
629 - chartType: 'widget-stackchart', 669 + chartType: 'monitor-stackchart',
630 dictKey: 'STACK_PROPERTIES', 670 dictKey: 'STACK_PROPERTIES',
631 value: '', 671 value: '',
632 }, 672 },
@@ -89,7 +89,8 @@ export default { @@ -89,7 +89,8 @@ export default {
89 optionsStyle: {}, // 样式 89 optionsStyle: {}, // 样式
90 optionsData: {}, // 数据 90 optionsData: {}, // 数据
91 optionsCollapse: {}, // 图标属性 91 optionsCollapse: {}, // 图标属性
92 - optionsSetup: {} 92 + optionsSetup: {},
  93 + kpiUnit:'',//单位
93 }; 94 };
94 }, 95 },
95 computed: { 96 computed: {
@@ -312,6 +313,7 @@ export default { @@ -312,6 +313,7 @@ export default {
312 // tooltip 设置 313 // tooltip 设置
313 setOptionsTooltip() { 314 setOptionsTooltip() {
314 const optionsSetup = this.optionsSetup; 315 const optionsSetup = this.optionsSetup;
  316 + let that=this;
315 const tooltip = { 317 const tooltip = {
316 trigger: "axis", 318 trigger: "axis",
317 show: true, 319 show: true,
@@ -321,7 +323,7 @@ export default { @@ -321,7 +323,7 @@ export default {
321 }, 323 },
322 formatter:function (param) { 324 formatter:function (param) {
323 let kpiName=optionsSetup.titleText; 325 let kpiName=optionsSetup.titleText;
324 - let kpiUnit=''; 326 + let kpiUnit=that.kpiUnit;
325 // 鼠标悬浮线上提示 327 // 鼠标悬浮线上提示
326 // 顶部提示 328 // 顶部提示
327 let tips = '<table>'; 329 let tips = '<table>';
@@ -436,6 +438,7 @@ export default { @@ -436,6 +438,7 @@ export default {
436 }); 438 });
437 }, 439 },
438 renderingFn(val) { 440 renderingFn(val) {
  441 + this.kpiUnit=val.kpiUnit;
439 // x轴 442 // x轴
440 this.options.xAxis.data = val.xAxis; 443 this.options.xAxis.data = val.xAxis;
441 // series 444 // series
@@ -56,7 +56,8 @@ export default { @@ -56,7 +56,8 @@ export default {
56 optionsStyle: {}, // 样式 56 optionsStyle: {}, // 样式
57 optionsData: {}, // 数据 57 optionsData: {}, // 数据
58 optionsSetup: {}, 58 optionsSetup: {},
59 - flagInter: null 59 + flagInter: null,
  60 + kpiUnit:'',//单位
60 }; 61 };
61 }, 62 },
62 computed: { 63 computed: {
@@ -154,6 +155,14 @@ export default { @@ -154,6 +155,14 @@ export default {
154 lineStyle: { 155 lineStyle: {
155 color: optionsSetup.splitLineColorX 156 color: optionsSetup.splitLineColorX
156 } 157 }
  158 + },
  159 + boundaryGap: ['10%', '10%'],
  160 + splitArea: {
  161 + show: optionsSetup.splitArea,
  162 + areaStyle: {
  163 + color: [optionsSetup.splitAreaColor, 'transparent'
  164 + ]
  165 + }
157 } 166 }
158 }; 167 };
159 this.options.xAxis = xAxis; 168 this.options.xAxis = xAxis;
@@ -211,12 +220,39 @@ export default { @@ -211,12 +220,39 @@ export default {
211 // tooltip 提示语设置,鼠标放置显示 220 // tooltip 提示语设置,鼠标放置显示
212 setOptionsTooltip() { 221 setOptionsTooltip() {
213 const optionsSetup = this.optionsSetup; 222 const optionsSetup = this.optionsSetup;
  223 + let that=this;
214 const tooltip = { 224 const tooltip = {
215 - trigger: "item", 225 + trigger: "axis",
216 show: true, 226 show: true,
217 textStyle: { 227 textStyle: {
218 color: optionsSetup.lineColor, 228 color: optionsSetup.lineColor,
219 - fontSize: optionsSetup.tipsFontSize 229 + fontSize: optionsSetup.tipsFontSize,
  230 + },
  231 + formatter:function (param) {
  232 + let kpiName=optionsSetup.titleText;
  233 + let kpiUnit=that.kpiUnit;
  234 + // 鼠标悬浮线上提示
  235 + // 顶部提示
  236 + var tips = '<table>';
  237 + if (param.length == 1) {
  238 + tips += "<tr><td colspan='4'>" + param[0].name + "</td></tr>";
  239 + } else {
  240 + tips += "<tr><td colspan='4'>" + kpiName + " " + param[0].name + "</td></tr>";
  241 + }
  242 + // 每一条提示
  243 + $.each(param, function (i, v) {
  244 + tips += "<tr><td>" + v.marker + "</td>";
  245 + tips += '<td>';
  246 + if (param.length == 1) {
  247 + tips += (kpiName + ' ');
  248 + }
  249 + tips += (v.seriesName && v.seriesName != '1' && !/series[0-9]+/.test(v.seriesName)) ? v.seriesName : '';
  250 + tips += '</td>'
  251 + tips += "<td>:&nbsp;</td><td>" + v.value;
  252 + tips += (kpiUnit == '%' ? kpiUnit : (' ' + kpiUnit)) + "</td></tr>";
  253 + });
  254 + tips += '</table>'
  255 + return tips;
220 } 256 }
221 }; 257 };
222 this.options.tooltip = tooltip; 258 this.options.tooltip = tooltip;
@@ -239,7 +275,7 @@ export default { @@ -239,7 +275,7 @@ export default {
239 const legend = this.options.legend; 275 const legend = this.options.legend;
240 legend.show = optionsSetup.isShowLegend; 276 legend.show = optionsSetup.isShowLegend;
241 legend.left = optionsSetup.lateralPosition; 277 legend.left = optionsSetup.lateralPosition;
242 - legend.top = optionsSetup.longitudinalPosition == "top" ? 0 : "auto"; 278 + legend.top = optionsSetup.longitudinalPosition == "top" ? 20 : "auto";
243 legend.bottom = 279 legend.bottom =
244 optionsSetup.longitudinalPosition == "bottom" ? 0 : "auto"; 280 optionsSetup.longitudinalPosition == "bottom" ? 0 : "auto";
245 legend.orient = optionsSetup.layoutFront; 281 legend.orient = optionsSetup.layoutFront;
@@ -248,6 +284,20 @@ export default { @@ -248,6 +284,20 @@ export default {
248 fontSize: optionsSetup.lengedFontSize 284 fontSize: optionsSetup.lengedFontSize
249 }; 285 };
250 legend.itemWidth = optionsSetup.lengedWidth; 286 legend.itemWidth = optionsSetup.lengedWidth;
  287 + if(!optionsSetup.isShowLegendText){
  288 + legend.formatter= function (name) {
  289 + return '';
  290 + }
  291 + }else{
  292 + legend.formatter= function (name) {
  293 + return name;
  294 + }
  295 + }
  296 + legend.icon= 'circle';
  297 + legend.tooltip= {
  298 + show: true
  299 + }
  300 +
251 }, 301 },
252 // 图例颜色修改 302 // 图例颜色修改
253 setOptionsColor() { 303 setOptionsColor() {
@@ -373,6 +423,7 @@ export default { @@ -373,6 +423,7 @@ export default {
373 }); 423 });
374 }, 424 },
375 renderingFn(optionsSetup, val) { 425 renderingFn(optionsSetup, val) {
  426 + this.kpiUnit=val.kpiUnit;
376 //颜色 427 //颜色
377 const customColor = optionsSetup.customColor; 428 const customColor = optionsSetup.customColor;
378 const arrColor = []; 429 const arrColor = [];
@@ -31,6 +31,7 @@ @@ -31,6 +31,7 @@
31 </template> 31 </template>
32 32
33 <script> 33 <script>
  34 +import echarts from "echarts";
34 import customMenuBox from "../../designerComponents/customMenuBox";//下探组件 35 import customMenuBox from "../../designerComponents/customMenuBox";//下探组件
35 import customDialog from "../../designerComponents/customDialog"; 36 import customDialog from "../../designerComponents/customDialog";
36 import {getTrendBaseUrl} from "@/api/platform"; 37 import {getTrendBaseUrl} from "@/api/platform";