word_statistics.php 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222
  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:50em;"></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 = JSON.parse(data);
  74. // Splice in transparent for the center circle
  75. Highcharts.getOptions().colors.splice(0, 0, 'transparent');
  76. Highcharts.setOptions({
  77. colors: ['#058DC7', '#50B432', '#ED561B', '#DDDF00', '#24CBE5', '#64E572', '#FF9655', '#FFF263', '#6AF9C4']
  78. });
  79. Highcharts.chart('container', {
  80. chart: {
  81. height: '100%'
  82. },
  83. title: {
  84. text: gLocal.gui.distribution
  85. },
  86. subtitle: {
  87. text: ''
  88. },
  89. series: [{
  90. type: "sunburst",
  91. data: worddata,
  92. allowDrillToNode: true,
  93. cursor: 'pointer',
  94. dataLabels: {
  95. format: '{point.name}',
  96. filter: {
  97. property: 'innerArcLength',
  98. operator: '>',
  99. value: 16
  100. },
  101. rotationMode: 'circular'
  102. },
  103. levels: [{
  104. level: 1,
  105. levelIsConstant: false,
  106. dataLabels: {
  107. style: {
  108. fontSize: 'x-large',
  109. },
  110. filter: {
  111. property: 'outerArcLength',
  112. operator: '>',
  113. value: 64
  114. }
  115. }
  116. }, {
  117. level: 2,
  118. colorByPoint: true,
  119. dataLabels: {
  120. style: {
  121. fontSize: 'large',
  122. },
  123. }
  124. },
  125. {
  126. level: 3,
  127. colorVariation: {
  128. key: 'brightness',
  129. to: -0.5
  130. },
  131. dataLabels: {
  132. style: {
  133. fontSize: 'small',
  134. },
  135. }
  136. }, {
  137. level: 4,
  138. colorVariation: {
  139. key: 'brightness',
  140. to: 0.5
  141. }
  142. }]
  143. }],
  144. tooltip: {
  145. headerFormat: "",
  146. 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> '+gLocal.gui.times
  147. }
  148. });
  149. });
  150. $.get("../search/word_list.php",
  151. {
  152. word : "<?php echo $_GET["word"] ?>"
  153. },
  154. function(data,status){
  155. let worddata = JSON.parse(data);
  156. Highcharts.chart('container_list', {
  157. chart: {
  158. type: 'bar'
  159. },
  160. title: {
  161. text: gLocal.gui.declension_list,
  162. style: {
  163. fontSize: 'large',
  164. }
  165. },
  166. xAxis: {
  167. categories: worddata.wordlist,
  168. labels: {
  169. enabled: true,//显示
  170. //crosshair: false, 功能未知
  171. style: {
  172. fontSize: 'small',
  173. }
  174. },
  175. },
  176. yAxis: {
  177. min: 0,
  178. title: {
  179. text: gLocal.gui.frequency,
  180. style: {
  181. fontSize: 'large',
  182. }
  183. },
  184. labels: {
  185. style: {
  186. fontSize: 'small',
  187. }
  188. },
  189. },
  190. legend: {
  191. reversed: true,
  192. verticalAlign: "top",
  193. enabled: true //图例开关
  194. },
  195. plotOptions: {
  196. series: {
  197. stacking: 'normal'
  198. },
  199. bar: {
  200. pointPadding: 0,
  201. borderWidth: 0,
  202. pointWidth: 20,
  203. allowOverlap: true,
  204. }
  205. },
  206. series: worddata.data
  207. });
  208. });
  209. </script>
  210. <?php
  211. include "../pcdl/html_foot.php";
  212. ?>