/
githubmirror
/
echarts
Обзор
Документация
Войти
/
githubmirror
/
echarts
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
master
test/visualMap-special-case.html
151 строка
5 KB
Ovilia
test(map): replace test cases with new map
09 дек 2024, 11:58
09 дек 2024, 11:58
181842f
Код
Авторство
О чём код?
<!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"> <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> <meta name="viewport" content="width=device-width, initial-scale=1" /> <link rel="stylesheet" href="lib/reset.css"> </head> <body> <style> body { } #main { height: 500px; } </style> <h1>visualMap should not work on area that no data (show show itemStyle color "light blue")</h1> <div id="main"></div> <script> var echarts; var colorTool; var chart; var myChart; var groupCategories = []; var groupColors = []; require([ 'echarts', 'map/js/china' ], function (ec) { echarts = ec; colorTool = echarts.color; var chart = echarts.init(document.getElementById('main')); option = { title: [{ text: '地图数据来源:天地图 cloudcenter.tianditu.gov.cn', subtext: '仅作为功能测试使用,线上产品应从天地图获取最新地图数据并申请审图号', link: 'https://cloudcenter.tianditu.gov.cn/', bottom: 15, left: 60, textStyle: { color: '#888', fontSize: 12 }, subtextStyle: { color: '#aaa', fontSize: 12 } }], "tooltip": { "trigger": "item", "formatter":function(params,ticket,cb){ //自定义显示框 params.value=params.value||0; var contentHTML=params.name+" - "+params.value; return contentHTML; } }, "visualMap": { "min": 0, "max": 96.89, "left": 20, "align": "bottom", "type": "piecewise", "bottom": 25, "text": ["覆盖率(高-低)"], "calculable": true, "inverse": true, "orient": "horizontal", "inRange": { "color": ["#d1eaff", "#1a96f0"] }, formatter: function (value) { return parseInt(value)||0; // 范围标签显示内容。 } }, "series": [{ "name": "中国", "type": "map", "mapType": "china", "selectedMode": "multiple", "itemStyle": { "normal": { "areaColor": "#d1eaff", "borderColor": "#fff" }, "emphasis": { "areaColor": "#f1f5f8" } }, "data": [{ "name": "浙江省", "value": "96.89" }, { "name": "unknown", "value": "2.67" }, { "name": "其它", "value": "0.44" }], center: [104.2, 36], zoom: 1.4 }] } chart.setOption(option); }); </script> </body> </html>