|  | <!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="map_click_event"></div> | 
|  | <div id="geo_click_event"></div> | 
|  | <div id="label_position"></div> | 
|  |  | 
|  |  | 
|  |  | 
|  | <script> | 
|  | require([ | 
|  | 'echarts', | 
|  | ], function (echarts) { | 
|  |  | 
|  | var testGeoJSON1 = { | 
|  | 'type': 'FeatureCollection', | 
|  | 'features': [{ | 
|  | 'type': 'Feature', | 
|  | 'geometry': { 'type': 'Polygon', 'coordinates': [ | 
|  | [[2000, 3000], [2100, 3000], [3100, 2100], [2000, 2100]] | 
|  | ]}, | 
|  | 'properties': { | 
|  | 'name': 'AAA', 'childNum': 1 | 
|  | } | 
|  | }, { | 
|  | 'type': 'Feature', | 
|  | 'geometry': { 'type': 'Polygon', 'coordinates': [ | 
|  | [[5500, 3000], [6000, 3000], [5500, 2100], [6000, 2100]] | 
|  | ]}, | 
|  | 'properties': { | 
|  | 'name': 'BBB', 'childNum': 1 | 
|  | } | 
|  | }, { | 
|  | 'type': 'Feature', | 
|  | 'geometry': { 'type': 'Polygon', 'coordinates': [ | 
|  | [[3000, 2000], [5000, 2000], [5000, 5000], [3000, 5000]] | 
|  | ]}, | 
|  | 'properties': { | 
|  | 'name': 'AAA', 'childNum': 1 | 
|  | } | 
|  | }] | 
|  | }; | 
|  | var mapType = 'world1'; | 
|  | echarts.registerMap(mapType, testGeoJSON1); | 
|  |  | 
|  | var option = { | 
|  | tooltip: {}, | 
|  | series: [{ | 
|  | type: 'map', | 
|  | map: mapType, | 
|  | label: { | 
|  | formatter: '{c}' | 
|  | }, | 
|  | data: [{ | 
|  | name: 'AAA', | 
|  | value: 76543, | 
|  | }, { | 
|  | name: 'BBB', | 
|  | value: 12345 | 
|  | }] | 
|  | }] | 
|  | }; | 
|  |  | 
|  | var chart = testHelper.create(echarts, 'map_click_event', { | 
|  | title: [ | 
|  | 'Map: Click on the regions. **checked: Pass** should be displayed.' | 
|  | ], | 
|  | option: option, | 
|  | height: 400, | 
|  | }); | 
|  |  | 
|  | if (chart) { | 
|  | chart.on('click', {seriesIndex: 0, name: 'AAA'}, function (event) { | 
|  | checkClickEvent(event, 'AAA', 76543); | 
|  | }); | 
|  | chart.on('click', {seriesIndex: 0, name: 'BBB'}, function (event) { | 
|  | checkClickEvent(event, 'BBB', 12345); | 
|  | }); | 
|  | function checkClickEvent(event, name, value) { | 
|  | testHelper.printAssert(chart, function (assert) { | 
|  | assert(event.componentType === 'series'); | 
|  | assert(event.seriesType === 'map'); | 
|  | assert(event.seriesIndex === 0); | 
|  | assert(event.name === name); | 
|  | assert(event.value === value); | 
|  | assert(event.data.name === name); | 
|  | assert(event.data.value === value); | 
|  | }); | 
|  | } | 
|  | } | 
|  | }); | 
|  | </script> | 
|  |  | 
|  |  | 
|  |  | 
|  |  | 
|  |  | 
|  |  | 
|  |  | 
|  | <script> | 
|  | require([ | 
|  | 'echarts', | 
|  | ], function (echarts) { | 
|  |  | 
|  | var testGeoJSON1 = { | 
|  | 'type': 'FeatureCollection', | 
|  | 'features': [{ | 
|  | 'type': 'Feature', | 
|  | 'geometry': { 'type': 'Polygon', 'coordinates': [ | 
|  | [[2000, 3000], [2100, 3000], [3100, 2100], [2000, 2100]] | 
|  | ]}, | 
|  | 'properties': { | 
|  | 'name': 'AAA', 'childNum': 1 | 
|  | } | 
|  | }, { | 
|  | 'type': 'Feature', | 
|  | 'geometry': { 'type': 'Polygon', 'coordinates': [ | 
|  | [[5500, 3000], [6000, 3000], [5500, 2100], [6000, 2100]] | 
|  | ]}, | 
|  | 'properties': { | 
|  | 'name': 'BBB', 'childNum': 1 | 
|  | } | 
|  | }, { | 
|  | 'type': 'Feature', | 
|  | 'geometry': { 'type': 'Polygon', 'coordinates': [ | 
|  | [[3000, 2000], [5000, 2000], [5000, 5000], [3000, 5000]] | 
|  | ]}, | 
|  | 'properties': { | 
|  | 'name': 'AAA', 'childNum': 1 | 
|  | } | 
|  | }] | 
|  | }; | 
|  | var mapType = 'world1'; | 
|  | echarts.registerMap(mapType, testGeoJSON1); | 
|  |  | 
|  | var option = { | 
|  | tooltip: {}, | 
|  | geo: [{ | 
|  | map: mapType | 
|  | }] | 
|  | }; | 
|  |  | 
|  | var chart = testHelper.create(echarts, 'geo_click_event', { | 
|  | title: [ | 
|  | 'Geo: Click on the regions. **checked: Pass** should be displayed.' | 
|  | ], | 
|  | option: option, | 
|  | height: 400, | 
|  | }); | 
|  |  | 
|  | if (chart) { | 
|  | chart.on('click', {geoIndex: 0, name: 'AAA'}, function (event) { | 
|  | checkClickEvent(event, 'AAA', 76543); | 
|  | }); | 
|  | chart.on('click', {geoIndex: 0, name: 'BBB'}, function (event) { | 
|  | checkClickEvent(event, 'BBB', 12345); | 
|  | }); | 
|  | function checkClickEvent(event, name, value) { | 
|  | console.log(event); | 
|  | testHelper.printAssert(chart, function (assert) { | 
|  | assert(event.componentType === 'geo'); | 
|  | assert(event.componentIndex === 0); | 
|  | assert(event.name === name); | 
|  | }); | 
|  | } | 
|  | } | 
|  | }); | 
|  | </script> | 
|  |  | 
|  |  | 
|  |  | 
|  |  | 
|  | <script> | 
|  | require([ | 
|  | 'echarts', | 
|  | ], function (echarts) { | 
|  |  | 
|  | var NAME = 'AAAA'; | 
|  | var testGeoJSON1 = { | 
|  | 'type': 'FeatureCollection', | 
|  | 'features': [{ | 
|  | 'type': 'Feature', | 
|  | 'geometry': { 'type': 'Polygon', 'coordinates': [ | 
|  | [[2000, 2000], [2100, 2000], [2100, 2100], [2000, 2100]] | 
|  | ]}, | 
|  | 'properties': { | 
|  | 'name': NAME, 'childNum': 1, | 
|  | cp: [2000, 4000] | 
|  | } | 
|  | // }, { | 
|  | //     'type': 'Feature', | 
|  | //     'geometry': { 'type': 'Polygon', 'coordinates': [ | 
|  | //         [[3000, 2000], [7000, 2000], [7000, 5000], [3000, 5000]] | 
|  | //     ]}, | 
|  | //     'properties': { | 
|  | //         'name': NAME, 'childNum': 1, | 
|  | //         cp: [2600, 5200] | 
|  | //     } | 
|  | }] | 
|  | }; | 
|  | var mapType = 'world1'; | 
|  | echarts.registerMap(mapType, testGeoJSON1); | 
|  |  | 
|  | var option = { | 
|  | animation: false, | 
|  | backgroundColor: '#404a59', | 
|  | animationDurationUpdate: 800, | 
|  | visualMap: { | 
|  | max: 3000, | 
|  | show: false | 
|  | }, | 
|  | series: [{ | 
|  | type: 'map', | 
|  | map: mapType, | 
|  | zoom: 0.03, | 
|  | label: { | 
|  | formatter: '{c}', | 
|  | textStyle: { | 
|  | color: '#50d5d3', | 
|  | fontWeight: 'bolder', | 
|  | fontSize: Math.round(12361 / 500) + 20 | 
|  | }, | 
|  | show: true | 
|  | }, | 
|  | emphasis: { | 
|  | show: true, | 
|  | itemStyle: { | 
|  | shadowColor: 'rgba(0, 0, 0, 0.5)', | 
|  | shadowBlur: 20, | 
|  | borderWidth: 2 | 
|  | } | 
|  | }, | 
|  | data: [{ | 
|  | name: NAME, | 
|  | value: 12361 | 
|  | }] | 
|  | }] | 
|  | }; | 
|  |  | 
|  | var chart = testHelper.create(echarts, 'label_position', { | 
|  | title: [ | 
|  | 'Hover on the rect, the label should not be moved' | 
|  | ], | 
|  | option: option, | 
|  | height: 800, | 
|  | }); | 
|  | }); | 
|  | </script> | 
|  |  | 
|  |  | 
|  |  | 
|  |  | 
|  |  | 
|  | </body> | 
|  | </html> | 
|  |  |