Browse Source

add forceRerender method

merge-requests/8/head
vargburz 3 years ago
parent
commit
b2d9ad4498
  1. 2
      src/components/grid.ts
  2. 11
      src/index.ts

2
src/components/grid.ts

@ -78,7 +78,7 @@ export class Grid {
.call( .call(
this._d3.axisLeft(this._svgElParams.yScale) this._d3.axisLeft(this._svgElParams.yScale)
.ticks(this.gridOptions.y.ticksCount) .ticks(this.gridOptions.y.ticksCount)
.tickSize(-this._svgElParams) .tickSize(-this._svgElParams.width)
.tickFormat(() => '') .tickFormat(() => '')
); );
} }

11
src/index.ts

@ -194,8 +194,17 @@ abstract class ChartwerkPod<T extends TimeSerie, O extends Options> {
this.updateSeries(series); this.updateSeries(series);
this.updateOptions(options); this.updateOptions(options);
if(shouldRerender) { if(shouldRerender) {
this.render(); this.forceRerender();
}
} }
public forceRerender(): void {
// TODO: it is a hack. It is not nessesary to recreate svg.
// the only purpose for this action, to clear d3.zoom.transform (see https://gitlab.com/chartwerk/core/-/issues/10)
this.createSvg();
this.initPodState();
this.initComponents();
this.render();
} }
protected updateOptions(newOptions: O): void { protected updateOptions(newOptions: O): void {

Loading…
Cancel
Save