|
|
@ -39,19 +39,14 @@ export function ChartwerkLinePod(props: ChartwerkLinePodProps) { |
|
|
|
useEffect(() => { |
|
|
|
useEffect(() => { |
|
|
|
// this function will be called on component unmount
|
|
|
|
// this function will be called on component unmount
|
|
|
|
return () => { |
|
|
|
return () => { |
|
|
|
if(pod === null) { |
|
|
|
if(pod === null) { return; } |
|
|
|
return; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
// @ts-ignore
|
|
|
|
// @ts-ignore
|
|
|
|
pod.removeEventListeners(); |
|
|
|
pod.removeEventListeners(); |
|
|
|
} |
|
|
|
} |
|
|
|
}, []); |
|
|
|
}, []); |
|
|
|
|
|
|
|
|
|
|
|
useEffect(() => { |
|
|
|
useEffect(() => { |
|
|
|
if(chart === null) { |
|
|
|
if(chart === null) { return; } |
|
|
|
return; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if(pod === null) { |
|
|
|
if(pod === null) { |
|
|
|
console.log('create chart'); |
|
|
|
console.log('create chart'); |
|
|
|
console.log("markers"); |
|
|
|
console.log("markers"); |
|
|
@ -63,11 +58,12 @@ export function ChartwerkLinePod(props: ChartwerkLinePodProps) { |
|
|
|
props.series, |
|
|
|
props.series, |
|
|
|
props.options, |
|
|
|
props.options, |
|
|
|
props.markers, |
|
|
|
props.markers, |
|
|
|
props.segments |
|
|
|
// props.segments
|
|
|
|
); |
|
|
|
); |
|
|
|
setPod(newPod); |
|
|
|
setPod(newPod); |
|
|
|
newPod.render(); |
|
|
|
newPod.render(); |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
|
|
|
|
console.log('update data'); |
|
|
|
pod.updateData(props.series, { |
|
|
|
pod.updateData(props.series, { |
|
|
|
...props.options, |
|
|
|
...props.options, |
|
|
|
}); |
|
|
|
}); |
|
|
|