Browse Source

markers conf in react

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

Loading…
Cancel
Save