-
Notifications
You must be signed in to change notification settings - Fork 125
Open
Description
Hi,
I made timeline chart for inpatient medicine.
chart data is loaded by sql server (node js)
sometimes rendering is well, but sometimes cause error when render chart.
how could I fix this problem?
this is my source
import { useState, useLayoutEffect } from 'react';
import fromKapsule from 'react-kapsule';
import moment from 'moment';
import TimelinesChart from 'timelines-chart';
const TimelinesChartComp = fromKapsule(TimelinesChart);
const useWindowSize = () => {
const [size, setSize] = useState([0, 0]);
useLayoutEffect(() => {
function updateSize() {
setSize([window.innerWidth, window.innerHeight]);
}
window.addEventListener('resize', updateSize);
updateSize();
return () => window.removeEventListener('resize', updateSize);
}, []);
return size;
};
export default function Timelines({ data }) {
const [width, height] = useWindowSize();
function xTickFnc(val) {
return moment(val).format('YY.MM.DD A');
}
return (
<>
<div id='chart'>
<div className='App'>
<TimelinesChartComp
zQualitative={true}
width={width - 100}
leftMargin={300}
maxHeight={1000}
maxLineHeight={40}
xTickFormat={xTickFnc}
data={data}
/>
</div>
</div>
</>
);
}
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels

