word_statistics.php 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237
  1. <?PHP
  2. include "../pcdl/html_head.php";
  3. require_once "../public/load_lang_js.php";//语言文件
  4. ?>
  5. <body>
  6. <style type="text/css">
  7. .highcharts-figure, .highcharts-data-table table {
  8. flex:1;
  9. min-width: 220px;
  10. max-width: 100%;
  11. margin: 1em auto;
  12. }
  13. .highcharts-data-table table {
  14. font-family: Verdana, sans-serif;
  15. border-collapse: collapse;
  16. border: 1px solid #EBEBEB;
  17. margin: 10px auto;
  18. text-align: center;
  19. width: 100%;
  20. max-width: 500px;
  21. }
  22. .highcharts-data-table caption {
  23. padding: 1em 0;
  24. font-size: 1.2em;
  25. color: #555;
  26. }
  27. .highcharts-data-table th {
  28. font-weight: 600;
  29. padding: 0.5em;
  30. }
  31. .highcharts-data-table td, .highcharts-data-table th, .highcharts-data-table caption {
  32. padding: 0.5em;
  33. }
  34. .highcharts-data-table thead tr, .highcharts-data-table tr:nth-child(even) {
  35. background: #f8f8f8;
  36. }
  37. .highcharts-data-table tr:hover {
  38. background: #f1f7ff;
  39. }
  40. .chart_head_1 {
  41. text-align: center;
  42. font-size: x-large;
  43. margin-bottom: 0;
  44. font-weight: bold;
  45. }
  46. .highcharts-data-label {
  47. font-size: small;
  48. }
  49. </style>
  50. <script src="../public/js/highcharts/highcharts.js"></script>
  51. <script src="../public/js/highcharts/modules/sunburst.js"></script>
  52. <script src="../public/js/highcharts/modules/exporting.js"></script>
  53. <script src="../public/js/highcharts/modules/export-data.js"></script>
  54. <script src="../public/js/highcharts/modules/accessibility.js"></script>
  55. <?php
  56. require_once("../pcdl/head_bar.php");
  57. ?>
  58. <h2 class="chart_head_1"><?php echo $_local->gui->statistical.$_local->gui->chart.":"; ?><?php echo ucfirst($_GET["word"]) ?></h2>
  59. <div style="display:flex;">
  60. <figure class="highcharts-figure">
  61. <div id="container"></div>
  62. </figure>
  63. <figure class="highcharts-figure">
  64. <div id="container_list" style="height:56em;"></div>
  65. </figure>
  66. </div>
  67. <script type="text/javascript">
  68. $.get("../search/word_statistics.php",
  69. {
  70. word : "<?php echo $_GET["word"] ?>"
  71. },
  72. function(data,status){
  73. let worddata;
  74. try {
  75. worddata = JSON.parse(data);
  76. } catch (error) {
  77. console(error);
  78. }
  79. // Splice in transparent for the center circle
  80. Highcharts.getOptions().colors.splice(0, 0, 'transparent');
  81. Highcharts.setOptions({
  82. colors: ['#f5f5f5', '#d2691e', '#7cb5ec', '#f08080', '#ffd700', '#f15c80', '#e4d354', '#8b0000', '#8d4653']
  83. });
  84. Highcharts.chart('container', {
  85. chart: {
  86. height: '100%'
  87. },
  88. title: {
  89. text: gLocal.gui.distribution
  90. },
  91. subtitle: {
  92. text: ''
  93. },
  94. series: [{
  95. type: "sunburst",
  96. data: worddata,
  97. allowDrillToNode: true,
  98. cursor: 'pointer',
  99. dataLabels: {
  100. format: '{point.name}',
  101. filter: {
  102. property: 'innerArcLength',
  103. operator: '>',
  104. value: 16
  105. },
  106. rotationMode: 'circular'
  107. },
  108. levels: [{
  109. level: 1,
  110. levelIsConstant: false,
  111. dataLabels: {
  112. style: {
  113. fontSize: 'x-large',
  114. },
  115. filter: {
  116. property: 'outerArcLength',
  117. operator: '>',
  118. value: 64
  119. }
  120. }
  121. }, {
  122. level: 2,
  123. colorByPoint: true,
  124. dataLabels: {
  125. style: {
  126. fontSize: 'large',
  127. },
  128. }
  129. },
  130. {
  131. level: 3,
  132. colorVariation: {
  133. key: 'brightness',
  134. to: -0.5
  135. },
  136. dataLabels: {
  137. style: {
  138. fontSize: 'small',
  139. },
  140. }
  141. }, {
  142. level: 4,
  143. colorVariation: {
  144. key: 'brightness',
  145. to: 0.5
  146. }
  147. }]
  148. }],
  149. tooltip: {
  150. headerFormat: "",
  151. pointFormat: '<b><?php echo ucfirst($_GET["word"]) ?></b> <?php echo $_local->gui->in ?> <b>{point.name}</b> <?php echo $_local->gui->present ?> <b>{point.value}</b> <?php echo $_local->gui->times2 ?>'
  152. }
  153. });
  154. });
  155. $.get("../search/word_list.php",
  156. {
  157. word : "<?php echo $_GET["word"] ?>"
  158. },
  159. function(data,status){
  160. let worddata = JSON.parse(data);
  161. Highcharts.chart('container_list', {
  162. chart: {
  163. type: 'bar'
  164. },
  165. title: {
  166. text: gLocal.gui.declension_list,
  167. style: {
  168. fontSize: 'large',
  169. }
  170. },
  171. xAxis: {
  172. categories: worddata.wordlist,
  173. labels: {
  174. enabled: true,//显示
  175. //crosshair: false, 功能未知
  176. style: {
  177. fontSize: 'small',
  178. },
  179. padding: 5,
  180. //reserveSpace: false, 轴标签是否占空间
  181. step: 1//每个标签都显示,不跳
  182. },
  183. //tickWidth: 1,//刻度显示宽度
  184. //tickPixelInterval: 0,
  185. //tickAmount: 10
  186. },
  187. yAxis: {
  188. min: 0,
  189. title: {
  190. text: gLocal.gui.frequency,
  191. style: {
  192. fontSize: 'large',
  193. }
  194. },
  195. labels: {
  196. style: {
  197. fontSize: 'small',
  198. }
  199. },
  200. },
  201. legend: {
  202. reversed: true,
  203. verticalAlign: "top",
  204. enabled: true //图例开关
  205. },
  206. plotOptions: {
  207. series: {
  208. stacking: 'normal'
  209. },
  210. bar: {
  211. pointPadding: 0,
  212. borderWidth: 0,
  213. //pointWidth: 10,
  214. dataLabels: {
  215. //allowOverlap: true,
  216. //enabled: true
  217. }
  218. }
  219. },
  220. series: worddata.data
  221. });
  222. });
  223. </script>
  224. <?php
  225. include "../pcdl/html_foot.php";
  226. ?>