Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- export default {
- mounted: function() {
- this.$nextTick(function() {
- this.create();
- })
- },
- methods: {
- pie: function(rating) {
- // Does not responds
- console.log(rating);
- let ctx = document.getElementById('history');
- let data = {
- datasets: [{
- data: [rating.length]
- }],
- labels: [
- 'Empty.'
- ]
- };
- let chart = new Chart(ctx, {
- type: 'pie',
- data: data
- });
- },
- create: function() {
- Axios.get('/rating/pastSixMonth')
- .then(function(response) {
- response.data.forEach(function(element) {
- // method call
- this.pie(element.rating);
- })
- })
- .catch(function(error) {
- console.log(error);
- });
- }
- }
- }
Add Comment
Please, Sign In to add comment