diff --git a/src/components/markers.ts b/src/components/markers.ts index ee560da..be4fdf0 100644 --- a/src/components/markers.ts +++ b/src/components/markers.ts @@ -5,17 +5,16 @@ import { LineTimeSerie, LineOptions } from "../types"; import d3 from "d3"; export class Markers { + // TODO: more sentic name private _d3Holder = null; - private _state: PodState = null; - constructor(private _markers: MarkerSerie[]) { + constructor(private _markers: MarkerSerie[], private _state: PodState) { } - render(metricContainer: d3.Selection, state: PodState) { + render(metricContainer: d3.Selection) { if(this._d3Holder !== null) { this._d3Holder.remove(); } - this._state = state; this._d3Holder = metricContainer.append('g').attr('class', 'markers-layer'); for (const ms of this._markers) { this.renderMarkerSerie(ms); @@ -34,7 +33,7 @@ export class Markers { .attr('x1', linePosition) .attr('x2', linePosition) .attr('y1', 0) - // @ts-ignore + // @ts-ignore // TODO: remove ignore but boxParams are protected .attr('y2', this._state.boxParams.height); this._d3Holder.append('circle') .attr('class', 'gap-circle') diff --git a/src/index.ts b/src/index.ts index b18cd39..67db165 100644 --- a/src/index.ts +++ b/src/index.ts @@ -42,8 +42,8 @@ export class LinePod extends ChartwerkPod { for(const serie of this.series.visibleSeries) { this._renderMetric(serie); } - this._markersLayer = new Markers(this._markerSeries); - this._markersLayer.render(this.metricContainer, this.state); + this._markersLayer = new Markers(this._markerSeries, this.state); + this._markersLayer.render(this.metricContainer); } clearAllMetrics(): void {