1
13693261870
2022-09-16 762f2fb45db004618ba099aa3c0bd89dba1eb843
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
/*开发人员:陈献斌
 *
 * 开发日记:2017-8-4
 *
 */
 
define(['./CacheHelper', './ChartGraphic', 'esri/layers/FeatureLayer', 'dojo/aspect', 'dojo/_base/declare', 'dojo/_base/lang', 'dojo/_base/array', 'dojo/_base/html',
    'dojo/topic', 'dojo/Deferred', 'dojo/on', './echarts.min'],
    function (CacheHelper, ChartGraphic, g, aspect, declare, lang, arrayUtils, html, topic, Deferred, on, echarts) {
        var _YwjcObject,showyear;
        return declare(g, {
            
        constructor : function(url, options) {
 
            options = options || {};
            options.opacity = 0;
            dojo.mixin(this, options);
            if (options) {
                if (options.YwjcObject.JieShouContent.model.xAxis &&
                    options.YwjcObject.JieShouContent.model.xAxis[0].axisLabel &&
                    options.YwjcObject.JieShouContent.model.xAxis[0].axisLabel.interval &&
                    options.YwjcObject.JieShouContent.model.xAxis[0].axisLabel.interval.indexOf("{") > -1) {
                    showyear = options.YwjcObject.JieShouContent.model.xAxis[0].axisLabel.interval.replace("{", "").replace("}", "");
                    var fun = function (index, data) {
                        if (data == showyear) {
                            return true;
                        } else if (index % 7 ==0) {
                            return true;
                        }
                        return false
                    };
                    options.YwjcObject.JieShouContent.model.xAxis[0].axisLabel.interval = fun;
 
                }
                _YwjcObject = this._YwjcObject = options.YwjcObject;
                //this._LayerRender = options.YwjcObject.LayerRender;
 
                if (this._YwjcObject.LayerRender) {
                    this._LayerRender = eval("[" + this._YwjcObject.LayerRender + "]")[0];
                }
                //debugger;
                if ( typeof (this._YwjcObject.JieShouContent) == "string")
                    this._chartContent = eval('(' + this._YwjcObject.JieShouContent + ')');
                else
                    this._chartContent = this._YwjcObject.JieShouContent;
            }
            this.clearLegendHandler = topic.subscribe("clearLegend", lang.hitch(this, this._closeLegend));
            this.ReModifyLocHandler = topic.subscribe("ReModifyLoc", lang.hitch(this, this._ReModifyLoc));
 
            this.zoomEndHandler = map.on("zoom-end", dojo.hitch(this, function() {
                this.clear();//清除所有原统计图,后才可刷新加载新的行政统计。
                this.suspend();
                if(this._YwjcObject.YwtcLayerObject.definitionexpression){
                    var exp = this._YwjcObject.YwtcLayerObject.definitionexpression.replace(/\{0\}/g, map.getLevel());
                    this.setDefinitionExpression(exp);
                }
                this.resume();
                this.refresh();
            }));
        },
 
        _ReModifyLoc : function() {
            var myDivID = "maplegendDiv_" + this._YwjcObject.ziYuanID;
            if (dojo.exists(myDivID)) {
                var lDiv = dojo.byId(myDivID);
                if (lDiv) {
                    dojo.style(lDiv, {
                        "bottom" : this._getMapBottom() + "px",
                    });
                }
            }
        },
 
        _closeLegend : function() {
            var myDivID = "maplegendDiv_" + this._YwjcObject.ziYuanID;
 
            if (dojo.exists(myDivID)) {
                var lDiv = dojo.byId(myDivID);
                dojo.destroy(myDivID);
            }
        },
 
        _setMap : function() {
            var result = this.inherited(arguments);
            var chartType = this._chartContent.chartType;
            if (chartType != "tongjibiao") {
                this._createECharTuLi();
            }
 
            return result;
        },
 
        _unsetMap : function() {
            var result = this.inherited(arguments);
 
            if (this.zoomEndHandler) {
                this.zoomEndHandler.remove();
            }
 
            if (this.clearLegendHandler) {
                this.clearLegendHandler.remove();
            }
 
            if (this.ReModifyLocHandler) {
                this.ReModifyLocHandler.remove();
            }
 
            var myDivID = "maplegendDiv_" + this._YwjcObject.ziYuanID;
 
            if (dojo.exists(myDivID)) {
                var lDiv = dojo.byId(myDivID);
                dojo.destroy(myDivID);
            }
            var showDiv = document.getElementById("ShwoEChartDiv");
            if (showDiv) {
                showDiv.style.display = "none";//隐藏弹窗
                showDiv.innerHTML = "";//清空弹窗内容
            }
            return result;
        },
 
        add : function(graphic) {
            var chartGraphic = this.setPieGraphic(this._YwjcObject, graphic);
            if (chartGraphic) {
                arguments[0] = chartGraphic;
            }
            return this.inherited(arguments);
        },
 
        onGraphicDraw : function(graphicOp) {
            var result = this.inherited(arguments);
 
            var graphic = graphicOp.graphic;
 
            if (graphic.drawPie) {
                graphic.drawPie();
            }
 
            return result;
        },
 
        setPieGraphic : function(YwjcObject, addgraphic) {
            var chartContent = this._chartContent;
            //图表内容
            var model = chartContent.model;
            //模型
            var dataList = chartContent.datalist;
            //数据集
            var chartWidth = chartContent.width;
            //图表的宽度
            var chartHeight = chartContent.height;
            //图表的高度
            var refField = chartContent.reffield;
            //关联行政区划字段名称
            var dataField = chartContent.datafield;
            //图表类型
            var chartType = chartContent.chartType;
 
            //数据字段名称
 
            //var loadstyle = true;
 
            var objectid = null;
            if (this.objectIdField) {
                objectid = addgraphic.attributes[this.objectIdField];
            }
 
            var ywData = null;
            if (objectid) {
                ywData = CacheHelper.getCache(YwjcObject.ziYuanID, objectid);
            }
            if (ywData == null) {
                var echartOption;
                var TableData;
                if (echartOption == null) {
                    echartOption = [];
                    var data = dojo.filter(dataList, function(item) {//遍历数据集,匹配对应的图表数据
                        var xzqh = eval("item." + refField);
                        //转换对象
                        if (xzqh == addgraphic.attributes[YwjcObject.YwtcRefField]) {//判断行政区划是否相同
                            return true;
                        }
                    });
 
                    if (data.length > 0) {//判断是否匹配到行政区划点
                        ywData = new Object();
                        ywData.Id = "id" + YwjcObject.label + addgraphic.attributes[YwjcObject.YwtcRefField];
                        ywData.ChartType = YwjcObject.ZhanShiFangShi;
                        if (YwjcObject.ZhanShiFangShi == "tongjibiao") {
                            TableData = data;
                            var Newmodel = lang.clone(model);
                            echartOption = Newmodel;
                            ywData.TableData = TableData;
                        } else {
                            var Newmodel = lang.clone(model);
                            for (var i = 0; i < dataField.length; i++) {
                                if (chartType && chartType == "radar") {//雷达图
                                    if (i + 1 == dataField.length) {
                                        Newmodel.radar[0].indicator = eval("data[0]." + dataField[i]);
                                    } else {
                                        Newmodel.series[i].data = eval("data[0]." + dataField[i]);
                                    }
                                } else if (chartType && chartType == "graph") {//关系图
                                    if (dataField.length == 3) {
                                        Newmodel.series[i].nodes = eval("data[0]." + dataField[0]);
                                        Newmodel.series[i].links = eval("data[0]." + dataField[1]);
                                        Newmodel.series[i].categories = eval("data[0]." + dataField[2]);
                                        break;
                                    }
                                } else if (chartType && chartType == "bar") {
                                    if (i + 1 == dataField.length) {
                                        Newmodel.xAxis[0].data = eval("data[0]." + dataField[i]);
                                    } else {
                                        Newmodel.series[i].data = eval("data[0]." + dataField[i]);
                                    }
                                } else {
                                    if (dataField == "serie") {
                                        Newmodel.series = eval("data[0]." + dataField);
                                    }
                                    else if (Newmodel.series[i].matrix) {
                                        Newmodel.series[i].matrix = eval("data[0]." + dataField[i]);
                                    } else {
                                        Newmodel.series[i].data = eval("data[0]." + dataField[i]);
                                    }
                                }
 
                                //转换对象,把数据系列填充模型的属性
                            }
                            //by hugongzuo@163.com
                            var xAxisData=chartContent.xAxisData;
                            var yAxisData=chartContent.yAxisData;
                            if(Newmodel.xAxis!=null && xAxisData!=null){
                                for(var i=0;i<Newmodel.xAxis.length;i++){
                                    if(Newmodel.xAxis[i].data=="xAxisData"){
                                        Newmodel.xAxis[i].data=xAxisData[i];
                                    }
                                }
                            }
                            if(Newmodel.yAxis!=null && yAxisData!=null){
                                for(var i=0;i<Newmodel.yAxis.length;i++){
                                    if(Newmodel.yAxis[i].data=="yAxisData"){
                                        Newmodel.yAxis[i].data=yAxisData[i];
                                    }
                                }
                            }
                            echartOption = Newmodel;
                            echartOption.ZiYuanID = YwjcObject.ziYuanID;
                            echartOption.xzqh = data[0].xzqh;
                            var xzqh_name = addgraphic.attributes[parent.XZQH_NAME_FIELD];
                            echartOption.xzqhName = xzqh_name ? xzqh_name : "详细信息";
                        }
                        ywData.ChartOption = echartOption;
                        if (objectid) {
                            CacheHelper.addCache(YwjcObject.ziYuanID, objectid, ywData);
                        }
                    }
                }
            }
            if (_YwjcObject.JieShouContent.datalist.length > 1 && addgraphic.attributes.XZQH == "000000") {
                chartWidth *= 1.5;
                chartHeight *= 1.5;
            }
            if (ywData) {
                var chartGraphic = new ChartGraphic({
                    geometry : addgraphic.geometry,
                    attributes : addgraphic.attributes,
                    chartOption : ywData.ChartOption,
                    cacheID : ywData.Id,
                    tableData : ywData.TableData,
                    ziYuanMC : YwjcObject.label.replace("_" + YwjcObject.ziYuanID, ""),
                    chartType : ywData.ChartType,
                    width : chartWidth,
                    height : chartHeight
                });
 
                //(lz)17.08.08 对应颜色
                var cloneRender = lang.clone(this._LayerRender);
                var series = ywData.ChartOption.series;
                if (this._LayerRender && this._LayerRender.classfyFields) {
                    for (var i = 0; i < this._LayerRender.classfyFields.length; i++) {
 
                        var freshFields = [];
                        var data = series[i].data;
                        var cFields = this._LayerRender.classfyFields[i].data;
 
                        for (var d = 0; d < cFields.length; d++) {
                            for (var c = 0; c < data.length; c++) {
                                if (data[c].name == cFields[d].field) {
                                    freshFields.push(cFields[d]);
                                }
                            }
 
                        };
                        cloneRender.classfyFields[i].data = freshFields;
                    };
                }
 
                chartGraphic.setChartOption(cloneRender);
 
                return chartGraphic;
            }
        },
 
        /*
 
         onGraphicRemove : function(graphic) {
 
         var a = this.inherited(arguments);
         if (graphic.removePie) {
         graphic.removePie();
         }
 
         return a;
 
         },
 
         */
 
        _removeShape : function(graphic, c, b) {
            var a = this.inherited(arguments);
            if (graphic.removePie) {
                graphic.removePie();
            }
 
            return a;
        },
 
        _onExtentChangeHandler: function (a, c, levelChange, d) {
            debugger
            var result = this.inherited(arguments);
 
            for (var i = 0; i < this.graphics.length; i++) {
                if (this.graphics[i].drawPie) {
                    this.graphics[i].drawPie();
                }
            }
 
            return result;
        },
 
        _getMapBottom : function() {
            var bottom = 2;
            /*
             if (dojo.exists("mapBottomC")) {
             var bottomC = dojo.byId("mapBottomC");
             var widget = bottomC.firstChild;
             if (null != widget) {
             var timeSliderWidget = Ext.getCmp(widget.id);
             bottom = timeSliderWidget.height;
             }
             }
             */
            var DartControllers = _widgetManager.getWidgetsByName("DartController");
            if (DartControllers.length > 0 && false) {
                var DartController = DartControllers[0];
                var DartControllerDom = dojo.byId(DartController.id);
                if (DartControllerDom) {
                    bottom += DartControllerDom.clientHeight || 35;
                }
            }
 
            var RelevancyLayerDom = dojo.byId("GuanLianZiYuan_Box");
            if (RelevancyLayerDom) {
                if (RelevancyLayerDom.style.display != "none") {
 
                    if (RelevancyLayerDom.clientHeight == 0) {
                        var pframe = dojo.byId("GLZY_IF");
                        if (pframe) {
                            var styleHeight = pframe.style["height"];
                            if (styleHeight) {
                                var clientHeight = Number(styleHeight.substr(0, styleHeight.length - 2));
                                bottom += clientHeight;
                            } else if (pframe.height) {
                                bottom += pframe.height;
                            }
                        }
 
                    } else {
                        bottom += RelevancyLayerDom.clientHeight;
                    }
                }else {//add of lvhuanlong
                    var RelevancyLayerMinDom = dojo.byId("GuanLianZiYuan_MinBox");
                    if (RelevancyLayerMinDom) {
                        if (RelevancyLayerMinDom.style.display != "none") {
                            if (RelevancyLayerMinDom.clientHeight == 0) {
                                var pframe = dojo.byId("GLZY_IF");
                                if (pframe) {
                                    var styleHeight = pframe.style["height"];
                                    if (styleHeight) {
                                        var clientHeight = Number(styleHeight.substr(0, styleHeight.length - 2));
                                        bottom += clientHeight;
                                    } else if (pframe.height) {
                                        bottom += pframe.height;
                                    }
                                }
                            } else {
                                bottom += RelevancyLayerMinDom.clientHeight;
                            }
                        }
                    }
                }
            }
 
            return bottom;
        },
 
        _createECharTuLi : function() {//创建图例
            topic.publish("clearLegend");
 
            var divid = this.id;
 
            var options = this._CreateLengendChartOption(this._LayerRender);
            if (options) { //debugger;
                //var renderer = pLayer.renderer;
                var widthTuLiDiv = 200;
 
                var heightTuLiDiv = 250;
 
                var layerLabel = this._YwjcObject.label;
 
                if (layerLabel.length > 11) {
                    widthTuLiDiv += (layerLabel.length - 11) * 15;
                }
 
                var legendDivID = "maplegendDiv_" + this._YwjcObject.ziYuanID;
                entirelegendDivID=legendDivID;
                var tuliContaner = dojo.create("div", {
                    id : legendDivID
                });
 
                dojo.style(tuliContaner, {
                    "right" : "2px",
                    "bottom" : this._getMapBottom() + "px",
                    "position" : "absolute",
                    "width" : widthTuLiDiv + "px",
                    "height" : heightTuLiDiv + "px",
                    "padding-left" : "8px",
                    "padding-top" : "8px",
                    "padding-bottom" : "8px",
                    "z-index" : "9999",
                    "border-style" : "solid",
                    "border-width" : "1px",
                    "border-color" : "#157fcc",
                    "background-color" : "white",
                    "pointer-events" : "painted",
                    "border-radius" : "5px",
                    "-webkit-border-radius" : "5px 5px 5px 5px"
                });
 
                document.getElementById("map").appendChild(tuliContaner);
 
                var tuliTitle = dojo.doc.createElement("div");
 
                dojo.style(tuliTitle, {
                    "width" : "100%",
                    "height" : "27px",
                    'left' : '0px',
                    'top' : '1px',
                    'position' : 'absolute',
                    'background-color' : 'rgb(201, 234, 251)',
                    'border-top-color' : 'rgb(201, 234, 251)',
                    'border-top-style' : 'solid',
                    'border-top-width' : '1px'
                });
 
                var tuliTitleCaption = dojo.doc.createElement("div");
                dojo.style(tuliTitleCaption, {
                    "width" : "100%",
                    "height" : "100%",
                    'text-align' : 'center'
                });
 
                var tuliTitleSpan = dojo.doc.createElement("span");
 
                dojo.style(tuliTitleSpan, {
                    'display' : 'inline-block',
                    'padding-top' : '5px',
                    'font-weight' : 'bold'
                });
 
                tuliTitleSpan.textContent = layerLabel;
                tuliTitleCaption.appendChild(tuliTitleSpan);
 
                tuliTitle.appendChild(tuliTitleCaption);
                tuliContaner.appendChild(tuliTitle);
 
                var tuli_div = dojo.doc.createElement("div", {
                    id : "divlegend"
                });
 
                dojo.style(tuli_div, {
                    'width' : widthTuLiDiv - 38 + 'px',
                    'height' : heightTuLiDiv - 38 + 'px',
                    'overflow-y' : 'auto',
                    'left' : '0px',
                    'top' : '28px',
                    'position' : 'absolute',
                    'margin-left' : '30px'
                });
                tuliContaner.appendChild(tuli_div);
                //tuliContaner.append(tuliTitle);
 
                var tuliThum = dojo.doc.createElement("div");
 
                dojo.style(tuliThum, {
                    "width" : "100%",
                    "height" : "80px"
                });
 
                //tuli_div.appendChild(tuliThum);//update of lvhuanlong 不在图例中显示-小图表
 
                var charObj = echarts.init(tuliThum);
                charObj.setOption(options);
 
                var html = "";
                var divH = 0;
                if (charObj._chartsViews.length > 0) {
                    var imageC = dojo.create("div", {
                        style : 'left: 0px; top: 0px; width: 28px; height: 28px; position: absolute;'
                    });
 
                    var image = dojo.create("img", {
                        style : 'cursor:pointer',
                        src : 'images/Leng/i_expand2.png',
                        id : 'imgTuLi'
                    });
                    imageC.appendChild(image);
                    tuliContaner.appendChild(imageC);
                    for (var i = 0; i < charObj._chartsViews.length; i++) {
                        if (charObj._chartsViews[i]._data) {
                            this._initLegendsNodeByChartsView(tuli_div, charObj._chartsViews[i], widthTuLiDiv, null);
                        }
                    }
 
                    /*
 
                    heightTuLiDiv = divH + 10 + 85;
                    widthTuLiDiv = myDivIDwidth * charObj._chartsViews.length + 10;
                    */
                    //tuliContaner.className = "tuli_div_style";
 
                    //debugger;
                    dojo.style(tuliContaner, {
                        "right" : "2px",
                        "bottom" : this._getMapBottom() + "px",
                        "position" : "absolute",
                        "width" : widthTuLiDiv + "px",
                        "height" : heightTuLiDiv + "px",
                        "padding-left" : "8px",
                        "padding-top" : "8px",
                        "padding-bottom" : "8px",
                        "z-index" : "9999",
                        "border-style" : "solid",
                        "border-width" : "1px",
                        "border-color" : "#157fcc",
                        "background-color" : "white",
                        "pointer-events" : "painted",
                        "border-radius" : "5px",
                        "-webkit-border-radius" : "5px 5px 5px 5px"
                    });
 
                    dojo.connect(image, "click", lang.hitch(this, function() {
                        var imgTuLi = document.getElementById("imgTuLi");
 
                        if (tuliTitle.style.display == 'none') {
                            tuliTitle.style.display = 'block';
                            tuli_div.style.display = 'block';
                            imgTuLi.src = "images/Leng/i_expand2.png";
 
                            dojo.style(tuliContaner, {
                                "width" : widthTuLiDiv + "px",
                                "height" : heightTuLiDiv + "px"
                            });
                        } else {
                            tuliTitle.style.display = 'none';
                            tuli_div.style.display = 'none';
                            imgTuLi.src = "images/Leng/i_expand.png";
 
                            dojo.style(tuliContaner, {
                                "width" : "28px",
                                "height" : "28px"
                            });
                        }
                    }));
                }
               topic.publish("ReModifyLoc");
            }
        },
 
        _initLegendsNodeByChartsView : function(legendsNode, chartsView, widthTuLiDiv, label) {
            var colorList = chartsView._data._itemVisuals;
            var labelList = chartsView._data._idList;
 
            var legendInfos = [];
 
            if (label != null) {
                var tuliTitle = dojo.doc.createElement("div");
 
                dojo.style(tuliTitle, {
                    "width" : "100%",
                    "height" : "27px",
                    //'background-color' : 'rgb(201, 234, 251)',
                    'border-bottom-color' : 'rgb(201, 234, 251)',
                    'border-bottom-style' : 'solid',
                    'border-bottom-width' : '1px'
                });
 
                var tuliTitleCaption = dojo.doc.createElement("div");
 
                dojo.style(tuliTitleCaption, {
                    "width" : "100%",
                    "height" : "100%"
                });
 
                var tuliTitleSpan = dojo.doc.createElement("span");
 
                dojo.style(tuliTitleSpan, {
                    'display' : 'inline-block',
                    'padding-top' : '5px',
                    'font-weight' : 'bold'
                });
 
                tuliTitleSpan.textContent = label;
 
                tuliTitleCaption.appendChild(tuliTitleSpan);
 
                tuliTitle.appendChild(tuliTitleCaption);
 
                legendsNode.appendChild(tuliTitle);
            }
 
            arrayUtils.forEach(colorList, function(legendInfo, index) {
                var label = labelList[index];
 
                var legendDiv = dojo.create("div", {
                    "class" : "legend-div",
                    "style" : "overflow:hidden;padding-top:5px;"
                });
 
                var lengendSymbol = dojo.create("div", {
                    "class" : "legend-symbol jimu-float-leading"
                });
 
                dojo.style(lengendSymbol, {
                    'background-color' : legendInfo.color,
                    'width' : '40px',
                    'height' : '18px'
                });
 
                var labelDiv = dojo.create("div", {
                    "class" : "legend-label jimu-float-leading",
                    "innerHTML" : label,
                });
 
                dojo.style(labelDiv, {
                    'text-overflow' : 'clip',
                    'padding-left' : '5px'
                });
 
                legendDiv.appendChild(lengendSymbol);
 
                legendDiv.appendChild(labelDiv);
 
                legendsNode.appendChild(legendDiv);
 
            }, this);
        },
 
        _CreateLengendChartOption : function(LayerRender) {
            var chartOption = this.getLengendChartOption();
 
            if (LayerRender) {
                //图表内容
                if (LayerRender.labelField) {
                    if (chartOption.title) {
                        chartOption.title.text = this.id;
                    }
 
                }
 
                if (LayerRender.classfyFields) {
                    var colors = [];
 
                    for (var i = 0; i < LayerRender.classfyFields.length; i++) {
                        var pieColorList = LayerRender.classfyFields[i].data;
 
                        for (var j = 0; j < pieColorList.length; j++) {
                            var pieColor = pieColorList[j].pieColor;
 
                            if (pieColor) {
                                colors.push(pieColor);
                            }
                        }
                    };
 
                    if (colors.length > 0) {
                        chartOption.color = colors;
                    }
                }
            }
 
            return chartOption;
        },
 
        getLengendChartOption : function() {
            var chartContent = this._chartContent;
            //图表内容
            var model = chartContent.model;
            //模型
            var dataList = chartContent.datalist;
 
            var chartWidth = chartContent.width;
            //图表的宽度
            var chartHeight = chartContent.height;
 
            //数据集
            var chartWidth = 30;
            //图表的宽度
            var chartHeight = 30;
 
            //图表的高度
            var refField = chartContent.reffield;
            //关联行政区划字段名称
            var dataField = chartContent.datafield;
            //图表类型
            var chartType = chartContent.chartType;
 
            var echartOption = null;
            var data = dataList; //debugger;
            if (data.length > 0) {//判断是否匹配到行政区划点
                var Newmodel = lang.clone(model);
                for (var i = 0; i < dataField.length; i++) {
                    if (chartType && chartType == "radar") {//雷达图
                        if (i + 1 == dataField.length) {
                            Newmodel.radar[0].indicator = lang.clone(eval("data[0]." + dataField[i]));
                        } else {
                            Newmodel.series[i].data = lang.clone(eval("data[0]." + dataField[i]));
                        }
                    } else if (chartType && chartType == "graph") {//关系图
                        if (dataField.length == 3) {
                            Newmodel.series[i].nodes = lang.clone(eval("data[0]." + dataField[0]));
                            Newmodel.series[i].links = lang.clone(eval("data[0]." + dataField[1]));
                            Newmodel.series[i].categories = lang.clone(eval("data[0]." + dataField[2]));
                            break;
                        }
                    } else if (chartType && chartType == "bar") {
                        if (i + 1 == dataField.length) {
                            Newmodel.xAxis[0].data = lang.clone(eval("data[0]." + dataField[i]));
                        } else {
                            Newmodel.series[i].data = lang.clone(eval("data[0]." + dataField[i]));
                        }
                    } else {
                        if (Newmodel.series[i].matrix) {
                            Newmodel.series[i].matrix = lang.clone(eval("data[0]." + dataField[i]));
                        } else {
 
                            Newmodel.series[i].data = lang.clone(eval("data[0]." + dataField[i]));
                            if (Newmodel.series[i].radius && Newmodel.series[i].radius.length>1 && dataField.length > 1) {
                                Newmodel.series[i].radius[0] = i * 20;
                                Newmodel.series[i].radius[1] = (i + 1) * 15;
 
                            }
 
                        }
                    }
                    //转换对象,把数据系列填充模型的属性
                }
                //by hugongzuo@163.com
                var xAxisData=chartContent.xAxisData;
                var yAxisData=chartContent.yAxisData;
                if(Newmodel.xAxis!=null && xAxisData!=null){
                    for(var i=0;i<Newmodel.xAxis.length;i++){
                        if(Newmodel.xAxis[i].data=="xAxisData"){
                            Newmodel.xAxis[i].data=xAxisData[i];
                        }
                    }
                }
                if(Newmodel.yAxis!=null && yAxisData!=null){
                    for(var i=0;i<Newmodel.yAxis.length;i++){
                        if(Newmodel.yAxis[i].data=="yAxisData"){
                            Newmodel.yAxis[i].data=yAxisData[i];
                        }
                    }
                }
                echartOption = Newmodel;
            }
            if (echartOption) {
                if (echartOption.series && echartOption.series.length >= 1 && echartOption.series[0].type == "pie") {
                    for (var i = 0; i < echartOption.series.length; i++) {
                        var data = echartOption.series[i].data;
 
                        if (data) {
                            for (var j = 0; j < data.length; j++) {
                                if (data[j].value) {
                                    data[j].value = 10;
                                }
                            };
                            if(j==1){
                                data[0].name=echartOption.series[i].name;
                            }
                        }
                    };
 
                    echartOption.tooltip = null;
 
                    return echartOption;
                }
            }
 
            return null;
        }
    });
});