我是R的新手,想创建一个甘特图式的图表,我可以看到一周内SQL Server上的作业运行了多长时间。 因此,我的y轴将填充作业名称,我的x轴具有(进出可缩放)刻度,包括工作日,小时,分钟和秒。
我的数据集仍然可以配置。我可以将开始和结束时间转换为每种格式,因为我将它们作为DateTimes。
这就是数据的样子:
structure(list(JobName = structure(c(1L, 1L, 1L, 2L, 2L), .Label = c("ATLAS_Admin_DeployClientDatabase", "ATLAS_Admin_ParseMasterCubeDatabase"), class = "factor"), RunDateTime = structure(c(1L,3L, 5L, 2L, 4L), .Label = c("2016-11-10T15:39:36.0000000", "2016-11-16T11:30:20.0000000","2016-11-16T11:37:25.0000000", "2016-11-16T15:51:56.0000000","2016-11-16T15:52:59.0000000"), class = "factor"), StartWeekday = structure(c(1L,2L, 2L, 2L, 2L), .Label = c("Thursday", "Wednesday"), class = "factor"), StartTime = structure(c(3L, 2L, 5L, 1L, 4L), .Label = c("1899-12-30T11:30:20.0000000", "1899-12-30T11:37:25.0000000", "1899-12-30T15:39:36.0000000", "1899-12-30T15:51:56.0000000", "1899-12-30T15:52:59.0000000" ), class = "factor"), EndRunDateTime = structure(c(1L, 3L, 5L, 2L, 4L), .Label = c("2016-11-10T16:02:39.0000000", "2016-11-16T11:31:24.0000000", "2016-11-16T12:03:10.0000000", "2016-11-16T15:52:57.0000000", "2016-11-16T16:19:06.0000000"), class = "factor"), EndWeekday = structure(c(1L, 2L, 2L, 2L, 2L), .Label = c("Thursday", "Wednesday"), class = "factor"), EndTime = structure(c(4L, 2L, 5L, 1L, 3L), .Label = c("1899-12-30T11:31:24.0000000", "1899-12-30T12:03:10.0000000", "1899-12-30T15:52:57.0000000", "1899-12-30T16:02:39.0000000", "1899-12-30T16:19:06.0000000" ), class = "factor")), .Names = c("JobName", "RunDateTime","StartWeekday", "StartTime", "EndRunDateTime", "EndWeekday","EndTime"), row.names = c(NA, 5L), class = "data.frame")
名称通过JobID链接。
最后它应该是这样的:甘特图与工作日/时间而不是日期
我不限于任何库,但已经安装了ggplot。