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
// set the data with three time estimates
3
var data = [
4
{id: "1", optimistic: 1, pessimistic: 10, mostLikely: 6, name: "A"},
5
{id: "2", optimistic: 3, pessimistic: 8, mostLikely: 5, name: "B"},
6
{id: "3", optimistic: 1, pessimistic: 4, mostLikely: 3, name: "D"},
7
{id: "4", optimistic: 2, pessimistic: 12, mostLikely: 5, name: "AD", dependsOn: ["1", "3"]},
8
{id: "5", optimistic: 4, pessimistic: 16, mostLikely: 10, name: "BC", dependsOn: ["2", "3"]}
9
];
10
11
// set the chart
12
var chart = anychart.pert();
13
chart.data(data, "as-table");
14
15
chart.listen("chartDraw", function() {
16
// get project duration
17
var duration = chart.getStat("pertChartProjectDuration");
18
// get project deviation
19
var deviation = chart.getStat("pertChartCriticalPathStandardDeviation");
20
chart.title("Duration: " + duration.toFixed(2) + "\n Deviation: " + deviation.toFixed(2));
21
})
22
23
chart.title("Chart statistics is shown in the title");
24
chart.container("container");
25
chart.draw();
26
});