forked from syncfusion/ej2-vue-samples
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtaskbar-template.vue
204 lines (197 loc) · 5.85 KB
/
taskbar-template.vue
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
<template>
<div>
<div class="control-section">
<div class="content-wrapper">
<ejs-gantt
ref="gantt"
id="taskbarTemplate"
:dataSource="dataSource"
:renderBaseline="true"
:taskFields="taskFields"
:columns="columns"
:allowSelection="true"
:splitterSettings="splitterSettings"
:treeColumnIndex="treeColumnIndex"
:rowHeight="rowHeight"
:taskbarHeight="taskbarHeight"
:dayWorkingTime="dayWorkingTime"
:durationUnit="durationUnit"
:timelineSettings="timelineSettings"
:eventMarkers="eventMarkers"
:height="height"
:taskbarTemplate="taskbarTemplate"
:milestoneTemplate="milestoneTemplate"
:tooltipSettings="tooltipSettings"
:labelSettings="labelSettings"
:projectStartDate="projectStartDate"
:projectEndDate="projectEndDate"
></ejs-gantt>
<div style="float: right; margin: 10px;">
Source:
<a
href="https://en.wikipedia.org/wiki/90th_Academy_Awards"
target="_blank"
>https://en.wikipedia.org/</a>
</div>
</div>
</div>
<div id="action-description">
<p>This sample visualizes the complete event schedule of the 90th Academy awards.
Taskbars are customized using template support and timeline header is customized for a better view of the data.
</p>
</div>
<div id="description">
<p>
The Gantt chart provides support for customizing taskbar UI using taskbar template feature. The
<code>taskbarTemplate</code>
property accepts either string or HTML element`s ID value, which will be used as the template for the taskbars.
The summary tasks and the milestone items can also customized using the <code>parentTaskbarTemplate</code> and
<code>milestoneTemplate</code> properties.
In this demo, we have customized the taskbar UI to display the data from custom columns and the taskbarTemplate
is assigned with the ID of a SCRIPT element whose content is used as the template.
</p>
<p>
Gantt component features are segregated into individual feature-wise modules. To use markers, inject the
<code>DayMarkers</code> module.
</p>
</div>
</div>
</template>
<script>
import Vue from "vue";
import { GanttPlugin, Gantt, DayMarkers, Selection } from "@syncfusion/ej2-vue-gantt";
import ChildTemplate from "./taskbar-temp.vue";
import MilestoneTemplate from "./taskbar-milestone-temp.vue";
import TooltipTemplate from "./taskbar-tooltip-temp.vue";
import { customizedData } from "./data-source";
Vue.use(GanttPlugin);
export default Vue.extend({
data: function() {
return {
dataSource: customizedData,
dateFormat: "hh:mm a",
taskFields: {
id: "TaskId",
name: "TaskName",
startDate: "StartDate",
endDate: "EndDate",
dependency: "Predecessor"
},
columns: [
{ field: "TaskId", headerText: "Event Id" },
{
field: "TaskName",
headerText: "Event Name",
width: "250",
clipMode: "EllipsisWithTooltip"
},
{ field: "StartDate", headerText: "Start Time" },
{ field: "EndDate", headerText: "End Time" },
{ field: "Winner", headerText: "Winner" },
{ field: "Movie", headerText: "Movie" },
{ field: "Performance", headerText: "Moments / Performance Details" }
],
splitterSettings: {
columnIndex: 1
},
treeColumnIndex: 1,
rowHeight: 75,
taskbarHeight: 65,
dayWorkingTime: [{ from: 0, to: 24 }],
durationUnit: "Minute",
timelineSettings: {
timelineUnitSize: 60,
topTier: {
unit: "Hour",
format: 'MMM dd, yyyy'
},
bottomTier: {
unit: "Minutes",
count: 2,
format: "h:mm a"
}
},
eventMarkers: [
{
day: new Date("03/05/2018 07:09:00 PM"),
label: "Performance"
},
{
day: new Date("03/05/2018 07:46:00 PM"),
label: "Moments"
},
{
day: new Date("03/05/2018 07:59:00 PM"),
label: "Performance"
},
{
day: new Date("03/05/2018 08:08:00 PM"),
label: "Moments"
},
{
day: new Date("03/05/2018 08:24:00 PM"),
label: "Moments"
},
{
day: new Date("03/05/2018 08:31:00 PM"),
label: "Performance"
},
{
day: new Date("03/05/2018 08:47:00 PM"),
label: "Moments"
}
],
height: "450px",
labelSettings: {
leftLabel: "TaskName"
},
projectStartDate: new Date("03/05/2018 06:00 PM"),
projectEndDate: new Date("03/05/2018 09:50 PM"),
taskbarTemplate: function() {
return { template: ChildTemplate };
},
milestoneTemplate: function() {
return { template: MilestoneTemplate };
},
tooltipSettings: {
taskbar: function() {
return { template: TooltipTemplate };
}
}
};
},
provide: {
gantt: [DayMarkers, Selection]
}
});
</script>
<style scoped>
/deep/ .e-custom-parent {
background-color: #6d619b;
border: 1px solid #3f51b5;
}
/deep/ .e-custom-moments {
background-color: #7ab748;
border: 1px solid #3f51b5;
}
/deep/ .e-custom-performance {
background-color: #ad7a66;
border: 1px solid #3f51b5;
}
/deep/ .moments,
/deep/ .face-mask,
/deep/ .oscar {
position: relative;
top: 14px;
left: 5px;
padding-right: 4px;
}
/deep/ .e-milestone-top {
border-bottom-color: #7ab748 !important;
border-bottom: 1px solid #3f51b5;
}
/deep/ .e-milestone-bottom {
border-top-color: #7ab748 !important;
border-top: 1px solid #3f51b5;
}
</style>