如何使用SSRS创建4-D范围图?

时间:2018-09-24 21:07:38

标签: charts ssrs-2012

我在SSRS 2015中为3位工人创建了1天的范围图。但是现在我希望能够显示一周中其他几天每个工人的时间,以便将它们全部绘制在同一张图表上。我该怎么做?

请注意,我正在对TimeCategory进行分组,但是我的着色基于TimeCategory2。

enter image description here

enter image description here 这是我用于上述数据集的SQL。请注意,目前该数据集只有2天,但是由于将X轴的格式设置为h:mm tt,因此图表中只显示了一天。

create table Stage_gantt_chart2
(
Worker int
,Sched_Start datetime
,Sched_End datetime
,Sched_Duration decimal(10,2)
,TimeCategory varchar(30)
,TimeCategory2 varchar(30)
)

insert Stage_gantt_chart2 VALUES(1, '2018-09-20 08:00:00', '2018-09-20 09:00:00', 1, 'NVA', 'NVA')
insert Stage_gantt_chart2 VALUES(1, '2018-09-20 09:00:00', '2018-09-20 09:30:00', 0.5, 'INHOME', 'INHOME')
insert Stage_gantt_chart2 VALUES(1, '2018-09-20 09:30:00', '2018-09-20 10:00:00', 0.5, NULL, NULL)
insert Stage_gantt_chart2 VALUES(1, '2018-09-20 10:00:00', '2018-09-20 11:00:00', 1, 'INHOME2', 'INHOME')
insert Stage_gantt_chart2 VALUES(1, '2018-09-20 11:00:00', '2018-09-20 12:00:00', 1, 'DRIVE', 'DRIVE')
insert Stage_gantt_chart2 VALUES(1, '2018-09-20 12:00:00', '2018-09-20 13:00:00', 0.5, NULL, NULL)
insert Stage_gantt_chart2 VALUES(1, '2018-09-20 13:00:00', '2018-09-20 13:30:00', 1, 'NVA2', 'NVA')
insert Stage_gantt_chart2 VALUES(1, '2018-09-20 13:30:00', '2018-09-20 14:00:00', 0.5, NULL, NULL)
insert Stage_gantt_chart2 VALUES(1, '2018-09-20 15:00:00', '2018-09-20 16:00:00', 1, 'DRIVE2', 'DRIVE')

insert Stage_gantt_chart2 VALUES(2, '2018-09-20 08:00:00', '2018-09-20 09:00:00', 1, 'DRIVE', 'DRIVE')
insert Stage_gantt_chart2 VALUES(2, '2018-09-20 09:00:00', '2018-09-20 10:00:00', 1, 'DRIVE2', 'DRIVE')
insert Stage_gantt_chart2 VALUES(2, '2018-09-20 10:00:00', '2018-09-20 11:00:00', 1, 'INHOME', 'INHOME')
insert Stage_gantt_chart2 VALUES(2, '2018-09-20 11:00:00', '2018-09-20 12:00:00', 1, 'DRIVE3', 'DRIVE')
insert Stage_gantt_chart2 VALUES(2, '2018-09-20 12:00:00', '2018-09-20 13:00:00', 1, 'INHOME', 'INHOME')
insert Stage_gantt_chart2 VALUES(2, '2018-09-20 13:00:00', '2018-09-20 14:00:00', 1, 'NVA', 'NVA')
insert Stage_gantt_chart2 VALUES(2, '2018-09-20 14:00:00', '2018-09-20 15:00:00', 1, 'NVA2', 'NVA')
insert Stage_gantt_chart2 VALUES(2, '2018-09-20 15:00:00', '2018-09-20 16:00:00', 1, 'NVA3', 'NVA')

insert Stage_gantt_chart2 VALUES(3, '2018-09-20 08:00:00', '2018-09-20 08:30:00', 0.5, 'NVA', 'NVA')
insert Stage_gantt_chart2 VALUES(3, '2018-09-20 10:00:00', '2018-09-20 11:00:00', 1, 'INHOME', 'INHOME')
insert Stage_gantt_chart2 VALUES(3, '2018-09-20 11:00:00', '2018-09-20 12:00:00', 1, 'NVA2', 'NVA')
insert Stage_gantt_chart2 VALUES(3, '2018-09-20 12:00:00', '2018-09-20 13:00:00', 1, NULL, NULL)
insert Stage_gantt_chart2 VALUES(3, '2018-09-20 13:00:00', '2018-09-20 14:30:00', 1.5, 'DRIVE', 'DRIVE')
insert Stage_gantt_chart2 VALUES(3, '2018-09-20 15:00:00', '2018-09-20 16:00:00', 1, 'NVA3', 'NVA')

/* Next day */
insert Stage_gantt_chart2 VALUES(1, '2018-09-21 08:00:00', '2018-09-20 09:00:00', 1, 'NVA', 'NVA')
insert Stage_gantt_chart2 VALUES(1, '2018-09-21 09:00:00', '2018-09-20 09:30:00', 0.5, 'INHOME', 'INHOME')
insert Stage_gantt_chart2 VALUES(1, '2018-09-21 09:30:00', '2018-09-20 10:00:00', 0.5, NULL, NULL)
insert Stage_gantt_chart2 VALUES(1, '2018-09-21 10:00:00', '2018-09-20 11:00:00', 1, 'INHOME2', 'INHOME')
insert Stage_gantt_chart2 VALUES(1, '2018-09-21 11:00:00', '2018-09-20 12:00:00', 1, 'DRIVE', 'DRIVE')
insert Stage_gantt_chart2 VALUES(1, '2018-09-21 12:00:00', '2018-09-20 13:00:00', 0.5, NULL, NULL)
insert Stage_gantt_chart2 VALUES(1, '2018-09-21 13:00:00', '2018-09-20 13:30:00', 1, 'NVA2', 'NVA')
insert Stage_gantt_chart2 VALUES(1, '2018-09-21 13:30:00', '2018-09-20 14:00:00', 0.5, NULL, NULL)
insert Stage_gantt_chart2 VALUES(1, '2018-09-21 15:00:00', '2018-09-20 16:00:00', 1, 'DRIVE2', 'DRIVE')

insert Stage_gantt_chart2 VALUES(2, '2018-09-21 08:00:00', '2018-09-20 09:00:00', 1, 'DRIVE', 'DRIVE')
insert Stage_gantt_chart2 VALUES(2, '2018-09-21 09:00:00', '2018-09-20 10:00:00', 1, 'DRIVE2', 'DRIVE')
insert Stage_gantt_chart2 VALUES(2, '2018-09-21 10:00:00', '2018-09-20 11:00:00', 1, 'INHOME', 'INHOME')
insert Stage_gantt_chart2 VALUES(2, '2018-09-21 11:00:00', '2018-09-20 12:00:00', 1, 'DRIVE3', 'DRIVE')
insert Stage_gantt_chart2 VALUES(2, '2018-09-21 12:00:00', '2018-09-20 13:00:00', 1, 'INHOME', 'INHOME')
insert Stage_gantt_chart2 VALUES(2, '2018-09-21 13:00:00', '2018-09-20 14:00:00', 1, 'NVA', 'NVA')
insert Stage_gantt_chart2 VALUES(2, '2018-09-21 14:00:00', '2018-09-20 15:00:00', 1, 'NVA2', 'NVA')
insert Stage_gantt_chart2 VALUES(2, '2018-09-21 15:00:00', '2018-09-20 16:00:00', 1, 'NVA3', 'NVA')

insert Stage_gantt_chart2 VALUES(3, '2018-09-21 08:00:00', '2018-09-20 08:30:00', 0.5, 'NVA', 'NVA')
insert Stage_gantt_chart2 VALUES(3, '2018-09-21 10:00:00', '2018-09-20 11:00:00', 1, 'INHOME', 'INHOME')
insert Stage_gantt_chart2 VALUES(3, '2018-09-21 11:00:00', '2018-09-20 12:00:00', 1, 'NVA2', 'NVA')
insert Stage_gantt_chart2 VALUES(3, '2018-09-21 12:00:00', '2018-09-20 13:00:00', 1, NULL, NULL)
insert Stage_gantt_chart2 VALUES(3, '2018-09-21 13:00:00', '2018-09-20 14:30:00', 1.5, 'DRIVE', 'DRIVE')
insert Stage_gantt_chart2 VALUES(3, '2018-09-21 15:00:00', '2018-09-20 16:00:00', 1, 'NVA3', 'NVA')

SELECT *
FROM Stage_gantt_chart2
order by Worker,Sched_Start

0 个答案:

没有答案