column-chart.vue 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  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: 10px;
  56. padding: 5px 5px 5px 2px;
  57. border-radius: 10px;
  58. display: flex;
  59. align-items: center;
  60. justify-content: center;
  61. flex-direction: column;
  62. background-color: #FFFFFF;
  63. box-shadow: 3px 3px 5px 1px rgba(0, 0, 0, 0.05);
  64. .chart-name {
  65. width: 100%;
  66. text-align: left;
  67. margin-left: 18px;
  68. margin-top: 8px;
  69. .chart-name-text {
  70. font-size: 13px;
  71. }
  72. }
  73. /* 请根据需求修改图表容器尺寸,如果父容器没有高度图表则会显示异常 */
  74. .charts-box {
  75. width: 100%;
  76. height: 190px;
  77. }
  78. }
  79. </style>