Skip to content

Commit 40f4f5a

Browse files
committed
Added debug
1 parent 41afa08 commit 40f4f5a

File tree

1 file changed

+29
-4
lines changed

1 file changed

+29
-4
lines changed

src/Vue2LeafletHeightGraph.vue

Lines changed: 29 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,16 @@
3535
options: {
3636
type: Object,
3737
default: () => {}
38+
},
39+
debug: {
40+
type: Boolean,
41+
default: false
3842
}
3943
},
4044
mounted() {
45+
if(this.debug) {
46+
console.log('mounted')
47+
}
4148
this.$nextTick(() => {
4249
this.hg = L.control.heightgraph({...this.options,...{
4350
// merges quick settings with options if they are defined
@@ -48,24 +55,42 @@
4855
})
4956
},
5057
beforeDestroy() {
58+
if(this.debug) {
59+
console.log('beforeDestroy')
60+
}
5161
if(this.hg) {
5262
this.hg.remove()
5363
}
5464
},
5565
methods: {
5666
updateGraph() {
67+
if(this.debug) {
68+
console.log('updateGraph')
69+
}
5770
if(this.hg) {
5871
this.hg.remove()
5972
}
6073
const map = this.$parent.mapObject
61-
this.hg.addTo(map)
62-
let p = Object.keys(this.availableParsers).includes(this.parser) ? this.parser : 'normal'
63-
let dataCollections = this.availableParsers[p](this.data)
64-
this.hg.addData(dataCollections)
74+
let dataCollections = null;
75+
try {
76+
this.hg.addTo(map)
77+
let p = Object.keys(this.availableParsers).includes(this.parser) ? this.parser : 'normal'
78+
79+
dataCollections = this.availableParsers[p](this.data)
80+
this.hg.addData(dataCollections)
81+
} catch(err) {
82+
console.log('Error in updateGraph: ')
83+
console.log(err)
84+
console.log('data', this.data)
85+
console.log('dataCollections', dataCollections)
86+
}
6587
}
6688
},
6789
watch: {
6890
data: function () {
91+
if(this.debug) {
92+
console.log('watch.data')
93+
}
6994
if(!this.data && this.hg) {
7095
this.hg.remove()
7196
} else {

0 commit comments

Comments
 (0)