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
| <html style="height: 100%">
<head> <meta charset="utf-8"> <meta charset="utf-8"> <meta name="viewport" content="width=device-width,initial-scale=1.0,maximum-scale=1.0,user-scalable=0"> <style type="text/css"> html, body { margin: 0; padding: 0; height: 100%; box-sizing: border-box; }
#container { width: 100%; height: 100%; } </style> </head>
<body> <div id="container"></div> </body>
<script src="./js/echarts.min.js"></script> <script src="./js/echarts-gl.min.js"></script> <script type="text/javascript"> let dom = document.getElementById("container"); let myChart = echarts.init(dom); let ds = [{ name: '中国', point: [116.46, 39.92, 0], itemStyleColor: '#f00', labelText: '中国•3000' }, { name: '印度', point: [78.96288, 20.593684, 0], itemStyleColor: '#99CC66', labelText: '印度•500' }, { name: '意大利', point: [12.56738, 41.87194, 0], itemStyleColor: '#9999FF', labelText: '意大利•200' }, { name: '新西兰', point: [174.885971, -40.900557, 0], itemStyleColor: '#339966', labelText: '新西兰•10' }, { name: '英国', point: [-3.435973, 55.378051, 0], itemStyleColor: '#993366', labelText: '英国•1000' }, { name: '德国', point: [10.451526, 51.165691, 0], itemStyleColor: '#996666', labelText: '德国•200' }, { name: '美国', point: [-95.712891, 37.09024, 0], itemStyleColor: '#66CCFF', labelText: '美国•2200' }, { name: '日本', point: [138.252924, 36.204824, 0], itemStyleColor: '#666666', labelText: '日本•2500' }]
let series = ds.map(item => { return { name: item.name, type: 'scatter3D', coordinateSystem: 'globe', blendMode: 'lighter', symbolSize: 16,
itemStyle: { color: item.itemStyleColor, opacity: 1, borderWidth: 1, borderColor: 'rgba(255,255,255,0.8)' }, label: { show: true, position: 'left', formatter: item.labelText, textStyle: { color: '#fff', borderWidth: 0, borderColor: '#fff', fontFamily: 'sans-serif', fontSize: 18, fontWeight: 700 } }, data: [item.point] } })
myChart.setOption({ legend: { selectedMode: 'multiple', x: 'right', y: 'bottom', data: ds.map(item => { return item.name }), padding: [0, 550, 140, 0], orient: 'vertical', textStyle: { color: '#fff', } }, backgroundColor: '#2E2677', globe: { baseTexture: './image/bg4.jpg', shading: 'color', viewControl: { autoRotate: true, autoRotateSpeed: 3, autoRotateAfterStill: 2, rotateSensitivity: 2, targetCoord: [116.46, 39.92], maxDistance: 200, minDistance: 200 } }, series: series }) </script>
</html>
|