Index.cshtml 9.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279
  1. 
  2. @{
  3. Layout = "~/Views/Shared/Layout/_Layout.Play.cshtml";
  4. ViewBag.PageId = "home";
  5. ViewBag.Title = "主页";
  6. }
  7. <style>
  8. .main-box {
  9. width: 100%;
  10. height: calc(100vh - 30px);
  11. display: flex;
  12. flex-direction: column;
  13. }
  14. .h-box {
  15. width: 100%;
  16. height: 50%;
  17. display: flex;
  18. }
  19. .s-box {
  20. width: 50%;
  21. height: 100%;
  22. display: flex;
  23. }
  24. .chart-box {
  25. width: 100%;
  26. height: 100%;
  27. }
  28. </style>
  29. <div class="main-box">
  30. <div class="h-box">
  31. <div class="s-box">
  32. <div class="chart-box" id="container-1"></div>
  33. </div>
  34. <div class="s-box">
  35. <div class="chart-box" id="container-2"></div>
  36. </div>
  37. </div>
  38. <div class="h-box">
  39. <div class="chart-box" id="container-3"></div>
  40. </div>
  41. </div>
  42. @section scripts
  43. {
  44. @*<script type="text/javascript" src="https://code.highcharts.com.cn/highcharts/highcharts.js"></script>
  45. <script type="text/javascript" src="https://code.highcharts.com.cn/highcharts/highcharts-3d.js"></script>
  46. <script type="text/javascript" src="https://code.highcharts.com.cn/highcharts/modules/oldie.js"></script>
  47. <script type="text/javascript" src="https://code.highcharts.com.cn/highcharts/modules/cylinder.js"></script>
  48. <script type="text/javascript" src="https://code.highcharts.com.cn/highcharts/modules/funnel3d.js"></script>
  49. <script type="text/javascript" src="https://code.highcharts.com.cn/highstock/modules/pyramid3d.js"></script>*@
  50. <script type="text/javascript" src="/Content/Libs/highcharts/highcharts.min.js"></script>
  51. <script type="text/javascript" src="/Content/Libs/highcharts/highcharts-3d.min.js"></script>
  52. <script type="text/javascript" src="/Content/Libs/highcharts/modules/oldie.min.js"></script>
  53. <script type="text/javascript" src="/Content/Libs/highcharts/modules/cylinder.min.js"></script>
  54. <script type="text/javascript" src="/Content/Libs/highcharts/modules/funnel3d.min.js"></script>
  55. <script type="text/javascript" src="/Content/Libs/highcharts/modules/pyramid3d.min.js"></script>
  56. <script>
  57. var mainColor = '#02595a';
  58. $(function () {
  59. Chart1();
  60. Chart2();
  61. Chart3();
  62. });
  63. function Chart1() {
  64. window.Highcharts.chart('container-1', {
  65. chart: {
  66. type: 'pie',
  67. backgroundColor: 'transparent',
  68. options3d: {
  69. enabled: true,
  70. alpha: 45,
  71. beta: 0
  72. }
  73. },
  74. colors: ['#058DC7', '#50B432', '#ED561B', '#DDDF00',
  75. '#24CBE5', '#64E572', '#FF9655', '#FFF263', '#6AF9C4'],
  76. exporting: {
  77. enabled: false
  78. },
  79. title: {
  80. text: '最近一个月四功能力评析图',
  81. style: {
  82. 'color': mainColor,
  83. 'fontWeight': '600',
  84. 'fontFamily': 'sans-serif'
  85. }
  86. },
  87. tooltip: {
  88. pointFormat: '{series.name}: <b>{point.percentage:.1f}%</b>'
  89. },
  90. legend: {
  91. enabled: false
  92. },
  93. credits: {
  94. enabled: false
  95. },
  96. plotOptions: {
  97. pie: {
  98. allowPointSelect: true,
  99. cursor: 'pointer',
  100. depth: 35,
  101. dataLabels: {
  102. enabled: true,
  103. format: '{point.name}'
  104. }
  105. }
  106. },
  107. series: [{
  108. type: 'pie',
  109. name: '四功占比',
  110. data: [
  111. //{
  112. // name: '对上级',
  113. // color:'#123456',
  114. // y: 18.3,
  115. //},
  116. ['对上级', 18.3],
  117. ['对下级', 22.8],
  118. ['对相关单位', 15.7],
  119. ['对媒体', 31.2]
  120. ]
  121. }]
  122. });
  123. }
  124. function Chart2() {
  125. window.Highcharts.chart('container-2', {
  126. chart: {
  127. type: 'pyramid3d',
  128. backgroundColor: 'transparent',
  129. options3d: {
  130. enabled: true,
  131. alpha: 10,
  132. depth: 50,
  133. viewDistance: 50
  134. }
  135. },
  136. colors: ['#058DC7', '#50B432', '#ED561B', '#DDDF00',
  137. '#24CBE5', '#64E572', '#FF9655', '#FFF263', '#6AF9C4'],
  138. exporting: {
  139. enabled: false
  140. },
  141. legend: {
  142. enabled: false
  143. },
  144. credits: {
  145. enabled: false
  146. },
  147. title: {
  148. text: '最近一个月五力能力评析图',
  149. style: {
  150. 'color': mainColor,
  151. 'fontWeight': '600',
  152. 'fontFamily': 'sans-serif'
  153. }
  154. },
  155. plotOptions: {
  156. series: {
  157. dataLabels: {
  158. enabled: true,
  159. format: '<b>{point.name}</b> ({point.y:,.0f})',
  160. color: mainColor,
  161. allowOverlap: true,
  162. y: 10
  163. },
  164. width: '60%',
  165. height: '60%',
  166. center: ['50%', '50%']
  167. }
  168. },
  169. series: [{
  170. name: '五力占比',
  171. data: [
  172. ['掌控力', 654],
  173. ['决策力', 331],
  174. ['协调力', 455],
  175. ['研判力', 524],
  176. ['舆论引导力', 367]
  177. ]
  178. }]
  179. });
  180. }
  181. function Chart3() {
  182. var categories = [];
  183. var month = new Date().getMonth();
  184. for (var i = 0; i < 12; i++) {
  185. month++;
  186. if (month > 12) {
  187. month = 1;
  188. }
  189. categories.push(month + "月");
  190. }
  191. window.Highcharts.chart('container-3', {
  192. chart: {
  193. type: 'bar',
  194. backgroundColor: 'transparent',
  195. },
  196. colors: ['#058DC7', '#50B432', '#ED561B', '#DDDF00',
  197. '#24CBE5', '#64E572', '#FF9655', '#FFF263', '#6AF9C4'],
  198. exporting: {
  199. enabled: false
  200. },
  201. legend: {
  202. enabled: false
  203. },
  204. credits: {
  205. enabled: false
  206. },
  207. title: {
  208. text: '近两年课程学习时长统计',
  209. style: {
  210. 'color': mainColor,
  211. 'fontWeight': '600',
  212. 'fontFamily': 'sans-serif'
  213. }
  214. },
  215. xAxis: [{
  216. categories: categories,
  217. reversed: true,
  218. labels: {
  219. step: 1
  220. }
  221. }, {
  222. // 显示在右侧的镜像 xAxis (通过 linkedTo 与第一个 xAxis 关联)
  223. opposite: true,
  224. reversed: true,
  225. categories: categories,
  226. linkedTo: 0,
  227. labels: {
  228. step: 1
  229. }
  230. }],
  231. yAxis: {
  232. title: {
  233. text: null
  234. },
  235. labels: {
  236. formatter: function () {
  237. return Math.abs(this.value) + '分钟';
  238. }
  239. },
  240. min: -500,
  241. max: 500
  242. },
  243. plotOptions: {
  244. series: {
  245. stacking: 'normal'
  246. }
  247. },
  248. tooltip: {
  249. formatter: function () {
  250. return '<b>' +
  251. this.series.name +
  252. '-' +
  253. this.point.category +
  254. '</b><br/>' +
  255. ' ' +
  256. window.Highcharts.numberFormat(Math.abs(this.point.y), 0) +
  257. " 分钟";
  258. }
  259. },
  260. series: [{
  261. name: '2020演练时长',
  262. data: [-174, -188, -208, -242, -321, -271, -249,
  263. -197, -353, -361, -362, -272]
  264. }, {
  265. name: '2019演练时长',
  266. data: [162, 175, 139, 210, 240, 223, 323, 265,
  267. 233, 194, 310, 257]
  268. }]
  269. });
  270. }
  271. </script>
  272. }