word_statistics.php 6.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231
  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 = JSON.parse(data);
  74. // Splice in transparent for the center circle
  75. Highcharts.getOptions().colors.splice(0, 0, 'transparent');
  76. Highcharts.setOptions({
  77. colors: ['#f5f5f5', '#d2691e', '#7cb5ec', '#f08080', '#ffd700', '#f15c80', '#e4d354', '#8b0000', '#8d4653']
  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> <?php echo $_local->gui->times2 ?>'
  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. padding: 5,
  175. //reserveSpace: false, 轴标签是否占空间
  176. step: 1//每个标签都显示,不跳
  177. },
  178. //tickWidth: 1,//刻度显示宽度
  179. //tickPixelInterval: 0,
  180. //tickAmount: 10
  181. },
  182. yAxis: {
  183. min: 0,
  184. title: {
  185. text: gLocal.gui.frequency,
  186. style: {
  187. fontSize: 'large',
  188. }
  189. },
  190. labels: {
  191. style: {
  192. fontSize: 'small',
  193. }
  194. },
  195. },
  196. legend: {
  197. reversed: true,
  198. verticalAlign: "top",
  199. enabled: true //图例开关
  200. },
  201. plotOptions: {
  202. series: {
  203. stacking: 'normal'
  204. },
  205. bar: {
  206. pointPadding: 0,
  207. borderWidth: 0,
  208. //pointWidth: 10,
  209. dataLabels: {
  210. //allowOverlap: true,
  211. //enabled: true
  212. }
  213. }
  214. },
  215. series: worddata.data
  216. });
  217. });
  218. </script>
  219. <?php
  220. include "../pcdl/html_foot.php";
  221. ?>