fix(gantt): improve task bar text (#1696)
* fix: progress value is too large, resulting in incorrect calculation of bar width * style: style improve * style: style improve
This commit is contained in:
		
							parent
							
								
									74e2811255
								
							
						
					
					
						commit
						d0171b179f
					
				@ -13,6 +13,7 @@ const formatData = (
 | 
			
		||||
  hideChildren: boolean = false,
 | 
			
		||||
) => {
 | 
			
		||||
  data.forEach((item: any) => {
 | 
			
		||||
    const percent=item[fieldNames.progress] * 100;
 | 
			
		||||
    if (item.children && item.children.length) {
 | 
			
		||||
      tasks.push({
 | 
			
		||||
        start: new Date(item[fieldNames.start]),
 | 
			
		||||
@ -20,7 +21,7 @@ const formatData = (
 | 
			
		||||
        name: item[fieldNames.title],
 | 
			
		||||
        id: item.id + '',
 | 
			
		||||
        type: 'project',
 | 
			
		||||
        progress: item[fieldNames.progress] * 100 || 0,
 | 
			
		||||
        progress: percent>100?100:percent || 0,
 | 
			
		||||
        hideChildren: hideChildren,
 | 
			
		||||
        project: projectId,
 | 
			
		||||
        color: item.color,
 | 
			
		||||
@ -33,7 +34,7 @@ const formatData = (
 | 
			
		||||
        name: item[fieldNames.title],
 | 
			
		||||
        id: item.id + '',
 | 
			
		||||
        type: fieldNames.end ? 'task' : 'milestone',
 | 
			
		||||
        progress: item[fieldNames.progress] * 100 || 0,
 | 
			
		||||
        progress: percent>100?100:percent || 0,
 | 
			
		||||
        project: projectId,
 | 
			
		||||
        color: item.color,
 | 
			
		||||
      });
 | 
			
		||||
 | 
			
		||||
@ -39,7 +39,7 @@ export const TaskGantt: React.FC<TaskGanttProps> = forwardRef(
 | 
			
		||||
          width={gridProps.svgWidth}
 | 
			
		||||
          height={calendarProps.headerHeight}
 | 
			
		||||
          fontFamily={barProps.fontFamily}
 | 
			
		||||
          style={{ borderBottom: '1px solid #f0f0f0',fontWeight:700 }}
 | 
			
		||||
          style={{ borderBottom: '1px solid #f0f0f0', fontWeight: 700 }}
 | 
			
		||||
        >
 | 
			
		||||
          <Calendar {...calendarProps} />
 | 
			
		||||
        </svg>
 | 
			
		||||
 | 
			
		||||
@ -98,7 +98,7 @@ export const TaskItem: React.FC<TaskItemProps> = (props) => {
 | 
			
		||||
      {taskItem}
 | 
			
		||||
      <text
 | 
			
		||||
        x={isProjectBar ? task.x1 : getX()}
 | 
			
		||||
        y={isProjectBar ? task.y - 8 : task.y + taskHeight * 0.5}
 | 
			
		||||
        y={isProjectBar ? task.y - 8 : isTextInside ? task.y + taskHeight * 0.5 : task.y + taskHeight * 0.65}
 | 
			
		||||
        className={isProjectBar ? cx(projectLabel) : isTextInside ? cx(barLabel) : cx(barLabel) && cx(barLabelOutside)}
 | 
			
		||||
        ref={textRef}
 | 
			
		||||
      >
 | 
			
		||||
 | 
			
		||||
		Loading…
	
		Reference in New Issue
	
	Block a user