NewUsersChart.vue 606 B

123456789101112131415161718192021222324252627282930313233343536
  1. <template>
  2. <line-chart
  3. background='#84dec0'
  4. point='#1da8ce'
  5. tooltip='new user'
  6. :points='points'
  7. ></line-chart>
  8. </template>
  9. <script>
  10. import LineChart from './LineChart'
  11. import AjaxErrorHandler from '../../assets/js/errorHandler'
  12. export default {
  13. name: 'NewUsersChart',
  14. components: { LineChart },
  15. data () {
  16. return {
  17. points: []
  18. }
  19. },
  20. mounted () {
  21. this.axios
  22. .get('/api/v1/log/new-users')
  23. .then(res => {
  24. this.points = res.data.map(d => {
  25. d.date = new Date(d.date)
  26. return d
  27. })
  28. })
  29. .catch(AjaxErrorHandler(this.$store))
  30. }
  31. }
  32. </script>