У меня были некоторые проблемы с реакцией по временной шкале. Мои предметы всегда находятся в неправильном положении, если только они не увеличены. Я читал где-то на git, эта проблема может быть связана с конкретным c выпуском, поэтому я вернулся к 4.19.1. Элементы никогда не будут в правильном положении, если они не увеличены.
export default function ProjTimeline(props){
const [items, setItems] = useState([]);
const [gates, setGates] = useState([]);
const [groups, setGroups] = useState([]);
const options = {
width: '100%',
height: '150px',
stack: true,
autoResize:true,
showMajorLabels: true,
showCurrentTime: true,
zoomMin: 86000*1000,
timeAxis:{scale:"day", step:1}
}
const createGanttItems = () =>{
let items = []
let groups = []
props.project.gates.forEach(gate=>{
groups.push({id:gate["gate"],content:`Gate ${gate["gate"]+1}`});
items.push({
start:gate["planned_start"],
end: gate["planned_end"],
group:gate["gate"],
title: `Gate ${gate["gate"]+1} Planned`,
content: `Gate ${gate["gate"]+1} Planned`,
style:'color:white;background-color:blue',
})
if(gate["real_start"]){
let item = {
start:gate["real_start"],
content: `Gate ${gate["gate"]} Real`,
group: gate["gate"],
title:`Gate ${gate["gate"]} Real`,
style:'color:white;background-color:green',
}
if (gate["real_end"]){
item["end"] = gate["real_end"]
}
items.push(item)
}
})
setItems(items);
setGroups(groups);
}
return (
<Grid container spacing={3}>
<Grid item xs={12}>
<Timeline
options={options}
items={items}
groups={groups}
/>
</Grid>
</Grid>
)
}```
Any hint or idea is greatly appreciated.