File size: 31,626 Bytes
4bb817b
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
<!DOCTYPE html>
<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements.  See the NOTICE file
distributed with this work for additional information
regarding copyright ownership.  The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License.  You may obtain a copy of the License at

   http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied.  See the License for the
specific language governing permissions and limitations
under the License.
-->


<html>
    <head>
        <meta charset="utf-8">
        <meta name="viewport" content="width=device-width, initial-scale=1" />
        <script src="lib/simpleRequire.js"></script>
        <script src="lib/config.js"></script>
        <script src="lib/jquery.min.js"></script>
        <script src="lib/facePrint.js"></script>
        <script src="lib/testHelper.js"></script>
        <!-- <script src="ut/lib/canteen.js"></script> -->
        <link rel="stylesheet" href="lib/reset.css" />
    </head>
    <body>
        <style>
        </style>



        <div id="main_simple_geo_svg_coord"></div>
        <div id="main_simple_geo_svg_viewBox_svgWH"></div>
        <div id="main_geo_json_focus_blur"></div>
        <div id="main_geo_svg_emphasis_select"></div>
        <div id="main_pure_geo_svg"></div>
        <div id="main_pure_map_svg"></div>
        <div id="main_map_geo_svg"></div>
        <div id="main_geo_svg_click_finder"></div>
        <div id="main_geo_svg_multiple_geo"></div>





        <script>
            function listenAndPrintEvent(chart) {
                if (!chart) {
                    return;
                }
                const out = {
                };
                chart.on('geoselectchanged', function (params) {
                    out.geoselectechanged = {
                        allSelected: params.allSelected
                    };
                    console.log('geoselectechanged', params);
                    chart.__testHelper.updateInfo(out, 'event');
                });
                chart.on('selectchanged', function (params) {
                    out.selectechanged = {
                        selected: params.selected
                    };
                    console.log('selectechanged', params);
                    chart.__testHelper.updateInfo(out, 'event');
                });
                chart.on('click', function (params) {
                    out.click = {
                        componentIndex: params.componentIndex,
                        componentType: params.componentType,
                        geoIndex: params.geoIndex,
                        name: params.name
                    };
                    console.log('click', params);
                    chart.__testHelper.updateInfo(out, 'event');
                });
            }
        </script>








        <script>
        require(['echarts'/*, 'map/js/china' */], function (echarts) {
            const svg = [
                '<?xml version="1.0" encoding="utf-8"?>',
                '<svg xmlns="http://www.w3.org/2000/svg" xmlns:ooo="http://xml.openoffice.org/svg/export" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.2" fill-rule="evenodd" xml:space="preserve">',
                '<path name="left_rect" d="M 0,0 L 0,100 100,100 100,0 Z" fill="#765" stroke="rgb(56,93,138)" stroke-width="0" stroke-linecap="square" stroke-linejoin="miter"/>',
                '<path name="right_rect" d="M 150,0 L 150,100 250,100 250,0 Z" fill="#567" stroke="rgb(56,93,138)" stroke-width="0" stroke-linecap="square" stroke-linejoin="miter"/>',
                '</svg>'
            ].join('')

            echarts.registerMap('testGeoSVG_coord', { svg: svg });

            option = {
                animation: false,
                tooltip: {
                },
                geo: {
                    map: 'testGeoSVG_coord',
                    roam: true,
                    top: 0,
                    bottom: 0,
                    left: 0,
                    right: 0,
                },
                series: [{
                    type: 'scatter',
                    geoIndex: 0,
                    coordinateSystem: 'geo',
                    symbolSize: 30,
                    data: [{
                        value: [200, 50],
                        itemStyle: {
                            color: 'blue'
                        }
                    }]
                }]
            };

            var chart = testHelper.create(echarts, 'main_simple_geo_svg_coord', {
                title: [
                    'A **blue circle** should be in the center of the right rect.',
                    '**Click** inside the rect or outside the rect.',
                    'Check SVG coord displayed (via convertFromPixel).',
                    '(The left rect is 100*100 and left-top corner is (0,0))',
                    '**Click btn1**, check Pixel.point[1] should be around 100',
                    '**Click btn2**, check Pixel.point[1] should be around 200'
                ],
                option: option,
                infoKey: 'SVG coord',
                info: {},
                height: 200,
                buttons: [{
                    text: 'converToPixel({ geoIndex: 0 }, "left_rect")',
                    onclick: function () {
                        var point = chart.convertToPixel({ geoIndex: 0 }, 'left_rect');
                        console.log(point);
                        chart.__testHelper.updateInfo(
                            { point: point },
                            'Pixel'
                        );
                    }
                }, {
                    text: 'convertToPixel({ geoIndex: 0 }, [100, 100])',
                    onclick: function () {
                        var point = chart.convertToPixel({ geoIndex: 0 }, [100, 100]);
                        console.log(point);
                        chart.__testHelper.updateInfo(
                            { point: point },
                            'Pixel'
                        );
                    }
                }]
            });

            if (chart) {
                chart.getZr().on('click', function (event) {
                    var x = event.offsetX;
                    var y = event.offsetY;
                    console.log(x, y);
                    var svgCoord = chart.convertFromPixel({ geoIndex: 0 }, [x, y]);
                    console.log(svgCoord);
                    chart.__testHelper.updateInfo(
                        { x: svgCoord[0], y: svgCoord[1] },
                        'SVG coord'
                    );
                });
            }

        });
        </script>






        <script>
        require(['echarts'], function (echarts) {
            const xmlHeader = '<?xml version="1.0" encoding="utf-8"?>';
            const svgTagCommonAttr = ' xmlns="http://www.w3.org/2000/svg" xmlns:ooo="http://xml.openoffice.org/svg/export" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.2" fill-rule="evenodd" xml:space="preserve" ';

            // Both svgWdith svgHeight viewBox
            const svg1 = [
                xmlHeader,
                '<svg ' + svgTagCommonAttr,
                'viewBox="99500 99500 1000 1000"',
                'width="5px" height="5px"',
                '>',
                '<circle cx="100000" cy="100000" r="500" fill="blue" stroke-linecap="square" stroke-linejoin="miter"/>',
                '</svg>'
            ].join(' ');
            // Both svgWdith svgHeight viewBox and clip
            const svg2 = [
                xmlHeader,
                '<svg ' + svgTagCommonAttr,
                'viewBox="99500 99500 500 500"',
                'width="5px" height="5px"',
                '>',
                '<circle cx="100000" cy="100000" r="500" fill="blue" stroke-linecap="square" stroke-linejoin="miter"/>',
                '</svg>'
            ].join(' ');
            // Only svgWdith svgHeight
            const svg3 = [
                xmlHeader,
                '<svg ' + svgTagCommonAttr,
                'width="100000" height="100000"',
                '>',
                '<circle cx="100000" cy="100000" r="100000" fill="blue" stroke-linecap="square" stroke-linejoin="miter"/>',
                '</svg>'
            ].join(' ');
            // Only viewBox
            const svg4 = [
                xmlHeader,
                '<svg ' + svgTagCommonAttr,
                'viewBox="99500 99500 500 500"',
                '>',
                '<circle cx="100000" cy="100000" r="500" fill="blue" stroke-linecap="square" stroke-linejoin="miter"/>',
                '</svg>'
            ].join(' ');
            // Neither viewBox and svgWidth svgHeight
            const svg5 = [
                xmlHeader,
                '<svg ' + svgTagCommonAttr,
                '>',
                '<circle cx="100000" cy="100000" r="500" fill="blue" stroke-linecap="square" stroke-linejoin="miter"/>',
                '</svg>'
            ].join(' ');
            // Both viewBox but only svgHeight no svgWidth
            const svg6 = [
                xmlHeader,
                '<svg ' + svgTagCommonAttr,
                'viewBox="99500 99500 1000 1000"',
                'height="500"',
                '>',
                '<circle cx="100000" cy="100000" r="500" fill="blue" stroke-linecap="square" stroke-linejoin="miter"/>',
                '</svg>'
            ].join(' ');

            echarts.registerMap('testGeoSVG_viewBox_svgWH_1', { svg: svg1 });
            echarts.registerMap('testGeoSVG_viewBox_svgWH_2', { svg: svg2 });
            echarts.registerMap('testGeoSVG_viewBox_svgWH_3', { svg: svg3 });
            echarts.registerMap('testGeoSVG_viewBox_svgWH_4', { svg: svg4 });
            echarts.registerMap('testGeoSVG_viewBox_svgWH_5', { svg: svg5 });
            echarts.registerMap('testGeoSVG_viewBox_svgWH_6', { svg: svg6 });

            const RECT_SIZE = 50;
            const Y_TOP = 10;
            const X_LEFT = 10;
            const GAP = 20;

            var _itemIndex = 0;
            var _graphicOptionArr = [];
            var _geoOptionArr = [];

            function makeItem(text, mapType) {
                var x = X_LEFT + (RECT_SIZE + GAP) * _itemIndex++;
                _graphicOptionArr.push({
                    type: 'rect',
                    silent: true,
                    shape: { x: x, y: Y_TOP, width: RECT_SIZE, height: RECT_SIZE },
                    style: { stroke: 'red', lineWidth: 1, fill: null }
                }, {
                    type: 'text',
                    silent: true,
                    style: {
                        text: text, x: x + RECT_SIZE / 2, y: Y_TOP + RECT_SIZE + GAP,
                        fill: '#000', textAlign: 'center', textVerticalAlign: 'middle'
                    }
                });
                _geoOptionArr.push({
                    map: mapType,
                    left: x, top: Y_TOP, width: RECT_SIZE, height: RECT_SIZE,
                    itemStyle: { color: 'blue' }
                });
            }

            makeItem('circle', 'testGeoSVG_viewBox_svgWH_1');
            makeItem('1/4 sector', 'testGeoSVG_viewBox_svgWH_2');
            makeItem('1/4 sector', 'testGeoSVG_viewBox_svgWH_3');
            makeItem('1/4 sector', 'testGeoSVG_viewBox_svgWH_4');
            makeItem('circle', 'testGeoSVG_viewBox_svgWH_5');
            makeItem('thin ellipse', 'testGeoSVG_viewBox_svgWH_6');

            option = {
                animation: false,
                tooltip: {
                },
                graphic: _graphicOptionArr,
                geo: _geoOptionArr
            };

            var chart = testHelper.create(echarts, 'main_simple_geo_svg_viewBox_svgWH', {
                title: [
                    'viewBox test:',
                    'Check each shape should be inside each red rect.',
                    'Check each shape be correspondence with the text.',
                ],
                option: option,
                height: 100
            });
        });
        </script>






        <script>
        require(['echarts'/*, 'map/js/china' */], function (echarts) {
            const testGeoJson1 = {
                'type': 'FeatureCollection',
                'features': [
                    {
                        'type': 'Feature',
                        'geometry': {
                            'type': 'Polygon',
                            'coordinates': [
                                [[2000, 2000], [5000, 2000], [5000, 5000], [2000, 5000]]
                            ]
                        },
                        'properties': {
                            'name': 'Afghanistan'
                        }
                    },
                    {
                        'type': 'Feature',
                        'geometry': {
                            'type': 'Polygon',
                            'coordinates': [
                                [[6000, 2300], [9300, 2300], [9000, 5000]]
                            ]
                        },
                        'properties': {
                            'name': 'BBB'
                        }
                    }
                ]
            };

            echarts.registerMap('testGeoJson2', testGeoJson1);

            option = {
                tooltip: {
                },
                geo: {
                    map: 'testGeoJson2',
                    roam: true,
                    selectedMode: 'single',
                    label: {
                        show: true
                    },
                    emphasis: {
                        focus: 'self'
                    },
                    // height: '100%',
                    // center
                    // layoutCenter: ['30%', 40],
                    // layoutSize: 40,
                    // boundingCoords
                    zoom: 1,
                    aspectScale: 1
                }
            };

            var chart = testHelper.create(echarts, 'main_geo_json_focus_blur', {
                title: [
                    'check geoJSON focus-blur',
                    '**Click** them, check click info'
                ],
                option: option,
                info: {},
                infoKey: 'event',
                height: 200
            });

            listenAndPrintEvent(chart);

        });
        </script>






        <script>
        require(['echarts'/*, 'map/js/china' */], function (echarts) {
            const svg = [
                '<?xml version="1.0" encoding="utf-8"?>',
                '<svg xmlns="http://www.w3.org/2000/svg" xmlns:ooo="http://xml.openoffice.org/svg/export" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.2" fill-rule="evenodd" xml:space="preserve">',
                '<path name="a" d="M 0,0 L 0,100 100,100 100,0 Z" transform="rotate(45)" fill="rgb(16,193,138)" stroke="green" stroke-width="2" stroke-linecap="square" stroke-linejoin="miter"/>',
                '<path name="a" d="M 110,0 L 110,100 210,100 210,0 Z" fill="rgb(16,193,138)" stroke="green" stroke-width="2" stroke-linecap="square" stroke-linejoin="miter"/>',
                '<g name="b">',
                    '<path d="M 0,110 L 0,210 100,110 Z" fill="rgb(16,193,138)" stroke="green" stroke-width="2" stroke-linecap="square" stroke-linejoin="miter"/>',
                    '<path d="M 110,110 L 110,210 210,110 Z" fill="rgb(16,193,138)" stroke="green" stroke-width="2" stroke-linecap="square" stroke-linejoin="miter"/>',
                '</g>',
                '<radialGradient id="XMLID_1_" cx="0" cy="220" r="59.4363" gradientUnits="userSpaceOnUse">',
                    '<stop  offset="0" style="stop-color:#E6E6E6"/>',
                    '<stop  offset="1" style="stop-color:#4D4D4D"/>',
                '</radialGradient>',
                '<path name="c" d="M 0,220 L 0,320 100,220 Z" fill="url(#XMLID_1_)" stroke="green" stroke-width="2" stroke-linecap="square" stroke-linejoin="miter"/>',
                '<radialGradient id="XMLID_2_" cx="110" cy="220" r="59.4363" gradientUnits="userSpaceOnUse">',
                    '<stop  offset="0" style="stop-color:#E6E6E6"/>',
                    '<stop  offset="1" style="stop-color:#4D4D4D"/>',
                '</radialGradient>',
                '<path name="c" d="M 110,220 L 110,320 210,220 Z" fill="url(#XMLID_2_)" stroke="green" stroke-width="2" stroke-linecap="square" stroke-linejoin="miter"/>',
                '</svg>'
            ].join('')

            echarts.registerMap('testGeoSVG_select_hover', { svg: svg });

            option = {
                // tooltip: {
                // },
                geo: {
                    map: 'testGeoSVG_select_hover',
                    roam: true,
                    selectedMode: 'single',
                    // height: '100%',
                    // center
                    // layoutCenter: ['30%', 40],
                    // layoutSize: 40,
                    // boundingCoords
                    zoom: 1,
                    aspectScale: 1,
                    label: {
                        show: true
                    },
                    emphasis: {
                        focus: 'self',
                        label: {
                            show: true,
                            fontSize: 100
                        }
                    },
                    select: {
                        itemStyle: {
                            color: 'red'
                        }
                    }
                }
            };

            var chart = testHelper.create(echarts, 'main_geo_svg_emphasis_select', {
                title: [
                    'click buttons',
                    'hover check',
                    'check focus-blur',
                    'check label no scale/rotate'
                ],
                option: option,
                info: {},
                infoKey: 'event',
                height: 200,
                button: [{
                    text: 'highlight a',
                    onclick: function () {
                        chart.dispatchAction({ type: 'highlight', geoIndex: 0, name: 'a' });
                    }
                }, {
                    text: 'downplay a',
                    onclick: function () {
                        chart.dispatchAction({ type: 'downplay', geoIndex: 0, name: 'a' });
                    }
                }, {
                    text: 'select a',
                    onclick: function () {
                        chart.dispatchAction({ type: 'geoSelect', geoIndex: 0, name: 'a' });
                    }
                }, {
                    text: 'unselect a',
                    onclick: function () {
                        chart.dispatchAction({ type: 'geoUnSelect', geoIndex: 0, name: 'a' });
                    }
                }, {
                    text: 'highlight b',
                    onclick: function () {
                        chart.dispatchAction({ type: 'highlight', geoIndex: 0, name: 'b' });
                    }
                }, {
                    text: 'downplay b',
                    onclick: function () {
                        chart.dispatchAction({ type: 'downplay', geoIndex: 0, name: 'b' });
                    }
                }, {
                    text: 'select b',
                    onclick: function () {
                        chart.dispatchAction({ type: 'geoSelect', geoIndex: 0, name: 'b' });
                    }
                }, {
                    text: 'unselect b',
                    onclick: function () {
                        chart.dispatchAction({ type: 'geoUnSelect', geoIndex: 0, name: 'b' });
                    }
                }]
            });

            listenAndPrintEvent(chart);

            if (chart) {
                chart.on('highlight', function () {
                });
            }

        });
        </script>







        <script>
            require([
                'echarts',
                'data/svg/flight-seats.svg'
            ], function (echarts, svg) {
                echarts.registerMap('flight-seats', {
                    svg: svg
                });

                option = {
                    tooltip: {
                    },
                    geo: {
                        map: 'flight-seats',
                        roam: true,
                        selectedMode: 'multiple',
                        tooltip: {
                            show: true
                        },
                        emphasis: {
                            itemStyle: {
                                color: null,
                                borderColor: '#780705',
                                borderWidth: 3
                            },
                            label: {
                                textBorderColor: '#fff',
                                textBorderWidth: 2
                            }
                        },
                        select: {
                            itemStyle: {
                                color: '#b50205'
                            },
                            label: {
                                show: false,
                                textBorderColor: '#fff',
                                textBorderWidth: 2
                            }
                        }
                    }
                };

                var chart = testHelper.create(echarts, 'main_pure_geo_svg', {
                    title: [
                        'pure geo component with svg resource',
                        'click seat: check **allSelected** correct.',
                        'hover seat: check **tooltip** and **label** correct.'
                    ],
                    option: option,
                    info: {},
                    infoKey: 'event',
                    height: 300
                });

                listenAndPrintEvent(chart);

            });
        </script>






        <script>
            require([
                'echarts',
                'data/svg/seatmap-example.svg'
            ], function (echarts, svg) {
                echarts.registerMap('seatmap', {
                    svg: svg
                });

                option = {
                    tooltip: {
                    },
                    series: {
                        type: 'map',
                        map: 'seatmap',
                        roam: true,
                        selectedMode: 'multiple',
                        // height: 100,
                        // zoom: 1.5
                        emphasis: {
                            label: {
                                textBorderColor: '#fff',
                                textBorderWidth: 2
                            }
                        },
                        select: {
                            itemStyle: {
                                color: '#b50205'
                            },
                            label: {
                                show: false,
                                textBorderColor: '#fff',
                                textBorderWidth: 2
                            }
                        }
                    }
                };

                var chart = testHelper.create(echarts, 'main_pure_map_svg', {
                    title: [
                        'pure map series with svg resource',
                        'Hover seat: check **tooltip** correct.'
                    ],
                    option: option,
                    info: {},
                    infoKey: 'event',
                    height: 300
                    // buttons: [{text: 'btn-txt', onclick: function () {}}],
                    // recordCanvas: true,
                });

                listenAndPrintEvent(chart);
            });
        </script>





        <script>
            require([
                'echarts',
                'data/svg/seatmap-example.svg'
            ], function (echarts, svg) {
                var option;
                echarts.registerMap('seatmap', {
                    svg: svg
                });

                option = {
                    tooltip: {
                    },
                    geo: {
                        map: 'seatmap',
                        roam: true,
                        selectedMode: 'multiple',
                        // height: 100,
                        // zoom: 1.5
                        tooltip: {
                            show: true
                        },
                        emphasis: {
                            label: {
                                textBorderColor: '#fff',
                                textBorderWidth: 2
                            }
                        },
                        select: {
                            itemStyle: {
                                color: '#b50205'
                            },
                            label: {
                                show: false,
                                textBorderColor: '#fff',
                                textBorderWidth: 2
                            }
                        }
                    },
                    series: {
                        type: 'map',
                        selectedMode: 'multiple',
                        coordinateSystem: 'geo',
                        geoIndex: 0
                    }
                };

                var chart = testHelper.create(echarts, 'main_map_geo_svg', {
                    title: [
                        'map series on declared geo with svg resource',
                        'Hover seat: check **tooltip** correct.'
                    ],
                    option: option,
                    info: {},
                    infoKey: 'event',
                    height: 300
                    // buttons: [{text: 'btn-txt', onclick: function () {}}],
                    // recordCanvas: true,
                });

                listenAndPrintEvent(chart);
            });
        </script>






        <script>
        require(['echarts'/*, 'map/js/china' */], function (echarts) {
            const svg = [
                '<?xml version="1.0" encoding="utf-8"?>',
                '<svg xmlns="http://www.w3.org/2000/svg" xmlns:ooo="http://xml.openoffice.org/svg/export" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.2" fill-rule="evenodd" xml:space="preserve">',
                '<path name="a" d="M 0,0 L 0,100 100,100 100,0 Z" fill="green" stroke="rgb(56,93,138)" stroke-width="2" stroke-linecap="square" stroke-linejoin="miter"/>',
                '<path name="b" d="M 150,0 L 150,100 250,100 250,0 Z" fill="blue" stroke="rgb(56,93,138)" stroke-width="2" stroke-linecap="square" stroke-linejoin="miter"/>',
                '</svg>'
            ].join('')

            echarts.registerMap('testGeoSVGclick', { svg: svg });

            var option = {
                geo: {
                    map: 'testGeoSVGclick',
                    selectedMode: 'single',
                    zoom: 1,
                    aspectScale: 1,
                    label: {
                        show: true
                    }
                }
            };

            var chart = testHelper.create(echarts, 'main_geo_svg_click_finder', {
                title: [
                    'Click green rect, should display click event.',
                    'Click blue rect, should display nothing.'
                ],
                option: option,
                info: {},
                infoKey: 'click event',
                height: 200
            });

            if (chart) {
                chart.on('click', { geoIndex: 0, name: 'a' }, function (params) {
                    console.log(params);
                    chart.__testHelper.updateInfo({
                        componentIndex: params.componentIndex,
                        componentType: params.componentType,
                        geoIndex: params.geoIndex,
                        name: params.name
                    }, 'click event');
                });
            }

        });
        </script>







        <script>
        require(['echarts'/*, 'map/js/china' */], function (echarts) {
            const svg = [
                '<?xml version="1.0" encoding="utf-8"?>',
                '<svg xmlns="http://www.w3.org/2000/svg" xmlns:ooo="http://xml.openoffice.org/svg/export" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.2" fill-rule="evenodd" xml:space="preserve">',
                '<path name="a" d="M 0,0 L 0,100 100,100 100,0 Z" fill="green" stroke="rgb(56,93,138)" stroke-width="2" stroke-linecap="square" stroke-linejoin="miter"/>',
                '</svg>'
            ].join('')

            echarts.registerMap('testGeoSVG_for_multiple_test', { svg: svg });

            var option = {
                geo: [{
                    id: 'g1',
                    map: 'testGeoSVG_for_multiple_test',
                    selectedMode: 'single',
                    layoutCenter: ['25%', '50%'],
                    layoutSize: 20,
                    select: {
                        itemStyle: { color: 'red' }
                    }
                }, {
                    id: 'g2',
                    map: 'testGeoSVG_for_multiple_test',
                    selectedMode: 'single',
                    layoutCenter: ['50%', '50%'],
                    layoutSize: 20,
                    select: {
                        itemStyle: { color: 'red' }
                    },
                }, {
                    id: 'g3',
                    map: 'testGeoSVG_for_multiple_test',
                    selectedMode: 'single',
                    layoutCenter: ['75%', '50%'],
                    layoutSize: 20,
                    select: {
                        itemStyle: { color: 'red' }
                    },
                }]
            };

            var chart = testHelper.create(echarts, 'main_geo_svg_multiple_geo', {
                title: [
                    'Select the three rect to red.',
                    'click btn. Check all of the existing rect removed,',
                    'and only one new green rect generated.'
                ],
                option: option,
                height: 200,
                buttons: [{
                    text: 'change geo (replaceMerge)',
                    onclick: function (params) {
                        chart.setOption({
                            geo: {
                                id: 'g4',
                                map: 'testGeoSVG_for_multiple_test',
                                selectedMode: 'single',
                                layoutCenter: ['40%', '50%'],
                                layoutSize: 40,
                                select: {
                                    itemStyle: { color: 'red' }
                                }
                            }
                        }, { replaceMerge: 'geo' });
                    }
                }]
            });

        });
        </script>






    </body>
</html>