barFloating.html
2.83 KB
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
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>amCharts examples</title>
<link rel="stylesheet" href="style.css" type="text/css">
<script src="../amcharts/amcharts.js" type="text/javascript"></script>
<script src="../amcharts/serial.js" type="text/javascript"></script>
<script type="text/javascript">
var chart;
var chartData = [
{
"name": "John",
"startTime": 8,
"endTime": 11,
"color": "#FF0F00"
},
{
"name": "Joe",
"startTime": 10,
"endTime": 13,
"color": "#FF9E01"
},
{
"name": "Susan",
"startTime": 11,
"endTime": 18,
"color": "#F8FF01"
},
{
"name": "Eaton",
"startTime": 15,
"endTime": 19,
"color": "#04D215"
}
];
AmCharts.ready(function () {
// SERIAL CHART
chart = new AmCharts.AmSerialChart();
chart.dataProvider = chartData;
chart.categoryField = "name";
chart.rotate = true;
chart.columnWidth = 0.9;
chart.startDuration = 1;
// AXES
// Category
var categoryAxis = chart.categoryAxis;
categoryAxis.gridAlpha = 0.1;
categoryAxis.axisAlpha = 0;
categoryAxis.gridPosition = "start";
// Value
var valueAxis = new AmCharts.ValueAxis();
valueAxis.gridAlpha = 0.1;
valueAxis.axisAlpha = 0;
valueAxis.unit = ":00";
chart.addValueAxis(valueAxis);
// GRAPH
var graph = new AmCharts.AmGraph();
graph.valueField = "endTime";
graph.openField = "startTime";
graph.type = "column";
graph.lineAlpha = 0;
graph.colorField = "color";
graph.fillAlphas = 0.8;
graph.balloonText = "<b>[[category]]</b><br>starts at [[startTime]]:00<br>ends at [[endTime]]:00";
chart.addGraph(graph);
chart.creditsPosition = "top-right";
// WRITE
chart.write("chartdiv");
});
</script>
</head>
<body>
<div id="chartdiv" style="width: 100%; height: 400px;"></div>
</body>
</html>