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(
this._d3.axisLeft(this._svgElParams.yScale)
.ticks(this.gridOptions.y.ticksCount)
.tickSize(-this._svgElParams)
.tickSize(-this._svgElParams.width)
.tickFormat(() => '')
);
}

11
src/index.ts

@ -194,10 +194,19 @@ abstract class ChartwerkPod<T extends TimeSerie, O extends Options> {
this.updateSeries(series);
this.updateOptions(options);
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 {
if(newOptions === undefined) {
return;

Loading…
Cancel
Save