| 23 |
liveuser |
1 |
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
|
|
|
2 |
<html>
|
|
|
3 |
|
|
|
4 |
<head>
|
|
|
5 |
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
|
|
6 |
<title>amCharts examples</title>
|
|
|
7 |
<link rel="stylesheet" href="style.css" type="text/css">
|
|
|
8 |
<script src="../amcharts/amcharts.js" type="text/javascript"></script>
|
|
|
9 |
<script src="../amcharts/serial.js" type="text/javascript"></script>
|
|
|
10 |
<script>
|
|
|
11 |
var chart;
|
|
|
12 |
|
|
|
13 |
var chartData = [
|
|
|
14 |
{
|
|
|
15 |
"name": "Income A",
|
|
|
16 |
"open": 0,
|
|
|
17 |
"close": 11.13,
|
|
|
18 |
"color": "#54cb6a",
|
|
|
19 |
"balloonValue": 11.13
|
|
|
20 |
},
|
|
|
21 |
{
|
|
|
22 |
"name": "Income B",
|
|
|
23 |
"open": 11.13,
|
|
|
24 |
"close": 15.81,
|
|
|
25 |
"color": "#54cb6a",
|
|
|
26 |
"balloonValue": 4.68
|
|
|
27 |
},
|
|
|
28 |
{
|
|
|
29 |
"name": "Total Income",
|
|
|
30 |
"open": 0,
|
|
|
31 |
"close": 15.81,
|
|
|
32 |
"color": "#169b2f",
|
|
|
33 |
"balloonValue": 15.81
|
|
|
34 |
},
|
|
|
35 |
{
|
|
|
36 |
"name": "Expenses A",
|
|
|
37 |
"open": 12.92,
|
|
|
38 |
"close": 15.81,
|
|
|
39 |
"color": "#cc4b48",
|
|
|
40 |
"balloonValue": 2.89
|
|
|
41 |
},
|
|
|
42 |
{
|
|
|
43 |
"name": "Expenses B",
|
|
|
44 |
"open": 8.64,
|
|
|
45 |
"close": 12.92,
|
|
|
46 |
"color": "#cc4b48",
|
|
|
47 |
"balloonValue": 4.24
|
|
|
48 |
},
|
|
|
49 |
{
|
|
|
50 |
"name": "Revenue",
|
|
|
51 |
"open": 0,
|
|
|
52 |
"close": 8.64,
|
|
|
53 |
"color": "#1c8ceb",
|
|
|
54 |
"balloonValue": 11.13
|
|
|
55 |
}
|
|
|
56 |
];
|
|
|
57 |
|
|
|
58 |
|
|
|
59 |
AmCharts.ready(function () {
|
|
|
60 |
// Waterfall chart is a simple serial chart with some specific settings
|
|
|
61 |
chart = new AmCharts.AmSerialChart();
|
|
|
62 |
chart.dataProvider = chartData;
|
|
|
63 |
chart.categoryField = "name";
|
|
|
64 |
chart.columnWidth = 0.6;
|
|
|
65 |
chart.startDuration = 1;
|
|
|
66 |
|
|
|
67 |
// AXES
|
|
|
68 |
// Category
|
|
|
69 |
var categoryAxis = chart.categoryAxis;
|
|
|
70 |
categoryAxis.gridAlpha = 0.1;
|
|
|
71 |
categoryAxis.axisAlpha = 0;
|
|
|
72 |
categoryAxis.gridPosition = "start";
|
|
|
73 |
|
|
|
74 |
// Value
|
|
|
75 |
var valueAxis = new AmCharts.ValueAxis();
|
|
|
76 |
valueAxis.gridAlpha = 0.1;
|
|
|
77 |
valueAxis.axisAlpha = 0;
|
|
|
78 |
chart.addValueAxis(valueAxis);
|
|
|
79 |
|
|
|
80 |
// GRAPH
|
|
|
81 |
var graph = new AmCharts.AmGraph();
|
|
|
82 |
graph.valueField = "close";
|
|
|
83 |
graph.openField = "open";
|
|
|
84 |
graph.type = "column";
|
|
|
85 |
graph.lineAlpha = 1;
|
|
|
86 |
graph.lineColor = "#BBBBBB";
|
|
|
87 |
graph.colorField = "color";
|
|
|
88 |
graph.fillAlphas = 0.8;
|
|
|
89 |
graph.balloonText = "<span style='color:[[color]]'>[[category]]</span><br><span style='font-size:13px;'><b>$[[balloonValue]] Mln</b></span>";
|
|
|
90 |
graph.labelText = "$[[balloonValue]]";
|
|
|
91 |
chart.addGraph(graph);
|
|
|
92 |
|
|
|
93 |
// Trend lines used for connectors
|
|
|
94 |
var trendLine = new AmCharts.TrendLine();
|
|
|
95 |
trendLine.initialCategory = "Income A";
|
|
|
96 |
trendLine.finalCategory = "Income B";
|
|
|
97 |
trendLine.initialValue = 11.13;
|
|
|
98 |
trendLine.finalValue = 11.13;
|
|
|
99 |
trendLine.lineColor = "#888888";
|
|
|
100 |
trendLine.dashLength = 3;
|
|
|
101 |
chart.addTrendLine(trendLine);
|
|
|
102 |
|
|
|
103 |
trendLine = new AmCharts.TrendLine();
|
|
|
104 |
trendLine.initialCategory = "Income B";
|
|
|
105 |
trendLine.finalCategory = "Expenses A";
|
|
|
106 |
trendLine.initialValue = 15.81;
|
|
|
107 |
trendLine.finalValue = 15.81;
|
|
|
108 |
trendLine.lineColor = "#888888";
|
|
|
109 |
trendLine.dashLength = 3;
|
|
|
110 |
chart.addTrendLine(trendLine);
|
|
|
111 |
|
|
|
112 |
trendLine = new AmCharts.TrendLine();
|
|
|
113 |
trendLine.initialCategory = "Expenses A";
|
|
|
114 |
trendLine.finalCategory = "Expenses B";
|
|
|
115 |
trendLine.initialValue = 12.92;
|
|
|
116 |
trendLine.finalValue = 12.92;
|
|
|
117 |
trendLine.lineColor = "#888888";
|
|
|
118 |
trendLine.dashLength = 3;
|
|
|
119 |
chart.addTrendLine(trendLine);
|
|
|
120 |
|
|
|
121 |
trendLine = new AmCharts.TrendLine();
|
|
|
122 |
trendLine.initialCategory = "Expenses B";
|
|
|
123 |
trendLine.finalCategory = "Revenue";
|
|
|
124 |
trendLine.initialValue = 8.64;
|
|
|
125 |
trendLine.finalValue = 8.64;
|
|
|
126 |
trendLine.lineColor = "#888888";
|
|
|
127 |
trendLine.dashLength = 3;
|
|
|
128 |
chart.addTrendLine(trendLine);
|
|
|
129 |
|
|
|
130 |
// WRITE
|
|
|
131 |
chart.write("chartdiv");
|
|
|
132 |
});
|
|
|
133 |
</script>
|
|
|
134 |
</head>
|
|
|
135 |
|
|
|
136 |
<body>
|
|
|
137 |
<div id="chartdiv" style="width: 600px; height: 400px;"></div>
|
|
|
138 |
</body>
|
|
|
139 |
|
|
|
140 |
</html>
|