map.tpl.php 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  1. <?php if (!defined("IS_INITPHP")) exit("Access Denied!"); /* INITPHP Version 1.0 ,Create on 2018-02-09 11:06:46, compiled from /data/wwwroot/www.shadowsocks5.com/app/template/ss/index/map.html */ ?>
  2. <!DOCTYPE html>
  3. <head>
  4. <meta charset="utf-8">
  5. <title>ECharts</title>
  6. </head>
  7. <body>
  8. <!-- 为ECharts准备一个具备大小(宽高)的Dom -->
  9. <div id="main" style="height:800px"></div>
  10. <!-- ECharts单文件引入 -->
  11. <script src="https://www.shadowsocks5.com/build/dist/echarts.js"></script>
  12. <script type="text/javascript">
  13. // 路径配置
  14. require.config({
  15. paths: {
  16. echarts: 'https://www.shadowsocks5.com/build/dist'
  17. }
  18. });
  19. // 使用
  20. require(
  21. [
  22. 'echarts',
  23. 'echarts/chart/line',
  24. 'echarts/chart/bar',
  25. 'echarts/chart/scatter',
  26. 'echarts/chart/k',
  27. 'echarts/chart/pie',
  28. 'echarts/chart/radar',
  29. 'echarts/chart/force',
  30. 'echarts/chart/chord',
  31. 'echarts/chart/gauge',
  32. 'echarts/chart/funnel',
  33. 'echarts/chart/eventRiver',
  34. 'echarts/chart/venn',
  35. 'echarts/chart/treemap',
  36. 'echarts/chart/tree',
  37. 'echarts/chart/wordCloud',
  38. 'echarts/chart/heatmap',
  39. 'echarts/chart/map'
  40. ],
  41. function (ec) {
  42. // 基于准备好的dom,初始化echarts图表
  43. var myChart = ec.init(document.getElementById('main'));
  44. var option = {
  45. dataRange: {
  46. min: 0,
  47. max: 3000,
  48. orient: 'horizontal',
  49. splitNumber: 30,
  50. color:['#31A829','#D8F6D5'],
  51. //color:['#1556A1','#136BD4','#6C98D5','#9FCCFF','#DCECFF'],
  52. x: 'right',
  53. y: 'top',
  54. calculable : true
  55. },
  56. title: {
  57. text: '用户分布图',
  58. left: 'center'
  59. },
  60. series : [
  61. {
  62. name: 'Map',
  63. type: 'map',
  64. mapType: 'china',
  65. label: {
  66. normal: {
  67. show: true
  68. },
  69. emphasis: {
  70. show: true
  71. }
  72. },
  73. label: {
  74. normal: {
  75. show: true
  76. },
  77. emphasis: {
  78. show: true
  79. }
  80. },
  81. mapLocation: {
  82. x : 'left',
  83. y : 'top',
  84. height : 500
  85. },
  86. selectedMode: 'multiple',
  87. data:[<?php foreach ($china as $k1=>$v1) { ?>{
  88. name: '<?php echo $v1;?>',
  89. value: <?php echo $value[$k1];?>,
  90. },<?php } ?>
  91. ],
  92. }
  93. ],
  94. tooltip : {
  95. trigger: 'item',
  96. formatter:'{b}:{c}'
  97. },
  98. };
  99. // 为echarts对象加载数据
  100. myChart.setOption(option);
  101. }
  102. );
  103. </script>
  104. </body>