isc-echarts-ext.js 27.7 KB
Newer Older
fukai committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816
import customed from'./echartsTheme.js';
//	公共属性方法
	function PoinEchart(vueObj,echartsObj,thisDom,resData){		
		this.database = this.processEchartBashData(thisDom);
		this.echartsObj = echartsObj;
		this._renderTo = thisDom;
		this.vueObjs = vueObj;
		this.resData = resData;
		this.bd = {				
				_title:this.database.titles, //一级标题
				_subTitle:this.database.subTitle, //二级标题				
				_titPos:this.database.titPos, //标题位置				
				_typeRadius:this.database.typeRadius, //图表半径
				_typeGrid:this.database.typeGrid, //坐标轴左右间距
				_typeChild:this.database.typeChild, //图表子类型
				_isdataZoom:this.database.dataZoom, //图表是否支持缩放
				//_chartBg:this.database.background.replace(/_+/g,""),//图表背景
				//_chartColor:this.database.color, //设置图表颜色
				_chartBg:this.database.background,//图表背景
				_chartColor:this.database.color, //设置图表颜色
				_toolTipTriger:this.database.toolTipTriger, //提示框触发类型
				_toolTipFormater:this.database.toolTipFormater, //提示框标题格式化
				_tooltipAxisPointer:this.database.tooltipAxisPointer, //设置tooltip x轴的线条
				_isLegend:this.database.legend, // 是否开启图列选项
				_legendPos:this.database.legendPos, //图列对齐方式
				_legendOrient:this.database.legendOrient, // 图列排列方式
				_legendData:resData.legendData, //图列数据
				_height:this.database.height, //图表高度
				_isToolBox:this.database.toolBox, //是否显示工具栏
				_toolBoxSet:this.strToObj(this.database.toolBoxSet), //配置工具栏显示项
				_isToolBoxBrush:this.database.toolBoxBrush, //配置区域选择工具栏显示项
				_toolBoxOrient:this.database.toolBoxSetOrient.toString(), //工具栏排列方式
				_toolBoxPos:this.database.toolBoxPos.replace(/_+/g,"").split(","), //工具栏对齐方式
				_isLineSmooth:this.database.lineSmooth,//线条圆滑开关
				_isLineShadow:this.database.lineShadow, //是否设置线图阴影	
				_symbolSize:parseInt(this.database.symbolSize) || 0, //设置节点大小
				_barWidth:this.database.barWidth || 0, //柱状图宽度  
				_gap:parseInt(this.database.gap), //设置漏斗图内间距大小
				_funnelWidth:this.database.funnelWidth,//漏斗图宽度
				_xAxisData:resData.xAxisData, //x轴格式化数据
				_yAxisData:resData.yAxisData, //y轴格式化数据  
				_seriesd:resData.series, // 图表数据
				_clickFun:this.database.onClick,
				_onLodad:this.database.onLodad,
				_mouseoutFun:this.database.onMouseout,
				_mousemoveFun:this.database.onMousemove,
				_funnelPos:this.database.funnelPos,//漏斗图外间距
				_pieCenter:this.database.pieCenter //饼图间距【0%,0%】左右\上下				
		};
		this._toolBoxSetData = this.toolBoxSetData(this.bd._toolBoxSet);//获取配置工具栏配置项,根据生成的代码给不同的值
		this._options = {
				title:{},
				series:[],
				legend:{},
				tooltip:{
					trigger:"",
					formatter:null
					},
				toolbox:{
					feature:{dataView:"" || null,restore:"" || null}
				},
				grid:{
					top:"",
					left:'',
					right:'',
					bottom:''	
				}
		};
		this.setdataZoom = function(flag){
			if(flag === 'true'){
				this._options.dataZoom = [{type: 'slider',xAxisIndex: 0,filterMode: 'empty'},
					                           {type: 'slider',yAxisIndex: 0,filterMode: 'empty'},
					                           {type: 'inside',xAxisIndex: 0,filterMode: 'empty'},
					                           {type: 'inside',yAxisIndex: 0,filterMode: 'empty'}]
				}else{
					delete this._options.dataZoom;
				}
		};
		//是否设置线图阴影
		 this.setLineShadow = function(flag,setVal){
			if(flag === 'true'){
				setVal.lineStyle =  {
		                normal: {
		                    width: 3,
		                    shadowColor: 'rgba(0,0,0,0.4)',
		                    shadowBlur: 10,
		                    shadowOffsetY: 10
		                }
		            }
			}else{
				delete setVal.lineStyle;
			}
		};
		
	}
//	图表渲染方法
	PoinEchart.prototype.render = function(){
		var _renderDom = this._renderTo;
//		var chartInit = this.echartsObj.echarts.init(_renderDom); //图标初始化
		var chartInit = this.echartsObj.init(_renderDom); //图标初始化		
			chartInit.setOption(this._options,true);//2021-12-20再次渲染数据,如果数据无序会使图例和图上的数据无序,需要加true清除缓存			
		return this;	
	}
	//重置options方法
	PoinEchart.prototype.setOption = function(newoption){		
		var oldData = this._options;
		var op = Object.assign({},oldData,newoption)
		this._options = op;		
		this.render();
		return this;
		}
	//重置options方法
	PoinEchart.prototype.xAxisYAxis = function(){	
		var echart = this;	
		var _xAxisType = this.database.xAxisType, //X轴类型
		_xAxisName = this.database.xAxisName, // x轴名字
		_yAxisType = this.database.yAxisType, //y轴类型
		_yAxisName = this.database.yAxisName, //y轴名字
		_isXAxisTick = this.database.xAxisTick, // 设置X轴刻度轴
		_isXAxisRotate = this.database.xAxisRotate, // x轴是否倾斜45度
		_isYAxisRotate = this.database.yAxisRotate, // y轴是否倾斜45度
		_isYAxisTick = this.database.yAxisTick, // 设置Y轴刻度轴
		boyAxisFormatter = this.database.yAxisFormatter, //y轴格式化
		boxAxisFormatter = this.database.xAxisFormatter, //x轴格式化
		_yAxisMin = parseInt(this.database.yAxisMin) || null, //y轴最小值
		_yAxisMax = parseInt(this.database.yAxisMax) || null, //y轴最大值
		_yAxisInterVal = parseInt(this.database.yAxisInterVal) || null, //y轴刻度间隔 addby meiyonglei 
		_xAxisMin = parseInt(this.database.xAxisMin) || null, //x轴最小值
		_xAxisMax = parseInt(this.database.xAxisMax) || null; //x轴最大值
		//配置x轴和y轴
		var xAxisArr = [];
		var yAxisArr = [];
		var yAxisDatas = echart.bd._yAxisData;
		var xAxisDatas = echart.bd._xAxisData;

		xAxisDatas.forEach((item,index)=>{
			
			if(echart.bd._typeChild === 'baseline' || echart.bd._typeChild === 'arealine'){
				xAxisArr.push({
					type: item.type,
					name:_xAxisName,
					data:item.data,	
					axisLine: {onZero: false},
					boundaryGap:false,
					axisLabel:{
						formatter:echart.vueObjs[boxAxisFormatter],
					    interval:0,
						rotate:(_isXAxisRotate === 'true') ? '45' : '0'								
					},
					min:_xAxisMin  || item.min,
					max:_xAxisMax || item.max
				});	
				
			}else if(echart.bd._typeChild === 'basebar' || echart.bd._typeChild === 'stackbar'){	
				
				if(_isXAxisTick === 'true'){
					xAxisArr.push({
						type: item.type,
						name:_xAxisName,
						data:item.data,	
						axisLine: {onZero: false},
						axisLabel:{
							formatter:echart.vueObjs[boxAxisFormatter],
						    interval:0,
							rotate:(_isXAxisRotate === 'true') ? '45' : '0'								
						},
						min:_xAxisMin || item.min,
						max:_xAxisMax || item.max,
						axisTick:{alignWithLabel: true}
					});	
					
				}else{
					xAxisArr.push({
						type: item.type,
						name:_xAxisName,
						data:item.data,	
						axisLine: {onZero: false},
						axisLabel:{
							formatter:echart.vueObjs[boxAxisFormatter],							
						    interval:0,
							rotate:(_isXAxisRotate === 'true') ? '45' : '0'								
						},
						min:_xAxisMin || item.min,
						max:_xAxisMax || item.max
					});
					
				}
				
			}
			echart._options.xAxis = xAxisArr;
			
		})
		yAxisDatas.forEach((item,index)=>{
			if(echart.bd._typeChild === 'baseline' || echart.bd._typeChild === 'arealine'){
				yAxisArr.push({
					type: item.type,
					name:_yAxisName,
					data:item.data,
					axisLine: {onZero: false},
					boundaryGap:false,
					axisLabel:{
						formatter:echart.vueObjs[boyAxisFormatter],
					    interval:0,
						rotate:(_isYAxisRotate === 'true') ? '45' : '0'								
					},
					min:_yAxisMin || item.min,
					max:_yAxisMax || item.max,
					interval:_yAxisInterVal || item.interval,
				});	
			}else if(echart.bd._typeChild === 'basebar' || echart.bd._typeChild === 'stackbar'){
				if(_isYAxisTick === 'true'){
					yAxisArr.push({
						type: item.type,
						name:_yAxisName,
						data:item.data,
						axisLine: {onZero: false},
						axisLabel:{
							formatter:echart.vueObjs[boyAxisFormatter],
						    interval:0,
							rotate:(_isYAxisRotate === 'true') ? '45' : '0'								
						},
						min:_yAxisMin || item.min,
						max:_yAxisMax || item.max,
						interval:_yAxisInterVal || item.interval,
						axisTick:{alignWithLabel: true}
					});							
				}else{
					yAxisArr.push({
						type: item.type,
						name:_yAxisName,
						data:item.data,
						axisLine: {onZero: false},
						axisLabel:{
							formatter:echart.vueObjs[boyAxisFormatter],
						    interval:0,
							rotate:(_isYAxisRotate === 'true') ? '45' : '0'								
						},
						min:_yAxisMin || item.min,
						max:_yAxisMax || item.max,
						interval:_yAxisInterVal || item.interval
						
					});
				}
			}
			echart._options.yAxis = yAxisArr;
			
		})				
		}
	PoinEchart.prototype.drawEchart = function(childType,sdata){
		var self = this;
		var itemValue = [];
		var database = self.bd;
		var options = self._options;
		self.setdataZoom(database._isdataZoom);//是否设置缩放
		options.series = itemValue;
		sdata.forEach((item,i)=>{
			self.setLineShadow(database._isLineShadow,sdata[i]);//是否设置线图阴影
			//折线图圆滑开关
			function setSmooth(flag){
				if(flag === 'true'){
					sdata[i].smooth = true;
				}else{
					sdata[i].smooth = false;
				}
			}
			switch(childType){
			case 'basepie':
				var _pieCenter = database._pieCenter.replace(/_+/g,"").split(","); //饼图间距【0%,0%】左右\上下
					sdata[i].type = item.type;//设置图表数据类型
					sdata[i].center = _pieCenter; //设置饼图的上下左右间距			
					sdata[i].itemStyle ={
							emphasis: {
								shadowBlur: 10,
								shadowOffsetX: 0,
								shadowColor: 'rgba(0, 0, 0, 0.5)'
							}

					};
//					sdata[i].radius = _typeRadius[1];
//					delete sdata[i].itemStyle
					delete sdata[i].itemStyle
					delete sdata[i].label;
					delete sdata[i].labelLine;
					//delete sdata[i].labelLine;
					delete sdata[i].gap;
				break;
			case 'cirlepie':				
				var _typeRadius = database._typeRadius.split(","); //图表半径
				var _pieCenter = database._pieCenter.replace(/_+/g,"").split(","); //饼图间距【0%,0%】左右\上下
				sdata[i].center = database._pieCenter; //设置饼图的上下左右间距
				sdata[i].label = {
					normal: {
						show: false,
						position: 'center'
					},
					emphasis: {
						show: true,
						textStyle: {
							fontSize: '30',
							fontWeight: 'bold'
						}
					}
				};
				sdata[i].labelLine = {
						normal: {
							show: false
						}
				};
				sdata[i].radius = _typeRadius;
				sdata[i].avoidLabelOverlap = false;
				break;
			case 'basebar':
				var _typeGrid = database._typeGrid.replace(/_+/g,"").split(","); //坐标轴左右间距
				self.setGrid(_typeGrid);//图表间距设置
				options.tooltip.axisPointer = {type: database._tooltipAxisPointer};//设置tooltip x轴的线条
				sdata[i].barWidth = database._barWidth;
				self.xAxisYAxis();
				break;
			case 'stackbar':
				var _typeGrid = database._typeGrid.replace(/_+/g,"").split(","); //坐标轴左右间距
				self.setGrid(_typeGrid);//图表间距设置
				options.tooltip.axisPointer = {type: database._tooltipAxisPointer};//设置tooltip x轴的线条
				sdata[i].barWidth =  database._barWidth;
				sdata[i].stack = '\u603B\u91CF';
				sdata[i].label = {normal: {show: false,position: 'insideRight'}};
				self.xAxisYAxis();
				break;
			case 'baseline':
				var _typeGrid = database._typeGrid.replace(/_+/g,"").split(","); //坐标轴左右间距
				self.setGrid(_typeGrid);//图表间距设置
				options.tooltip.axisPointer = {type: database._tooltipAxisPointer}; //设置tooltip x轴的线条
				setSmooth(database._isLineSmooth);//是否设置线条圆滑
				//是否设置toolTip x轴线类型
				sdata[i].symbolSize = database._symbolSize; //控制圈圈节点的大小
				options.series = itemValue;
				delete sdata[i].areaStyle;
				delete sdata[i].stack;
				self.xAxisYAxis();
				break;
			case 'arealine':
				var _typeGrid = database._typeGrid.replace(/_+/g,"").split(","); //坐标轴左右间距
				self.setGrid(_typeGrid);//图表间距设置
				options.series = itemValue;
				setSmooth(database._isLineSmooth);//是否设置线条圆滑
				sdata[i].symbolSize = database._symbolSize; //控制圈圈节点的大小
				sdata[i].areaStyle = {normal: {}};
				sdata[i].stack = "\u603B\u91CF";
				self.xAxisYAxis();
				break;
			case 'funnel':
				var _funnelPos = database._funnelPos.replace(/_+/g,"").split(",");
				sdata[i].type = item.type;
				sdata[i].gap = database._gap;
				sdata[i].label = {
						normal: {
							show: true,
							position: 'inside'
						},
						emphasis: {
							textStyle: {
								fontSize: 20
							}
						}
				};
				sdata[i].labelLine = {
						normal: {
							length: 10,
							lineStyle: {
								width: 1,
								type: 'solid'
							}
						}
				};
				sdata[i].itemStyle = {
						normal: {
							borderColor: '#fff',
							borderWidth: 1
						}
				};
				if(_funnelPos[0].length !== 0){
					sdata[i].top =  _funnelPos[0];
				}else{
					delete sdata[i].top;
				}
				if(_funnelPos[1].length !== 0){
					sdata[i].right = _funnelPos[1];
				}else{
					delete sdata[i].right;
				}
				if(_funnelPos[2].length !== 0){
					sdata[i].bottom = _funnelPos[2];
				}else{
					delete sdata[i].bottom;
				}
				if(_funnelPos[3].length !== 0){
					sdata[i].left = _funnelPos[3];
				}else{
					delete sdata[i].left;
				}
				sdata[i].width = database._funnelWidth;
				sdata[i].sort = 'descending';
				break;				
			default:
				break;
			}
		return itemValue.push(item);
		})
	}
	//字符串转换为对象
	PoinEchart.prototype.strToObj = function(str){
		var obj = {};
		if(str !== '' && str !== undefined){
			var val = str.split(" ");
			for(var i=0,len=val.length;i<len;i++){
				var temp = val[i]
				obj[i] = temp;
			}
			return obj;
		}
		return false;
	}
//	根据_toolBoxSet和_toolBoxSetVal来返回对应的值,type是一个对象
//	type:_ecdataview,_ecsaveimage,_ecRestore,_ecLineBar,_ecstacktiled
	PoinEchart.prototype.toolBoxSetData = function(type){
		var optionsFeature = {};
		if(typeof type === "object"){
			for(var iteam in type){
				var tolowerVal = type[iteam].toLowerCase();
				switch(tolowerVal){
				case 'ecdataview': //数据视图按钮
					optionsFeature.ecdataview = {show: true, readOnly: false};
					break;
				case 'ecsaveimage': //保存按钮
					optionsFeature.ecsaveimage = {show: true};
					break;
				case 'ecrestore': //还原按钮
					optionsFeature.ecrestore = {show: true};
					break;
				case 'ecdatazoom': //缩放按钮
					optionsFeature.ecdatazoom = {yAxisIndex: 'none'};
					break;
				case 'eclinebar': //柱状图和线图切换
					optionsFeature.eclinebar = {type: ['line', 'bar']};
					break;
				case 'ecstacktiled': //堆叠图和平铺图切换
					optionsFeature.ecstacktiled = {type: ['stack', 'tiled']};
					break;
				default:
				}
			}
		}
		return optionsFeature;
	}
//	获取所有dom元素data-属性
	PoinEchart.prototype.processEchartBashData = function(jqDom){
		var ecdata = {};
		if(jqDom.getAttribute("id") != undefined){
			ecdata.id = jqDom.getAttribute("id");
		}
		if(jqDom.getAttribute("data-title") != undefined){			
			ecdata.titles = jqDom.getAttribute("data-title");
		}	
		if(jqDom.getAttribute("data-subTitle") != undefined){			
			ecdata.subTitle = jqDom.getAttribute("data-subTitle");
		}
		if(jqDom.getAttribute("data-titPos") != undefined){
			ecdata.titPos = jqDom.getAttribute('data-titPos');
		}
		if(jqDom.getAttribute("data-type") != undefined){
			ecdata.chartType = jqDom.getAttribute('data-type');
		}
		if(jqDom.getAttribute("data-typeChild") != undefined){
			ecdata.typeChild = jqDom.getAttribute('data-typeChild');
		}
		if(jqDom.getAttribute('data-background') != undefined){
			ecdata.background = jqDom.getAttribute('data-background');
		}
		if(jqDom.getAttribute('data-typeRadius') != undefined){
			ecdata.typeRadius = jqDom.getAttribute('data-typeRadius');
		}
		if(jqDom.getAttribute('data-typeGrid') != undefined){
			ecdata.typeGrid = jqDom.getAttribute('data-typeGrid');
		}
		if(jqDom.getAttribute('data-height') != undefined){
			ecdata.height = jqDom.getAttribute('data-height');
		}		
		if(jqDom.getAttribute('data-dataZoom') != undefined){
			ecdata.dataZoom = jqDom.getAttribute('data-dataZoom');
		}
		if(jqDom.getAttribute('data-toolBox') != undefined){
			ecdata.toolBox = jqDom.getAttribute('data-toolBox');
		}
		if(jqDom.getAttribute('data-toolBoxSet') != undefined){
			ecdata.toolBoxSet = jqDom.getAttribute('data-toolBoxSet');
		}
		if(jqDom.getAttribute('data-toolBoxOrient') != undefined){
			ecdata.toolBoxSetOrient = jqDom.getAttribute('data-toolBoxOrient');
		}
		if(jqDom.getAttribute('data-toolBoxPos') != undefined){
			ecdata.toolBoxPos = jqDom.getAttribute('data-toolBoxPos');
		}
		if(jqDom.getAttribute('data-toolBoxBrush') != undefined){ 
			ecdata.toolBoxBrush = jqDom.getAttribute('data-toolBoxBrush');
		}
		if(jqDom.getAttribute('data-legend') != undefined){
			ecdata.legend = jqDom.getAttribute('data-legend');
		}
		if(jqDom.getAttribute('data-legendPos') != undefined){
			ecdata.legendPos = jqDom.getAttribute('data-legendPos');
		}
		if(jqDom.getAttribute('data-legendOrient') != undefined){
			ecdata.legendOrient = jqDom.getAttribute('data-legendOrient');
		}
		if(jqDom.getAttribute('data-gap') != undefined){
			ecdata.gap = jqDom.getAttribute('data-gap');
		}
		if(jqDom.getAttribute('data-toolTipFormater') != undefined){
			ecdata.toolTipFormater = jqDom.getAttribute('data-toolTipFormater');
		}
		if(jqDom.getAttribute('data-toolTipTriger') != undefined){
			ecdata.toolTipTriger = jqDom.getAttribute('data-toolTipTriger');
		}
		if(jqDom.getAttribute('data-xAxisType') != undefined){
			ecdata.xAxisType = jqDom.getAttribute('data-xAxisType');
		}
		if(jqDom.getAttribute('data-xAxisName') != undefined){
			ecdata.xAxisName = jqDom.getAttribute('data-xAxisName');
		}
		if(jqDom.getAttribute('data-xAxisFormatter') != undefined){
			ecdata.xAxisFormatter = jqDom.getAttribute('data-xAxisFormatter');
		}
		if(jqDom.getAttribute('data-yAxisType') != undefined){
			ecdata.yAxisType = jqDom.getAttribute('data-yAxisType');
		}
		if(jqDom.getAttribute('data-yAxisName') != undefined){
			ecdata.yAxisName = jqDom.getAttribute('data-yAxisName');
		}
		if(jqDom.getAttribute('data-yAxisFormatter') != undefined){
			ecdata.yAxisFormatter = jqDom.getAttribute('data-yAxisFormatter');
		}
		if(jqDom.getAttribute('data-xAxisType') != undefined){
			ecdata.xAxisType = jqDom.getAttribute('data-xAxisType');
		}
		if(jqDom.getAttribute('data-symbolSize') != undefined){
			ecdata.symbolSize = jqDom.getAttribute('data-symbolSize');
		}
		if(jqDom.getAttribute('data-lineSmooth') != undefined){
			ecdata.lineSmooth = jqDom.getAttribute('data-lineSmooth');
		}
		if(jqDom.getAttribute('data-yAxisMin') != undefined){
			ecdata.yAxisMin = jqDom.getAttribute('data-yAxisMin');
		}
		if(jqDom.getAttribute('data-yAxisMax') != undefined){
			ecdata.yAxisMax = jqDom.getAttribute('data-yAxisMax');
		}
		if(jqDom.getAttribute('data-xAxisMin') != undefined){
			ecdata.xAxisMin = jqDom.getAttribute('data-xAxisMin');
		}
		if(jqDom.getAttribute('data-xAxisMax') != undefined){
			ecdata.xAxisMax = jqDom.getAttribute('data-xAxisMax');
		}
		if(jqDom.getAttribute('data-xAxisRotate') != undefined){
			ecdata.xAxisRotate = jqDom.getAttribute('data-xAxisRotate');
		}
		if(jqDom.getAttribute('data-yAxisRotate') != undefined){
			ecdata.yAxisRotate = jqDom.getAttribute('data-yAxisRotate');
		}
		if(jqDom.getAttribute('data-lineShadow') != undefined){
			ecdata.lineShadow = jqDom.getAttribute('data-lineShadow');
		}
		if(jqDom.getAttribute('data-tooltipAxisPointer') != undefined){
			ecdata.tooltipAxisPointer = jqDom.getAttribute('data-tooltipAxisPointer');
		}
		if(jqDom.getAttribute('data-barWidth') != undefined){
			ecdata.barWidth = jqDom.getAttribute('data-barWidth');
		}
		if(jqDom.getAttribute('data-color') != undefined){
			ecdata.color = jqDom.getAttribute('data-color');

		}
		if(jqDom.getAttribute('data-yAxisTick') != undefined){
			ecdata.yAxisTick = jqDom.getAttribute('data-yAxisTick');
		}
		if(jqDom.getAttribute('data-xAxisTick') != undefined){
			ecdata.xAxisTick = jqDom.getAttribute('data-xAxisTick');
		}
		if(jqDom.getAttribute('data-funnelWidth') != undefined){
			ecdata.funnelWidth = jqDom.getAttribute('data-funnelWidth');
		}
		if(jqDom.getAttribute('data-funnelPos') != undefined){
			ecdata.funnelPos = jqDom.getAttribute('data-funnelPos');
		}
		if(jqDom.getAttribute('data-pieCenter') != undefined){
			ecdata.pieCenter = jqDom.getAttribute('data-pieCenter');
		}
		//事件绑定
		if(jqDom.getAttribute('data-click') != undefined){
			ecdata.onClick = jqDom.getAttribute('data-click');
		}
		if(jqDom.getAttribute('data-mousemove') != undefined){
			ecdata.onMousemove = jqDom.getAttribute('data-mousemove');
		}
		if(jqDom.getAttribute('data-mouseout') != undefined){
			ecdata.onMouseout = jqDom.getAttribute('data-mouseout');
		}
		if(jqDom.getAttribute('data-load') != undefined){
			ecdata.onLodad = jqDom.getAttribute('data-load');
		}	
		return ecdata;
	};
	//事件处理
	PoinEchart.prototype.setEvent = function(){
		var self = this;
		var _clickFun = self.bd._clickFun,
			_onLodadFun = self.bd._onLodad,
			_optionsList = self._options,
			_resDataList = self.resData,
			_mousemoveFun = self.bd._mousemoveFun;
		window.ecClickFun = this.vueObjs[_clickFun]
		window.onLodadFun = this.vueObjs[_onLodadFun]
		window.ecMousemoveFun = this.vueObjs[_mousemoveFun]
//		var eventFn = this.echartsObj.echarts.init(self._renderTo); //事件对象
		var eventFn = this.echartsObj.init(self._renderTo,customed); //事件对象
		//单机事件
		if(typeof this.vueObjs[_clickFun] === 'function'){
			eventFn.on('click',function(params){		
				window.ecClickFun.call(this,params,this);
			})
		}
		//渲染完成事件
		if(typeof this.vueObjs[_onLodadFun] === 'function'){
			eventFn.on('finished',onLodadFun(self,_optionsList,_resDataList,eventFn));
		}
		//移入事件
		if(typeof this.vueObjs[_mousemoveFun] === 'function'){
			eventFn.on('mousemove',function(params){				
				window.ecMousemoveFun.call(this,params,this);				
			})
		}
		
	};
	//工具栏---------配置---start
	PoinEchart.prototype.setToolBox = function(brushFlag,toolBoxFlag){
		var self = this;
		var options = self._options;
		var database = self.bd;
		//区域选择工具栏配置
		if(brushFlag === "true"){
			options.brush = {toolbox: ['rect', 'polygon', 'lineX', 'lineY', 'keep', 'clear'],xAxisIndex: 0};
		}else{
			options.brush = null;
		}
//		基本工具栏配置
		if(toolBoxFlag === "true"){
			options.toolbox.show = true;
			if(database._toolBoxPos[0].length !== 0){
				options.toolbox.top = database._toolBoxPos[0];
			}else{
				delete options.toolbox.top;
			}
			if(database._toolBoxPos[1].length !== 0){
				options.toolbox.right = database._toolBoxPos[1];
			}else{
				delete options.toolbox.right;
			}
			if(database._toolBoxPos[2].length !== 0){
				options.toolbox.bottom = database._toolBoxPos[2];
			}else{
				delete options.toolbox.bottom;
			}
			if(database._toolBoxPos[3].length !== 0){
				options.toolbox.left = database._toolBoxPos[3];
			}else{
				delete options.toolbox.left;
			}
			options.toolbox.orient = database._toolBoxOrient;
			options.toolbox.feature = {
		            dataView : self._toolBoxSetData.ecdataview || null,
		            restore : self._toolBoxSetData.ecrestore || null,
		            saveAsImage : self._toolBoxSetData.ecsaveimage || null,
		            dataZoom:self._toolBoxSetData.ecdatazoom || {show:false},
		            magicType:self._toolBoxSetData.eclinebar || self._toolBoxSetData.ecstacktiled
			}
				}else{
			options.toolbox.show = false;
		  }
	}
	//	图列配置
	PoinEchart.prototype.setLegend = function(legendFlag){
		var self = this;
		var options = self._options;
		var database = self.bd;
		if(legendFlag === "true"){
			if(database._legendPos === "bottom"){
				options.legend = {x:'center',y:'bottom',data:database._legendData,orient:database._legendOrient};
			}else{
				options.legend = {data:database._legendData,orient:database._legendOrient,left:database._legendPos};				
			}
		}else{
			options.legend = null;
		}	
	}	
	//图表间距设置
	PoinEchart.prototype.setGrid = function(gridArr){
		var self = this;
		var options = self._options;
		if(gridArr[0].length !== 0){
			options.grid.top = gridArr[0];
			options.grid.containLabel = true;
		}else{
			delete options.grid.top;
			delete options.grid.containLabel;
		}
		if(gridArr[1].length !== 0){
			options.grid.right = gridArr[1];
			options.grid.containLabel = true;
		}else{
			delete options.grid.right;
			delete options.grid.containLabel;
		}
		if(gridArr[2].length !== 0){
			options.grid.bottom = gridArr[2];
			options.grid.containLabel = true;
		}else{
			delete options.grid.bottom;
			delete options.grid.containLabel;
		}
		if(gridArr[3].length !== 0){
			options.grid.left = gridArr[3];
			options.grid.containLabel = true;
		}else{
			delete options.grid.left;
			delete options.grid.containLabel;
		}
	}
	PoinEchart.prototype.toolTipFormatter = function(formaterType){
		var self = this;
		var database = self.bd;
		var options = self._options;
		var resData = self.resData;
		if( typeof window[formaterType] === 'function'){
			options.tooltip.trigger = database._toolTipTriger;
			options.tooltip.formatter = window[formaterType];
		}else{
			options.tooltip.formatter = formaterType;
			options.tooltip.trigger = database._toolTipTriger;
			delete options.tooltip.triggerOn;
		}	
	}
	/*
	 * parmas vueObjs ------vue对象
	 * parmas vueRef----要渲染的dom元素
	 * parmas echartsObj ------echarts对象
	 * parmas resData ------后台返回数据结构
	 * parmas newoption ------要覆盖的option
	 * */
	export function PoinEcharts(vueObjs,vueRef,echartsObj,resData,newoption){
		if(typeof(resData) == "undefined"){
			throw new Error("\u81F3\u5C11\u4F20\u9012\u4E00\u4E2A\u53C2\u6570");
		}
		if(vueRef instanceof  HTMLElement){
			if(newoption){		
				if(vueRef.getAttribute('data-ec') === 'poin-echarts'){
					_ecOne(vueObjs,vueRef,echartsObj,resData).setOption(newoption).render()					
				}
			}else{			
				if(vueRef.getAttribute('data-ec') === 'poin-echarts'){
					_ecOne(vueObjs,vueRef,echartsObj,resData).render()					
				}					
			}
			
		}else{			
			throw new Error("\u8BE5\u5BF9\u8C61\u4E0D\u662Fdom\u5BF9\u8C61\uFF0C\u8BF7\u4F20\u9012\u4E00\u4E2Adom\u5BF9\u8C61");
		}		
		function _ecOne(vueObjs,vueRef,echartsObj,resData){
			var echartEle = vueRef
			var echart =  new PoinEchart(vueObjs,echartsObj,echartEle,resData);
			var database = echart.processEchartBashData(echartEle);		
			var resData = resData;
			var ecRender = echart._renderTo;
			var options = echart._options;
			var _renderTo = document.getElementById(database.id);//显示容器	
			var _toolTipFormater = echart.bd._toolTipFormater;
			//option拼接
			echart._renderTo = _renderTo; //传递dom节点
			options.title = {text:echart.bd._title,subtext:echart.bd._subTitle,left:echart.bd._titPos}; //拼接标题
			//设置背景色
			if(echart.bd._chartBg !== undefined  ){
				if(echart.bd._chartBg === ''){					
					delete options.backgroundColor;
				}else{					
					options.backgroundColor = echart.bd._chartBg;					
				}				
			}	
			//设置图表颜色			
			if(echart.bd._chartColor !== undefined  ){
				if(echart.bd._chartColor === ''){					
					delete options.color;
				}else{
					options.color = (echart.bd._chartColor.length !== 0) ? echart.bd._chartColor.split(",") : delete options.color;					
				}				
			}			
			//事件配置
			echart.setEvent();
			//图列配置
			echart.setLegend(echart.bd._isLegend);
			//工具栏配置
			echart.setToolBox(echart.bd._isToolBoxBrush,echart.bd._isToolBox);
			
			//toolTip格式化
			echart.toolTipFormatter(_toolTipFormater);
			//图表渲染		
			echart.drawEchart(echart.bd._typeChild,echart.bd._seriesd);
			return echart;						
		}
	}