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 = [
3
{id: "1", optimistic: 1, pessimistic: 10, mostLikely: 6, name: "A"},
4
{id: "2", optimistic: 3, pessimistic: 8, mostLikely: 5, name: "B"},
5
{id: "3", optimistic: 1, pessimistic: 4, mostLikely: 3, name: "D"},
6
{id: "4", optimistic: 2, pessimistic: 12, mostLikely: 5, name: "AD", dependsOn: ["1", "3"]},
7
{id: "5", optimistic: 4, pessimistic: 16, mostLikely: 10, name: "BC", dependsOn: ["2", "3"]}
8
];
9
10
var chart = anychart.pert();
11
chart.data(data, "as-table");
12
13
// get both statistic values when rendered
14
chart.listen("chartdraw", function() {
15
deviation = chart.getStat("pertChartCriticalPathStandardDeviation");
16
duration = chart.getStat("pertChartProjectDuration");
17
chart.title("The critical path duration makes " + duration.toFixed(2) +
18
" units \n Standard deviation for this project is " + deviation.toFixed(2) + " units");
19
});
20
21
chart.title("Getting the statistics. Click anywhere on the chart to get the duration and deviation values");
22
chart.container("container");
23
chart.draw();
24
});