Browse Source

markers conf in react

marker-callback-#25
glitch4347 1 year ago
parent
commit
26d5956c17
  1. 8
      react/ChartwerkLinePod.tsx

8
react/ChartwerkLinePod.tsx

@ -1,7 +1,7 @@
import { LineTimeSerie, LineOptions, LinePod } from '@chartwerk/line-pod';
import { AxisRange } from '@chartwerk/core/dist/types';
import { MarkerSerie } from '@chartwerk/line-pod/dist/models/marker';
import { MarkersConf } from '@chartwerk/line-pod/dist/models/marker';
import { SegmentSerie } from '@chartwerk/line-pod/dist/models/segment';
import { useEffect, useRef, useState } from 'react';
@ -13,7 +13,7 @@ export type ChartwerkLinePodProps = {
id?: string;
series: LineTimeSerie[];
options?: LineOptions;
markers?: MarkerSerie[],
markersConf?: MarkersConf,
segments?: SegmentSerie[],
className?: string;
// TODO: callback types should be exported from chartwerk
@ -91,7 +91,7 @@ export function ChartwerkLinePod(props: ChartwerkLinePodProps) {
...props.options,
eventsCallbacks
},
props.markers,
props.markersConf,
props.segments
);
setPod(newPod);
@ -99,7 +99,7 @@ export function ChartwerkLinePod(props: ChartwerkLinePodProps) {
} else {
pod.updateData(props.series, props.options);
}
}, [chart, pod, props.id, props.options, props.markers, props.segments]);
}, [chart, pod, props.id, props.options, props.markersConf, props.segments]);
// TODO: it's a hack to render the LinePod right after the div appears in DOM
setTimeout(() => {

Loading…
Cancel
Save