l_chart_vue.html 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139
  1. <!--********************************************************************
  2. * Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  3. *********************************************************************-->
  4. <!DOCTYPE html>
  5. <html>
  6. <head>
  7. <meta charset="UTF-8" />
  8. <title data-i18n="resources.title_componentsChart_Vue"></title>
  9. <script type="text/javascript" include="vue" src="../js/include-web.js"></script>
  10. <script include="echarts-vue,iclient-leaflet-vue" src="../../dist/leaflet/include-leaflet.js"></script>
  11. <style>
  12. #main {
  13. margin: 0 auto;
  14. width: 100%;
  15. height: 100%;
  16. }
  17. .sm-component-chart {
  18. z-index: 500;
  19. }
  20. .sm-component-chart .sm-component-collapse-card__content {
  21. height: 300px;
  22. }
  23. </style>
  24. </head>
  25. <body style=" margin: 0;overflow: hidden;background: #fff;width: 100%;height:100%;position: absolute;top: 0;">
  26. <div id="main">
  27. <sm-web-map server-url='https://iportal.supermap.io/iportal' map-id="801571284">
  28. </sm-web-map>
  29. <sm-chart icon-class="" :style="chartStyle" :options="echartOptions" :dataset="dataset"
  30. :dataset-options="datasetOptions" background="rgba(255,255,255,0.5)"></sm-chart>
  31. <sm-chart icon-class="" :style="chartStyle1" :options="echartOptions1" :dataset="dataset"
  32. :dataset-options="datasetOptions1" background="rgba(255,255,255,0.5)"></sm-chart>
  33. <sm-chart icon-class="" :style="chartStyle2" :options="echartOptions2" :dataset="dataset"
  34. :dataset-options="datasetOptions2" background="rgba(255,255,255,0.5)"></sm-chart>
  35. </div>
  36. <script>
  37. new Vue({
  38. el: '#main',
  39. data() {
  40. return {
  41. chartStyle: {
  42. position: "absolute",
  43. bottom: "10px",
  44. right: "10px"
  45. },
  46. chartStyle1: {
  47. position: "absolute",
  48. bottom: "10px",
  49. right: "420px"
  50. },
  51. chartStyle2: {
  52. position: "absolute",
  53. bottom: "10px",
  54. right: "830px"
  55. },
  56. dataset: new SuperMap.Components.commontypes.iPortalDataParameter({
  57. url: "https://iportal.supermap.io/iportal/web/datas/676516522",
  58. maxFeatures: 20
  59. }),
  60. // echarts中涉及到超图数据series和坐标轴的字段的配置
  61. datasetOptions: [
  62. {
  63. seriesType: "bar", //图表类型
  64. isStastic: true, //是否统计, 默认不统计
  65. isStack: true, //是否堆叠, 默认不堆叠
  66. xField: "机场", //x坐标轴数据字段
  67. yField: "2016起降架次(架次)" //统计的数据,legned默认名字
  68. },
  69. {
  70. seriesType: "bar",
  71. isStastic: true,
  72. isStack: true,
  73. xField: "机场",
  74. yField: "2017起降架次(架次)",
  75. }
  76. ],
  77. datasetOptions1: [
  78. {
  79. seriesType: "line", //图表类型
  80. isStastic: true, //是否统计, 默认不统计
  81. isStack: true, //是否堆叠, 默认不堆叠
  82. xField: "机场", //x坐标轴数据字段
  83. yField: "2016旅客吞吐量(人次)" //统计的数据,legned默认名字
  84. },
  85. {
  86. seriesType: "line",
  87. isStastic: true,
  88. isStack: true,
  89. xField: "机场",
  90. yField: "2017旅客吞吐量(人次)"
  91. }
  92. ],
  93. datasetOptions2: [
  94. {
  95. seriesType: "scatter", //图表类型
  96. isStastic: true, //是否统计, 默认不统计
  97. isStack: false, //是否堆叠, 默认不堆叠
  98. xField: "机场", //x坐标轴数据字段
  99. yField: "同比增速%" //统计的数据,legned默认名字
  100. }
  101. ],
  102. // 和echarts一样的配置
  103. echartOptions: {
  104. legend: { data: ['2016起降架次(架次)', '2017起降架次(架次)'] }, //与yField数据一致
  105. tooltip: { formatter: "{b0}: {c0}" },
  106. grid: {
  107. top: 30,
  108. bottom: 60,
  109. left: 60,
  110. right: 30
  111. }
  112. },
  113. echartOptions1: {
  114. legend: { data: ['2016旅客吞吐量(人次)', '2017旅客吞吐量(人次)'] }, //与yField数据一致
  115. tooltip: { formatter: "{b0}: {c0}" },
  116. grid: {
  117. top: 30,
  118. bottom: 60,
  119. left: 60,
  120. right: 30
  121. }
  122. },
  123. echartOptions2: {
  124. legend: { data: ['同比增速%'] },//与yField数据一致
  125. tooltip: { formatter: "{b0}: {c0}" },
  126. }
  127. };
  128. }
  129. })
  130. </script>
  131. </body>
  132. </html>