user.html 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. {extend name="common/common2" /}
  2. {block name="main"}
  3. <div class="ibox-content">
  4. <div class="ibox">
  5. <style>
  6. .order-data {
  7. display: flex;
  8. justify-content: center;
  9. align-items: center;
  10. }
  11. .order-data-content {
  12. flex: 0.1;
  13. }
  14. .order-data-title, .order-data-num {
  15. font-size: 24px;
  16. text-align: center;
  17. }
  18. .order-data-num {
  19. display: block;
  20. color: #d43030;
  21. }
  22. .order-chart {
  23. height: 500px;
  24. }
  25. </style>
  26. <div class="panel-group">
  27. <div class="panel panel-default">
  28. <div class="panel-body">
  29. <div class="order-data">
  30. <div class="order-data-content">
  31. <p class="order-data-title">用户总数</p>
  32. <span class="order-data-num">{$allCount}</span>
  33. </div>
  34. {foreach $list as $k=>$v}
  35. <div class="order-data-content">
  36. <p class="order-data-title">{$v['name']}</p>
  37. <span class="order-data-num">{$v['value']}</span>
  38. </div>
  39. {/foreach}
  40. </div>
  41. <div class="order-chart">
  42. <div id="mountNode"></div>
  43. </div>
  44. </div>
  45. </div>
  46. </div>
  47. </div>
  48. </div>
  49. {/block}
  50. {block name="script"}
  51. <script src="/static/antv/g2.min.js"></script>
  52. <script src="/static/antv/data-set.min.js"></script>
  53. <script>
  54. var data = {:json_encode($list)};
  55. var chart = new G2.Chart({
  56. container: 'mountNode',
  57. forceFit: true,
  58. });
  59. chart.source(data);
  60. chart.legend({
  61. position: 'bottom', // 设置图例的显示位置
  62. itemGap: 20 // 图例项之间的间距
  63. });
  64. chart.coord('theta', {
  65. radius: 0.75,
  66. innerRadius: 0.6
  67. });
  68. // 辅助文本
  69. chart.guide().html({
  70. position: ['50%', '50%'],
  71. html: '<div style="color:#8c8c8c;font-size: 24px;text-align: center;width: 10em;">{$allCount}<br><span style="color:#8c8c8c;font-size:14px">用户总数</span></div>',
  72. alignX: 'middle',
  73. alignY: 'middle'
  74. });
  75. chart.tooltip({
  76. showTitle: false
  77. });
  78. chart.intervalStack().position('value').color('name').shape('sliceShape');
  79. chart.render();
  80. </script>
  81. {/block}