Forest-count.html 7.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256
  1. <!doctype html>
  2. <html>
  3. <head>
  4. <meta charset="utf-8">
  5. <title>林地地类占比分析</title>
  6. <meta name="viewport"
  7. content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
  8. <!-- 引入mui样式 -->
  9. <link rel="stylesheet" type="text/css" href="../css/mui.css" />
  10. <!-- 引入弹窗及选择器样式 -->
  11. <link rel="stylesheet" type="text/css" href="../css/mui.picker.min.css" />
  12. <link rel="stylesheet" type="text/css" href="../css/mui.poppicker.css" />
  13. <!-- 引入app样式 -->
  14. <link rel="stylesheet" type="text/css" href="../css/app.css" />
  15. <link rel="stylesheet" href="../css/app.new.css">
  16. <!-- 引入字体 -->
  17. <link rel="stylesheet" type="text/css" href="../fonts/TTTGB-Medium.css" />
  18. <link rel="stylesheet" type="text/css" href="../fonts/font-time.css" />
  19. </head>
  20. <body>
  21. <div class="jt-count-echarts-panel">
  22. <div class="jt-title">林地地类占比</div>
  23. <div class="jt-content" id="divCountPie_DL"></div>
  24. <div class="jt-title">林地分区占比</div>
  25. <div class="jt-content" id="divCountPie_FQ"></div>
  26. <div class="jt-title">林地乡镇占比</div>
  27. <div class="jt-content" id="divCountPie_XZ"></div>
  28. <div class="jt-title">乡镇林地地类统计</div>
  29. <div class="jt-content" id="divCountBarDL_SSXZ"></div>
  30. <div class="jt-title">分区地类统计</div>
  31. <div class="jt-content" id="divCountBarDL_FQ"></div>
  32. </div>
  33. </body>
  34. </html>
  35. <!-- 引入mui脚本 -->
  36. <script src="../js/mui.js" type="text/javascript" charset="utf-8"></script>
  37. <!-- 引入jQuery脚本 -->
  38. <script src="../js/jquery.js" type="text/javascript" charset="utf-8"></script>
  39. <!-- 引入通用脚本 -->
  40. <script src="../js/common.js" type="text/javascript" charset="utf-8"></script>
  41. <!-- 进入webview脚本 -->
  42. <script src="../js/webview.js" type="text/javascript" charset="utf-8"></script>
  43. <!-- 引入存储脚本 -->
  44. <script src="../js/save.js" type="text/javascript" charset="utf-8"></script>
  45. <!-- 引入ajax脚本 -->
  46. <script src="../js/ajax.js" type="text/javascript" charset="utf-8"></script>
  47. <!-- 图表脚本 -->
  48. <script src="../js/ECharts/echarts.js" type="text/javascript" charset="utf-8"></script>
  49. <!-- 自定义图表脚本 -->
  50. <script src="../js/CRECharts.js" type="text/javascript" charset="utf-8"></script>
  51. <!-- 本页独有脚本 -->
  52. <script type="text/javascript">
  53. /* mui初始化 */
  54. mui.init();
  55. /* 页面尺寸 */
  56. var pageSize = getPageSize();
  57. /* 初始化完成 */
  58. plusInit(function() {
  59. /* 重置图表的尺寸 */
  60. echartsSizeInit();
  61. /* 统计 */
  62. getForestCountPie(0);
  63. getForestCountBar(0);
  64. });
  65. /* 占比统计配置表 */
  66. var pieConfig = [{
  67. domId: 'divCountPie_DL',
  68. fldName: 'dlmc',
  69. echarObj: CountPie_DL,
  70. }, {
  71. domId: 'divCountPie_FQ',
  72. fldName: 'lyfq',
  73. echarObj: CountPie_FQ,
  74. }, {
  75. domId: 'divCountPie_XZ',
  76. fldName: 'ssxz',
  77. echarObj: CountPie_XZ,
  78. }];
  79. /* 统计分析配置表 */
  80. var barConfig = [{
  81. domId: 'divCountBarDL_SSXZ',
  82. fldName: 'ssxz',
  83. echarObj: CountBarDL_SSXZ,
  84. }, {
  85. domId: 'divCountBarDL_FQ',
  86. fldName: 'lyfq',
  87. echarObj: CountBarDL_FQ,
  88. }]
  89. /**
  90. * 根据字段查询统计占比情况
  91. * @param {number} index 配置项索引
  92. */
  93. function getForestCountPie(index) {
  94. if (index >= pieConfig.length) return;
  95. var config = pieConfig[index];
  96. var iData = {
  97. fldName: config.fldName,
  98. }
  99. sendAjax({
  100. url: 'appQueryForestCount',
  101. waitMessage: '分析中...',
  102. data: iData,
  103. success: function(resData) {
  104. showCountPie(resData, config);
  105. getForestCountPie(index + 1);
  106. },
  107. error: function(err) {
  108. muiAlertError(err);
  109. }
  110. })
  111. }
  112. /**
  113. * 根据字段查询统计情况
  114. * @param {number} index 配置项索引
  115. */
  116. function getForestCountBar(index) {
  117. if (index >= barConfig.length) return;
  118. var config = barConfig[index];
  119. var iData = {
  120. fldName: config.fldName,
  121. }
  122. sendAjax({
  123. url: 'appQueryForestCountByField',
  124. waitMessage: '分析中...',
  125. data: iData,
  126. success: function(resData) {
  127. showCountBar(resData, config);
  128. getForestCountBar(index + 1);
  129. },
  130. error: function(err) {
  131. muiAlertError(err);
  132. }
  133. })
  134. }
  135. /* 统计组件 */
  136. var CountPie_DL = undefined;
  137. var CountPie_FQ = undefined;
  138. var CountPie_XZ = undefined;
  139. var CountBarDL_SSXZ = undefined;
  140. var CountBarDL_FQ = undefined;
  141. /**
  142. * 释放图表资源
  143. * @param {Object} obj 图表控件
  144. */
  145. function eChartsDispose(obj) {
  146. if (obj != null && obj != "" && obj != undefined) obj.dispose();
  147. }
  148. /**
  149. * 展示占比统计结果
  150. * @param {JSON} data 展示数据
  151. * @param {JSON} config 配置项
  152. */
  153. function showCountPie(data, config) {
  154. var countPieData = [];
  155. for (var i in data) {
  156. countPieData.push({
  157. value: data[i].selName,
  158. name: data[i].selCode,
  159. });
  160. }
  161. var pieRadiusWidth = '65%';
  162. if (pageSize.width <= PageSize.smartSize) {
  163. pieRadiusWidth = '55%';
  164. }
  165. eChartsDispose(config.echarObj);
  166. config.echarObj = new CrCharts({
  167. domId: config.domId,
  168. });
  169. config.echarObj.createPie({
  170. data: countPieData,
  171. isAria: false,
  172. lineColor: 'rgb(133, 215, 253)',
  173. labelColor: 'rgb(255,255,255)',
  174. perLabelColor: 'rgb(129,181,218)',
  175. radius: [5, pieRadiusWidth],
  176. minAngle: 20,
  177. roseType: false,
  178. unit: '公顷',
  179. }, '面积统计');
  180. }
  181. /**
  182. * 展示统计分析结果
  183. * @param {JSON} data 数据集
  184. * @param {JSON} config 配置项
  185. */
  186. function showCountBar(data, config) {
  187. var dataZoomX = undefined;
  188. if (pageSize.width <= PageSize.smartSize) dataZoomX = true;
  189. /* 标签 */
  190. var labels = [];
  191. /* 数据集 */
  192. var datas = [{
  193. name: '乔木林地',
  194. data: [],
  195. }, {
  196. name: '灌木林地',
  197. data: [],
  198. }, {
  199. name: '竹林地',
  200. data: [],
  201. }, {
  202. name: '其他林地',
  203. data: [],
  204. }];
  205. /* 单位集合 */
  206. var units = [];
  207. for (var i in data) {
  208. var item = data[i];
  209. labels.push(item.keyName);
  210. units.push('公顷');
  211. datas[0].data.push(item.areaArbor);
  212. datas[1].data.push(item.areaShrub);
  213. datas[2].data.push(item.areaBamboo);
  214. datas[3].data.push(item.areaOther);
  215. }
  216. /* 展示柱状图 */
  217. var bbsData = {
  218. title: '分析',
  219. labels: labels,
  220. datas: datas,
  221. xrotate: 15,
  222. gridBottom: 90,
  223. gridTop: 60,
  224. dataZoomX: dataZoomX,
  225. }
  226. eChartsDispose(config.echarObj);
  227. config.echarObj = new CrCharts({
  228. domId: config.domId,
  229. labelColor: 'rgb(255,255,255)',
  230. legendTextColor: 'rgb(255,255,255)',
  231. xAxisLineColor: 'rgba(255,255,255,1.0)',
  232. yAxisLineColor: 'rgb(133, 215, 253)',
  233. splitLineColor: 'rgba(255,255,255,0.3)',
  234. xAxisLabel: {
  235. color: "rgba(255,255,255,1.0)",
  236. fontSize: 12,
  237. fontFamily: 'TTTGB-Medium',
  238. interval: 0,
  239. },
  240. yAxisLabel: {
  241. color: "rgb(133, 215, 253)",
  242. fontSize: 12,
  243. fontFamily: 'TTTGB-Medium',
  244. interval: 0,
  245. }
  246. });
  247. config.echarObj.createVerticalBar(bbsData, 60, false, units);
  248. }
  249. </script>