statistics.vue 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. <template>
  2. <div class="main-card__body" v-loading="pageLoading">
  3. <h1 class="main-card__title">
  4. 学习数据
  5. </h1>
  6. <div class="main-card__chart" id="scoreChart"></div>
  7. </div>
  8. </template>
  9. <script>
  10. export default {
  11. name: 'statistics',
  12. layout: 'person',
  13. data () {
  14. return {
  15. pageLoading: false,
  16. scores: [84, 76, 82, 90, 85]
  17. }
  18. },
  19. mounted () {
  20. this.initEcharts()
  21. },
  22. methods: {
  23. initEcharts () {
  24. const scoreChart = this.$echarts.init(document.getElementById('scoreChart'), 'light')
  25. scoreChart.setOption({
  26. title: { text: '最近五次测验得分情况', left: 'center' },
  27. tooltip: {
  28. trigger: 'item'
  29. },
  30. xAxis: {
  31. type: 'category',
  32. data: ['第一次', '第二次', '第三次', '第四次', '第五次'],
  33. boundaryGap: false
  34. },
  35. yAxis: {
  36. type: 'value',
  37. name: '得分'
  38. },
  39. series: [{
  40. data: this.scores,
  41. type: 'line'
  42. // areaStyle: {}
  43. }]
  44. })
  45. }
  46. }
  47. }
  48. </script>
  49. <style lang="scss" scoped>
  50. @import '~/assets/css/person.scss';
  51. </style>