diff --git a/src/VueChartwerkPodMixin.ts b/src/VueChartwerkPodMixin.ts index 4b75868..322a883 100644 --- a/src/VueChartwerkPodMixin.ts +++ b/src/VueChartwerkPodMixin.ts @@ -78,6 +78,9 @@ export default { if(has(this.$listeners, 'sharedCrosshairMove')) { this.options.eventsCallbacks.sharedCrosshairMove = this.sharedCrosshairMove.bind(this); } + if(has(this.$listeners, 'renderStart')) { + this.options.eventsCallbacks.renderStart = this.renderStart.bind(this); + } if(has(this.$listeners, 'renderEnd')) { this.options.eventsCallbacks.renderEnd = this.renderEnd.bind(this); } @@ -109,6 +112,9 @@ export default { sharedCrosshairMove(event) { this.$emit('sharedCrosshairMove', event); }, + renderStart() { + this.$emit('renderStart'); + }, renderEnd() { this.$emit('renderEnd'); }, diff --git a/src/index.ts b/src/index.ts index fb54ef1..4c7a197 100644 --- a/src/index.ts +++ b/src/index.ts @@ -178,6 +178,10 @@ abstract class ChartwerkPod { } public render(): void { + if(has(this.options.eventsCallbacks, 'renderStart')) { + this.options.eventsCallbacks.renderStart(); + } + this.renderClipPath(); this.addEvents(); @@ -256,7 +260,7 @@ abstract class ChartwerkPod { xScale: this.state.xScale, yScale: this.state.yScale, } - + this.grid = new Grid(this.d3, this.chartContainer, svgElParams, this.options.grid); } @@ -973,7 +977,7 @@ abstract class ChartwerkPod { console.warn(`Value formatter for axis is not defined. Path options.axis.{?}.valueFormatter`); return (d) => d; } - return (d, i) => { + return (d, i) => { if(axisOptions.colorFormatter !== undefined) { this.yAxisTicksColors.push(axisOptions.colorFormatter(d, i)) } diff --git a/src/types.ts b/src/types.ts index 17ec8a6..642698e 100644 --- a/src/types.ts +++ b/src/types.ts @@ -25,6 +25,7 @@ export type Options = { onLegendLabelClick?: (idx: number) => void, contextMenu?: (evt: any) => void, // the same name as in d3.events sharedCrosshairMove?: (event: any) => void, + renderStart?: () => void, renderEnd?: () => void, }; axis?: { @@ -183,4 +184,4 @@ export type SvgElParams = { width: number, xScale: d3.ScaleLinear, yScale: d3.ScaleLinear, -} \ No newline at end of file +}