line-mini-chart.vue 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119
  1. <template>
  2. <view class="chart-container">
  3. <view class="chart-name">
  4. <view class="t-icon t-icon-xtubiao-4"></view>
  5. <text class="chart-name-text">走势对比</text>
  6. </view>
  7. <view class="charts-box">
  8. <qiun-data-charts
  9. type="mini-line"
  10. :chartData="chartData"
  11. :loadingType="4"
  12. background="none"
  13. :tapLegend="false"
  14. :canvas2d='true' canvasId='canvans3'
  15. />
  16. </view>
  17. </view>
  18. </template>
  19. <script>
  20. export default {
  21. name:"line-mini-chart",
  22. props:{},
  23. data() {
  24. return {
  25. chartData: {},
  26. queryObj: {}
  27. };
  28. },
  29. methods:{
  30. getChartData(){
  31. this.chartData = {
  32. categories: [
  33. "测验1",
  34. "测验2",
  35. "测验3",
  36. "测验4",
  37. "测验5",
  38. ],
  39. series: [{
  40. "name": "孩子总分",
  41. "data": [
  42. 400,
  43. 390,
  44. 380,
  45. 399,
  46. 366,
  47. ]
  48. },
  49. {
  50. "name": "班级平均分",
  51. "data": [
  52. 360,
  53. 377,
  54. 355,
  55. 322,
  56. 338,
  57. ]
  58. },
  59. {
  60. "name": "年级平均分",
  61. "data": [
  62. 333,
  63. 346,
  64. 364,
  65. 347,
  66. 355,
  67. ]
  68. }
  69. ],
  70. }
  71. }
  72. },
  73. //创建组件生命周期函数
  74. created(){
  75. this.getChartData()
  76. }
  77. }
  78. </script>
  79. <style lang="scss">
  80. .chart-container {
  81. border-radius: 20rpx;
  82. display: flex;
  83. align-items: center;
  84. justify-content: center;
  85. flex-direction: column;
  86. background-color: #FFFFFF;
  87. box-shadow: 0 4rpx 8rpx rgba(0,0,0,0.05);
  88. width: 340rpx;
  89. .chart-name {
  90. display: flex;
  91. align-items: center;
  92. justify-content: flex-start;
  93. width: 100%;
  94. margin: 20rpx 0 20rpx 40rpx;
  95. .chart-name-text {
  96. margin-left: 20rpx;
  97. font-size: 30rpx;
  98. font-weight: bold;
  99. color: #3B4144;
  100. }
  101. }
  102. .charts-box{
  103. margin-top: 40rpx;
  104. width: 100%;
  105. height:200rpx;
  106. }
  107. }
  108. .t-icon{
  109. width: 40rpx;
  110. height: 40rpx;
  111. }
  112. </style>