line-chart.vue 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  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="line" :chartData="chartData" :loadingType="4"/>
  8. </view>
  9. </view>
  10. </template>
  11. <script>
  12. export default {
  13. name: "line-chart",
  14. data() {
  15. return {
  16. chartData: {
  17. categories: [
  18. "测验1",
  19. "测验2",
  20. "测验3",
  21. "测验4",
  22. "测验5",
  23. ],
  24. series: [{
  25. "name": "孩子总分",
  26. "data": [
  27. 400,
  28. 390,
  29. 380,
  30. 399,
  31. 366,
  32. ]
  33. },
  34. {
  35. "name": "班级平均分",
  36. "data": [
  37. 360,
  38. 377,
  39. 355,
  40. 322,
  41. 338,
  42. ]
  43. },
  44. {
  45. "name": "年级平均分",
  46. "data": [
  47. 333,
  48. 346,
  49. 364,
  50. 347,
  51. 355,
  52. ]
  53. }
  54. ],
  55. },
  56. };
  57. }
  58. }
  59. </script>
  60. <style lang="scss">
  61. .chart-container {
  62. margin: 10px;
  63. padding: 5px 5px 5px 2px;
  64. border-radius: 10px;
  65. display: flex;
  66. align-items: center;
  67. justify-content: center;
  68. flex-direction: column;
  69. background-color: #FFFFFF;
  70. box-shadow: 3px 3px 5px 1px rgba(0, 0, 0, 0.05);
  71. .chart-name {
  72. width: 100%;
  73. text-align: left;
  74. margin-left: 18px;
  75. margin-top: 8px;
  76. .chart-name-text {
  77. font-size: 13px;
  78. }
  79. }
  80. /* 请根据需求修改图表容器尺寸,如果父容器没有高度图表则会显示异常 */
  81. .charts-box {
  82. width: 100%;
  83. height: 190px;
  84. }
  85. }
  86. </style>