HTMLcopy
1
<div id="container"></div>
CSScopy
6
1
html, body, #container {
2
width: 100%;
3
height: 100%;
4
margin: 0;
5
padding: 0;
6
}
JavaScriptcopy
x
1
anychart.onDocumentReady(function () {
2
var data = getData();
3
4
var chart = anychart.ganttProject();
5
chart.data(data, 'as-table');
6
7
var timeline = chart.getTimeline();
8
9
var header = timeline.header();
10
11
// Set fill.
12
header.fill({
13
src: 'https://static.anychart.com/images/underwater.jpg',
14
mode: 'stretch',
15
opacity: 0.2
16
});
17
18
chart.title('Set fill as an image');
19
chart.container('container');
20
chart.draw();
21
chart.fitAll();
22
});
23
function getData() {
24
return [
25
{
26
id: 1,
27
name: 'Phase 1 - Strategic Plan',
28
progressValue: 0.14,
29
actualStart: '2000-02-24',
30
actualEnd: '2000-02-27'
31
},
32
{
33
id: 2,
34
name: 'Self-Assessment',
35
parent: 1,
36
progressValue: 0.25,
37
actualStart: '2000-02-24',
38
actualEnd: '2000-02-29'
39
},
40
{
41
id: 3,
42
name: 'Define business vision',
43
parent: 2,
44
progressValue: 0,
45
actualStart: '2000-02-24T24:00',
46
actualEnd: '2000-02-25T09:00',
47
connectTo: 4,
48
connectorType: 'finish-start'
49
},
50
{
51
id: 4,
52
name: 'Identify available skills, information and support',
53
parent: 2,
54
progressValue: 0,
55
actualStart: '2000-02-26T00:00',
56
actualEnd: '2000-02-26T09:00',
57
connectTo: 5,
58
connectorType: 'finish-start'
59
},
60
{
61
id: 5,
62
name: 'Decide whether to proceed',
63
parent: 2,
64
progressValue: 0,
65
actualStart: '2000-02-27',
66
actualEnd: '2000-02-28T08:00',
67
connectTo: 6,
68
connectorType: 'finish-start'
69
},
70
{
71
id: 6,
72
name: 'Define the Opportunity',
73
parent: 1,
74
progressValue: 0.27,
75
actualStart: '2000-02-28T08:00',
76
actualEnd: '2000-02-29'
77
},
78
{
79
id: 7,
80
name: 'Research the market and competition',
81
parent: 6,
82
progressValue: 0,
83
actualStart: '2000-02-26T08:00',
84
actualEnd: '2000-02-27'
85
}
86
];
87
}