diff --git a/react/ChartwerkLinePod.tsx b/react/ChartwerkLinePod.tsx index b0361f6..0c418b1 100644 --- a/react/ChartwerkLinePod.tsx +++ b/react/ChartwerkLinePod.tsx @@ -47,6 +47,8 @@ export function ChartwerkLinePod(props: ChartwerkLinePodProps) { setPod(newPod); newPod.render(); } else { + pod.updateMarkers(props.markersConf); + pod.updateSegments(props.segments); // TODO: actually it's wrong logic with updates // because it creates new pod anyway pod.updateData(props.series, props.options); diff --git a/src/index.ts b/src/index.ts index 2bd04b5..925b516 100644 --- a/src/index.ts +++ b/src/index.ts @@ -5,6 +5,7 @@ import { Segments } from './components/segments'; import { LineSeries } from './models/line_series'; import { MarkersConf } from './models/marker'; +import { SegmentSerie } from './models/segment'; import * as d3 from 'd3'; import * as _ from 'lodash'; @@ -29,7 +30,7 @@ class LinePod extends ChartwerkPod { _series: LineTimeSerie[] = [], _options: LineOptions = {}, private _markersConf?: MarkersConf, - private _segmentSeries = [], + private _segmentSeries: SegmentSerie[] = [], ) { super(_el, _series, _options); this.series = new LineSeries(_series); @@ -393,6 +394,14 @@ class LinePod extends ChartwerkPod { this.onMouseOver(); } + updateMarkers(markersConf: MarkersConf): void { + this._markersConf = markersConf; + } + + updateSegments(segments: SegmentSerie[]): void { + this._segmentSeries = segments; + } + // methods below rewrite s, (move more methods here) protected zoomOut(): void { if(d3.event.type === 'dblclick' && !this.isDoubleClickActive()) {