Ring.vue 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. <template>
  2. <div class="container">
  3. <div style="display: inline; float: left; width: 50%; border: #3b4151 solid 1px">
  4. <ve-ring :data="chartData" :extend="chartExtend"></ve-ring>
  5. </div>
  6. </div>
  7. </template>
  8. <script>
  9. export default {
  10. data() {
  11. return {
  12. days: 13,
  13. chartData: {
  14. columns: ['日期', '访问用户'],
  15. rows: [
  16. {'日期': '1/1', '访问用户': 1393},
  17. {'日期': '1/2', '访问用户': 3342},
  18. {'日期': '1/3', '访问用户': 1543},
  19. {'日期': '1/4', '访问用户': 2236}
  20. ]
  21. },
  22. chartExtend:{
  23. color:['#4ad2ff','#ad1453','#333333','#ffffff']
  24. }
  25. }
  26. },
  27. mounted() {
  28. let that = this;
  29. this.timer = setInterval(() => {
  30. that.getDate();
  31. }, 3300);
  32. },
  33. methods: {
  34. getDate() {
  35. let that = this;
  36. let newDate1 = that.getRandomInt(1000, 25000);
  37. let newDate2 = that.getRandomInt(1000, 2500);
  38. let newDate3 = that.getRandomInt(1000, 2500);
  39. let newDate4 = that.getRandomInt(1000, 2500);
  40. this.chartData.rows = [
  41. {'日期': '1/1', '访问用户': newDate1},
  42. {'日期': '1/2', '访问用户': 2000},
  43. {'日期': '1/3', '访问用户': 2000},
  44. {'日期': '1/4', '访问用户': 2000}
  45. ]
  46. },
  47. getRandomInt(min, max) {
  48. return Math.floor(Math.random() * (max - min + 1)) + min;
  49. }
  50. },
  51. }
  52. </script>
  53. <style scoped>
  54. </style>