gantt-task-react icon indicating copy to clipboard operation
gantt-task-react copied to clipboard

How to disable the Name, To, From, & percent fields from the display?

Open darewreck54 opened this issue 2 years ago • 3 comments

Is it possible to disable

  • the Name, To, From section and only display the gantt chart?
  • The percent field It wasn't clear from the Readme and display options if this was possible?
image

Thanks, Derek

darewreck54 avatar Aug 28 '22 18:08 darewreck54

Looks like i can hide the Name, From, To with

   listCellWidth=''

But still trying to figuring the percent

darewreck54 avatar Aug 28 '22 19:08 darewreck54

https://github.com/MaTeMaTuK/gantt-task-react/blob/main/src/components/other/tooltip.tsx#L140-L143 looks like if you set task.progress to be undefined it should work.

However, the typescript is not optional

image

darewreck54 avatar Aug 28 '22 20:08 darewreck54

I can override it with, but be nice if i can just pass in a undefined for progress but not sure if there is other code that depend on it like the coloring.

  task: Task;
  fontSize: string;
  fontFamily: string;
}> = ({ task, fontSize, fontFamily }) => {
  const style = {
    fontSize,
    fontFamily,
  };
  return (
    <div className={css({
      background: "#fff",
      padding: 12,
      boxShadow: "0 3px 6px rgba(0, 0, 0, 0.16), 0 3px 6px rgba(0, 0, 0, 0.23)"
    })} style={style}>
      <b style={{ fontSize: fontSize + 6 }}>{`${
        task.name
      }: ${task.start.getDate()}-${
        task.start.getMonth() + 1
      }-${task.start.getFullYear()} - ${task.end.getDate()}-${
        task.end.getMonth() + 1
      }-${task.end.getFullYear()}`}</b>
      {task.end.getTime() - task.start.getTime() !== 0 && (
        <p className={css({
          fontSize: 12,
          marginBottom: 6,
          color: "#666"
        })}>{`Duration: ${~~(
          (task.end.getTime() - task.start.getTime()) /
          (1000 * 60 * 60 * 24)
        )} day(s)`}</p>
      )}
    </div>
  );
}

darewreck54 avatar Aug 28 '22 20:08 darewreck54