littlefatsheep

代码如下:

GanttChart <- function(program,startdate,enddate,title = NA)
{
  startdate <- as.Date(startdate)
  enddate <- as.Date(enddate)
  if(sum(startdate > enddate) > 0)
  {
    stop(\'error:start date is later than end date.\')
  }
  progrm <- length(program):1
  plot(NA,NA,
       xlim = c(min(startdate),max(enddate)),
       ylim = range(progrm),
       xlab = \'日期\',
       ylab = \'项目\',
       xaxt = \'n\',
       yaxt = \'n\',
       main = title)
  startUnionEnd <- as.Date(origin = \'1970-01-01\',union(startdate,enddate))
  axis(1,startUnionEnd,startUnionEnd)
  axis(2,progrm,program)
  segments(startdate,progrm,enddate,progrm,lwd = 5)
  abline(v = startUnionEnd)
}
program <- c(\'P1\',\'P2\',\'P3\',\'P4\')
startdate <- seq(from = as.Date(\'1994-09-02\'),by = 5,length.out = 4)
enddate <- seq(from = as.Date(\'1994-10-21\'),by = 5,length.out = 4)
GanttChart(program,startdate,enddate,\'GANTT CHART\')

  

分类:

技术点:

相关文章:

  • 2021-07-09
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-10-18
  • 2021-08-03
  • 2021-05-11
猜你喜欢
  • 2022-12-23
  • 2021-11-23
  • 2022-12-23
  • 2021-08-07
  • 2021-07-02
  • 2021-11-08
相关资源
相似解决方案