glitch4347
9 months ago
2 changed files with 34 additions and 33 deletions
@ -0,0 +1,33 @@
|
||||
import { LinePod } from '@chartwerk/line-pod'; |
||||
import { VueChartwerkPodMixin } from '@chartwerk/core'; |
||||
|
||||
// it is used with Vue.component, e.g.: Vue.component('chartwerk-line-pod', VueChartwerkLinePod)
|
||||
export const VueChartwerkLinePod = { |
||||
// alternative to `template: '<div class="chartwerk-line-pod" :id="id" />'`
|
||||
render(createElement) { |
||||
return createElement( |
||||
'div', |
||||
{ |
||||
class: { 'chartwerk-line-pod': true }, |
||||
attrs: { id: this.id } |
||||
} |
||||
); |
||||
}, |
||||
mixins: [VueChartwerkPodMixin], |
||||
methods: { |
||||
render() { |
||||
if(this.pod === undefined) { |
||||
this.pod = new LinePod(document.getElementById(this.id), this.series, this.options); |
||||
this.pod.render(); |
||||
} else { |
||||
this.pod.updateData(this.series, this.options); |
||||
} |
||||
}, |
||||
renderSharedCrosshair(values) { |
||||
this.pod.renderSharedCrosshair(values); |
||||
}, |
||||
hideSharedCrosshair() { |
||||
this.pod.hideSharedCrosshair(); |
||||
} |
||||
} |
||||
}; |
Loading…
Reference in new issue