column-chart.vue 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. <template>
  2. <view class="chart-container">
  3. <view class="chart-name">
  4. <text class="chart-name-text">近期成绩对比</text>
  5. </view>
  6. <view class="charts-box">
  7. <qiun-data-charts type="column" :chartData="chartData" :loadingType="4" background="none" />
  8. </view>
  9. </view>
  10. </template>
  11. <script>
  12. export default {
  13. name: "column-chart",
  14. data() {
  15. return {
  16. chartData: {
  17. categories: [
  18. "数学",
  19. "语文",
  20. "英语",
  21. "体育",
  22. "科学",
  23. "思品"
  24. ],
  25. series: [{
  26. "name": "最近成绩",
  27. "data": [
  28. 91,
  29. 92,
  30. 94,
  31. 88,
  32. 82,
  33. 89
  34. ]
  35. },
  36. {
  37. "name": "上次成绩",
  38. "data": [
  39. 88,
  40. 84,
  41. 97,
  42. 92,
  43. 89,
  44. 81
  45. ]
  46. }
  47. ],
  48. },
  49. };
  50. }
  51. }
  52. </script>
  53. <style lang="scss">
  54. .chart-container {
  55. margin: 20px 10px;
  56. padding: 5px 5px 5px 2px;
  57. border-radius: 15px;
  58. display: flex;
  59. align-items: center;
  60. justify-content: center;
  61. flex-direction: column;
  62. background-color: #FFFFFF;
  63. box-shadow: 0 2px 4px rgba(0,0,0,0.1);
  64. .chart-name {
  65. width: 100%;
  66. text-align: left;
  67. margin-left: 30px;
  68. margin-top: 8px;
  69. font-weight: bold;
  70. color: #3B4144;
  71. .chart-name-text {
  72. font-size: 13px;
  73. }
  74. }
  75. /* 请根据需求修改图表容器尺寸,如果父容器没有高度图表则会显示异常 */
  76. .charts-box {
  77. width: 100%;
  78. height: 190px;
  79. }
  80. }
  81. </style>