diff --git a/src/index.ts b/src/index.ts index 925b516..3a30753 100644 --- a/src/index.ts +++ b/src/index.ts @@ -1,4 +1,4 @@ -import { ChartwerkPod, VueChartwerkPodMixin, TimeFormat, CrosshairOrientation, BrushOrientation, yAxisOrientation } from '@chartwerk/core'; +import { ChartwerkPod, TimeFormat, CrosshairOrientation, BrushOrientation, yAxisOrientation } from '@chartwerk/core'; import { LineTimeSerie, LineOptions, MouseObj } from './types'; import { Markers } from './components/markers'; import { Segments } from './components/segments'; @@ -447,36 +447,4 @@ class LinePod extends ChartwerkPod { } } -// TODO: it should be moved to VUE folder -// it is used with Vue.component, e.g.: Vue.component('chartwerk-line-pod', VueChartwerkLinePod) -export const VueChartwerkLinePod = { - // alternative to `template: '
'` - 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(); - } - } -}; - export { LineTimeSerie, LineOptions, TimeFormat, LinePod }; diff --git a/vue/VueChartwerkLinePod.ts b/vue/VueChartwerkLinePod.ts new file mode 100644 index 0000000..25f2e9a --- /dev/null +++ b/vue/VueChartwerkLinePod.ts @@ -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: '
'` + 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(); + } + } +};