statistics.vue 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  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. let 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>