amcharts.rb 3.4.7.0 → 3.4.7.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +8 -8
- data/README.md +1 -1
- data/app/assets/javascripts/amcharts.js +5 -121
- data/app/assets/javascripts/amcharts/ajax.js +4 -0
- data/app/assets/javascripts/amcharts/ajax/request.js +70 -0
- data/app/assets/javascripts/amcharts/ajax/response.js +26 -0
- data/app/assets/javascripts/amcharts/chart.js +67 -0
- data/app/assets/javascripts/amcharts/ext/get_elements_by_class_name.js +24 -0
- data/app/assets/javascripts/amcharts/ext/object_keys.js +41 -0
- data/app/assets/javascripts/amcharts/helpers.js +113 -0
- data/app/assets/javascripts/amcharts/remote_json_provider.js +42 -0
- data/app/assets/javascripts/amcharts/util.js +61 -0
- data/app/assets/javascripts/json2.js +489 -0
- data/app/assets/stylesheets/amcharts.css +10 -0
- data/app/views/amcharts/_data.erb +2 -2
- data/app/views/amcharts/_data_source.erb +8 -0
- data/app/views/amcharts/_listener.erb +1 -1
- data/app/views/amcharts/chart_builder.erb +8 -6
- data/lib/amcharts.rb +1 -0
- data/lib/amcharts/chart.rb +21 -4
- data/lib/amcharts/chart/pie.rb +2 -2
- data/lib/amcharts/chart_builder.rb +14 -2
- data/lib/amcharts/data_source.rb +17 -0
- data/lib/amcharts/settings.rb +7 -3
- data/lib/amcharts/version.rb +1 -1
- data/spec/chart_spec.rb +29 -0
- data/vendor/assets/javascripts/amcharts/amcharts.js +361 -361
- data/vendor/assets/javascripts/amcharts/serial.js +51 -51
- metadata +14 -2
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
NjFhOWNiNzA2NDJjZmVmMTEwMGE0ZTg2Y2E1YmViYWYyNjc2YmU1NA==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
OGE3ZTY3MWUwNTMwMTM5ZGM4OTlhOTBmM2Q1OWIxNTdhNjhmZmNiMQ==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
ZDY3YTMzYjI1NzQ2MjNhZDdlN2ZlZGFlM2Q3NDgyYWU2NGZkMDk2Mzk4ODA0
|
10
|
+
Zjk5OTUxNDMwYjkzMWViMjBlOGRkMDc0N2VhMzljNTYwNDY4Y2RmNDQ0ZjUy
|
11
|
+
MTdhNzUwMzNmNmY4ZTc3NGQzNzgxM2IwNDYwZjlmMmM4MTk2NTk=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
YmVlODA2MjFjYTUzMWM0MTI4OWFmN2Y0N2UwNzQ1Nzk0NDQzOGM3N2M4YWIy
|
14
|
+
ZjY1OTI2YzVlNWQ5NTdiMGRmYTE2MzRiNDIzYWNiMGMzMWE5OTkxZTc5NTQ2
|
15
|
+
OTBiYTQ2ZjRiZGNmZGVlMjYyNWMyYzhkMTNiMDI1NjI4ODRhNjA=
|
data/README.md
CHANGED
@@ -1,122 +1,6 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
1
|
+
//= require amcharts/amcharts
|
2
|
+
//= require amcharts/ext/get_elements_by_class_name
|
3
|
+
//= require_self
|
4
|
+
//= require_tree ./amcharts
|
4
5
|
|
5
|
-
|
6
|
-
// See: http://stackoverflow.com/questions/13261506/getelementsbyclassname-in-ie8
|
7
|
-
(function() {
|
8
|
-
var indexOf = [].indexOf || function(prop) {
|
9
|
-
for (var i = 0; i < this.length; i++) {
|
10
|
-
if (this[i] === prop) return i;
|
11
|
-
}
|
12
|
-
return -1;
|
13
|
-
};
|
14
|
-
window.getElementsByClassName = function(className,context) {
|
15
|
-
if (context.getElementsByClassName) return context.getElementsByClassName(className);
|
16
|
-
var elems = document.querySelectorAll ? context.querySelectorAll("." + className) : (function() {
|
17
|
-
var all = context.getElementsByTagName("*"),
|
18
|
-
elements = [],
|
19
|
-
i = 0;
|
20
|
-
for (; i < all.length; i++) {
|
21
|
-
if (all[i].className && (" " + all[i].className + " ").indexOf(" " + className + " ") > -1 && indexOf.call(elements,all[i]) === -1) elements.push(all[i]);
|
22
|
-
}
|
23
|
-
return elements;
|
24
|
-
})();
|
25
|
-
return elems;
|
26
|
-
};
|
27
|
-
})();
|
28
|
-
|
29
|
-
function add_container_if_needed(id, width, height)
|
30
|
-
{
|
31
|
-
var container = document.getElementById(id);
|
32
|
-
|
33
|
-
if (!container)
|
34
|
-
{
|
35
|
-
container = document.createElement("DIV");
|
36
|
-
container.className = 'chart';
|
37
|
-
container.id = id;
|
38
|
-
container.style.width = width + 'px';
|
39
|
-
container.style.height = height + 'px';
|
40
|
-
|
41
|
-
// Add the container before the last script
|
42
|
-
var scripts = document.getElementsByTagName('script');
|
43
|
-
var this_script = scripts[scripts.length - 1];
|
44
|
-
this_script.parentNode.insertBefore(container, this_script);
|
45
|
-
}
|
46
|
-
|
47
|
-
return container;
|
48
|
-
}
|
49
|
-
|
50
|
-
function add_loading_indicator(container, width, height, message, image_path)
|
51
|
-
{
|
52
|
-
var wrapper = document.createElement("DIV"),
|
53
|
-
blanket = document.createElement("DIV"),
|
54
|
-
blanket_container = document.createElement("DIV"),
|
55
|
-
blanket_outer = document.createElement("DIV"),
|
56
|
-
blanket_inner = document.createElement("DIV"),
|
57
|
-
loading_div = document.createElement("DIV"),
|
58
|
-
loading_image = document.createElement("IMG"),
|
59
|
-
loading = document.createTextNode(message);
|
60
|
-
|
61
|
-
wrapper.className = 'chart-wrapper';
|
62
|
-
wrapper.id = container.id + "_wrapper"
|
63
|
-
wrapper.style.width = width + 'px';
|
64
|
-
wrapper.style.minHeight = height + 'px';
|
65
|
-
|
66
|
-
container.style.width = '100%';
|
67
|
-
|
68
|
-
blanket.className = 'chart-blanket';
|
69
|
-
|
70
|
-
loading_div.className = 'chart-loading';
|
71
|
-
loading_image.className = 'chart-loading-image';
|
72
|
-
loading_image.src = image_path;
|
73
|
-
|
74
|
-
container.parentNode.insertBefore(wrapper, container);
|
75
|
-
|
76
|
-
blanket_container.appendChild(blanket_outer)
|
77
|
-
blanket_outer.appendChild(blanket_inner);
|
78
|
-
blanket_inner.appendChild(loading_div);
|
79
|
-
loading_div.appendChild(loading);
|
80
|
-
blanket_inner.appendChild(loading_image);
|
81
|
-
|
82
|
-
blanket.appendChild(blanket_container);
|
83
|
-
wrapper.appendChild(blanket);
|
84
|
-
wrapper.appendChild(container);
|
85
|
-
}
|
86
|
-
|
87
|
-
function hide_loading_indicator(chart)
|
88
|
-
{
|
89
|
-
var container = chart.container.div;
|
90
|
-
var wrapper = container;
|
91
|
-
while ((" " + wrapper.className + " ").indexOf(" chart-wrapper ") < 0)
|
92
|
-
{
|
93
|
-
wrapper = wrapper.parentElement;
|
94
|
-
}
|
95
|
-
|
96
|
-
getElementsByClassName('chart-blanket', wrapper)[0].style.display = 'none';
|
97
|
-
}
|
98
|
-
|
99
|
-
function add_legend_div(id, main_div)
|
100
|
-
{
|
101
|
-
var legend = document.getElementById(id);
|
102
|
-
|
103
|
-
if (!legend)
|
104
|
-
{
|
105
|
-
legend = document.createElement("DIV");
|
106
|
-
legend.className = 'chart-legend';
|
107
|
-
legend.id = id;
|
108
|
-
legend.style.width = main_div.getWidth() + 'px';
|
109
|
-
|
110
|
-
var wrapper = main_div.parentNode;
|
111
|
-
if(main_div.nextSibling)
|
112
|
-
{
|
113
|
-
wrapper.insertBefore(legend, main_div.nextSibling);
|
114
|
-
}
|
115
|
-
else
|
116
|
-
{
|
117
|
-
wrapper.appendChild(legend);
|
118
|
-
}
|
119
|
-
}
|
120
|
-
|
121
|
-
return legend;
|
122
|
-
}
|
6
|
+
AmCharts.RB = {};
|
@@ -0,0 +1,70 @@
|
|
1
|
+
//= require amcharts/util
|
2
|
+
//= require amcharts/ajax/response
|
3
|
+
//= require_self
|
4
|
+
|
5
|
+
AmCharts.RB.Ajax.Request = AmCharts.RB.Util.Class.create({
|
6
|
+
response: null,
|
7
|
+
|
8
|
+
initialize: function(url, params, method, on_state_change)
|
9
|
+
{
|
10
|
+
this.transport = this.get_transport();
|
11
|
+
|
12
|
+
this.url = url;
|
13
|
+
this.method = method ? method.toUpperCase() : 'GET';
|
14
|
+
this.params = AmCharts.isString(params) ? params : AmCharts.RB.Util.to_query_string(params);
|
15
|
+
|
16
|
+
if (this.method != 'GET' && this.method != 'POST') {
|
17
|
+
// simulate other verbs over post
|
18
|
+
this.params += (this.params ? '&' : '') + "_method=" + this.method;
|
19
|
+
this.method = 'POST';
|
20
|
+
}
|
21
|
+
|
22
|
+
if (this.params && this.method === 'GET') {
|
23
|
+
// when GET, append parameters to URL
|
24
|
+
this.url += (this.url.indexOf('?') > -1 ? '&' : '?') + this.params;
|
25
|
+
}
|
26
|
+
|
27
|
+
this.transport.open(this.method.toUpperCase(), this.url, true);
|
28
|
+
this.response = new AmCharts.RB.Ajax.Response(this.transport);
|
29
|
+
|
30
|
+
if (on_state_change && AmCharts.RB.Util.is_function(on_state_change)) {
|
31
|
+
this.transport.onreadystatechange = on_state_change;
|
32
|
+
}
|
33
|
+
|
34
|
+
this.set_request_headers();
|
35
|
+
this.transport.send(this.method === 'POST' ? this.params : null);
|
36
|
+
},
|
37
|
+
|
38
|
+
get_transport: function()
|
39
|
+
{
|
40
|
+
return AmCharts.RB.Util.try_these(
|
41
|
+
function() {return new XMLHttpRequest()},
|
42
|
+
function() {return new ActiveXObject('Msxml2.XMLHTTP')},
|
43
|
+
function() {return new ActiveXObject('Microsoft.XMLHTTP')}
|
44
|
+
) || false;
|
45
|
+
},
|
46
|
+
|
47
|
+
set_request_headers: function()
|
48
|
+
{
|
49
|
+
var headers = {
|
50
|
+
'X-Requested-With': 'XMLHttpRequest',
|
51
|
+
'Accept': 'text/javascript, text/html, application/xml, text/xml, */*'
|
52
|
+
};
|
53
|
+
|
54
|
+
if (this.method == 'POST')
|
55
|
+
{
|
56
|
+
headers['Content-type'] = "application/x-www-form-urlencoded; charset=UTF-8";
|
57
|
+
|
58
|
+
/* Force "Connection: close" for older Mozilla browsers to work
|
59
|
+
* around a bug where XMLHttpRequest sends an incorrect
|
60
|
+
* Content-length header. See Mozilla Bugzilla #246651.
|
61
|
+
*/
|
62
|
+
if (this.transport.overrideMimeType && (navigator.userAgent.match(/Gecko\/(\d{4})/) || [0,2005])[1] < 2005)
|
63
|
+
headers['Connection'] = 'close';
|
64
|
+
}
|
65
|
+
|
66
|
+
for (var name in headers) {
|
67
|
+
this.transport.setRequestHeader(name, headers[name]);
|
68
|
+
}
|
69
|
+
}
|
70
|
+
});
|
@@ -0,0 +1,26 @@
|
|
1
|
+
//= require json2
|
2
|
+
|
3
|
+
AmCharts.RB.Ajax.Response = function(transport) {
|
4
|
+
var $transport = transport;
|
5
|
+
|
6
|
+
return {
|
7
|
+
status: function() { return $transport.status },
|
8
|
+
status_text: function() { return $transport.statusText },
|
9
|
+
ready_state: function() { return $transport.readyState },
|
10
|
+
|
11
|
+
get_header: function(name)
|
12
|
+
{
|
13
|
+
try {
|
14
|
+
return $transport.getResponseHeader(name) || null;
|
15
|
+
} catch (e) { return null; }
|
16
|
+
},
|
17
|
+
|
18
|
+
get_json: function()
|
19
|
+
{
|
20
|
+
try {
|
21
|
+
return JSON.parse($transport.responseText);
|
22
|
+
} catch(e) { return null; }
|
23
|
+
}
|
24
|
+
}
|
25
|
+
};
|
26
|
+
|
@@ -0,0 +1,67 @@
|
|
1
|
+
//= require amcharts/ext/object_keys
|
2
|
+
|
3
|
+
AmCharts.RB.Chart = AmCharts.RB.Util.Class.create({
|
4
|
+
initialize: function(chart)
|
5
|
+
{
|
6
|
+
this.chart = chart;
|
7
|
+
},
|
8
|
+
|
9
|
+
load_data: function(data)
|
10
|
+
{
|
11
|
+
this.chart.dataProvider = data;
|
12
|
+
|
13
|
+
if (this.pie()) {
|
14
|
+
if (AmCharts.RB.Util.is_empty(this.chart.titleField)) this.chart.titleField = this.title_field();
|
15
|
+
if (AmCharts.RB.Util.is_empty(this.chart.valueField)) this.chart.valueField = this.value_field();
|
16
|
+
}
|
17
|
+
else
|
18
|
+
{
|
19
|
+
if (AmCharts.RB.Util.is_empty(this.chart.categoryField)) this.chart.categoryField = this.category_field();
|
20
|
+
}
|
21
|
+
|
22
|
+
|
23
|
+
this.chart.validateData();
|
24
|
+
this.chart.animateAgain();
|
25
|
+
},
|
26
|
+
|
27
|
+
category_field: function()
|
28
|
+
{
|
29
|
+
if (this.chart.dataProvider.length == 0) return '';
|
30
|
+
return Object.keys(this.chart.dataProvider[0])[0];
|
31
|
+
},
|
32
|
+
|
33
|
+
value_field: function()
|
34
|
+
{
|
35
|
+
if (this.chart.dataProvider.length == 0) return '';
|
36
|
+
return Object.keys(this.chart.dataProvider[0])[1];
|
37
|
+
},
|
38
|
+
|
39
|
+
title_field: function()
|
40
|
+
{
|
41
|
+
if (this.chart.dataProvider.length == 0) return '';
|
42
|
+
return Object.keys(this.chart.dataProvider[0])[0];
|
43
|
+
},
|
44
|
+
|
45
|
+
failed: function(message)
|
46
|
+
{
|
47
|
+
var blanket = AmCharts.RB.Helpers.get_blanket(this.chart.container.div),
|
48
|
+
blanket_inner = blanket.childNodes[0].childNodes[0].childNodes[0];
|
49
|
+
|
50
|
+
blanket.style.display = '';
|
51
|
+
var error_div = document.createElement("DIV");
|
52
|
+
error_div.className = 'chart-loading-error';
|
53
|
+
error_div.appendChild(document.createTextNode(message));
|
54
|
+
blanket_inner.innerHTML = "";
|
55
|
+
blanket_inner.appendChild(error_div);
|
56
|
+
},
|
57
|
+
|
58
|
+
pie: function()
|
59
|
+
{
|
60
|
+
return this.chart.type === "pie";
|
61
|
+
},
|
62
|
+
|
63
|
+
serial: function()
|
64
|
+
{
|
65
|
+
return this.chart.type === "serial";
|
66
|
+
}
|
67
|
+
});
|
@@ -0,0 +1,24 @@
|
|
1
|
+
// Add indexOf and getElementsByClassName methods
|
2
|
+
// See: http://stackoverflow.com/questions/13261506/getelementsbyclassname-in-ie8
|
3
|
+
(function() {
|
4
|
+
var indexOf = [].indexOf || function(prop) {
|
5
|
+
for (var i = 0; i < this.length; i++) {
|
6
|
+
if (this[i] === prop) return i;
|
7
|
+
}
|
8
|
+
return -1;
|
9
|
+
};
|
10
|
+
|
11
|
+
window.getElementsByClassName = function(className, context) {
|
12
|
+
if (context.getElementsByClassName) return context.getElementsByClassName(className);
|
13
|
+
var elems = document.querySelectorAll ? context.querySelectorAll("." + className) : (function() {
|
14
|
+
var all = context.getElementsByTagName("*"),
|
15
|
+
elements = [],
|
16
|
+
i = 0;
|
17
|
+
for (; i < all.length; i++) {
|
18
|
+
if (all[i].className && (" " + all[i].className + " ").indexOf(" " + className + " ") > -1 && indexOf.call(elements,all[i]) === -1) elements.push(all[i]);
|
19
|
+
}
|
20
|
+
return elements;
|
21
|
+
})();
|
22
|
+
return elems;
|
23
|
+
};
|
24
|
+
})();
|
@@ -0,0 +1,41 @@
|
|
1
|
+
// From https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/keys
|
2
|
+
if (!Object.keys) {
|
3
|
+
Object.keys = (function () {
|
4
|
+
'use strict';
|
5
|
+
var hasOwnProperty = Object.prototype.hasOwnProperty,
|
6
|
+
hasDontEnumBug = !({toString: null}).propertyIsEnumerable('toString'),
|
7
|
+
dontEnums = [
|
8
|
+
'toString',
|
9
|
+
'toLocaleString',
|
10
|
+
'valueOf',
|
11
|
+
'hasOwnProperty',
|
12
|
+
'isPrototypeOf',
|
13
|
+
'propertyIsEnumerable',
|
14
|
+
'constructor'
|
15
|
+
],
|
16
|
+
dontEnumsLength = dontEnums.length;
|
17
|
+
|
18
|
+
return function (obj) {
|
19
|
+
if (typeof obj !== 'object' && (typeof obj !== 'function' || obj === null)) {
|
20
|
+
throw new TypeError('Object.keys called on non-object');
|
21
|
+
}
|
22
|
+
|
23
|
+
var result = [], prop, i;
|
24
|
+
|
25
|
+
for (prop in obj) {
|
26
|
+
if (hasOwnProperty.call(obj, prop)) {
|
27
|
+
result.push(prop);
|
28
|
+
}
|
29
|
+
}
|
30
|
+
|
31
|
+
if (hasDontEnumBug) {
|
32
|
+
for (i = 0; i < dontEnumsLength; i++) {
|
33
|
+
if (hasOwnProperty.call(obj, dontEnums[i])) {
|
34
|
+
result.push(dontEnums[i]);
|
35
|
+
}
|
36
|
+
}
|
37
|
+
}
|
38
|
+
return result;
|
39
|
+
};
|
40
|
+
}());
|
41
|
+
}
|
@@ -0,0 +1,113 @@
|
|
1
|
+
AmCharts.RB.Helpers = {
|
2
|
+
add_container_if_needed: function(id, width, height)
|
3
|
+
{
|
4
|
+
var container = document.getElementById(id);
|
5
|
+
|
6
|
+
if (!container) {
|
7
|
+
container = document.createElement("DIV");
|
8
|
+
container.className = 'chart';
|
9
|
+
container.id = id;
|
10
|
+
container.style.width = width + 'px';
|
11
|
+
container.style.height = height + 'px';
|
12
|
+
|
13
|
+
// Add the container before the last script
|
14
|
+
var scripts = document.getElementsByTagName('script');
|
15
|
+
var this_script = scripts[scripts.length - 1];
|
16
|
+
this_script.parentNode.insertBefore(container, this_script);
|
17
|
+
}
|
18
|
+
|
19
|
+
return container;
|
20
|
+
},
|
21
|
+
|
22
|
+
add_blanket: function(container, width, height)
|
23
|
+
{
|
24
|
+
var wrapper = document.createElement("DIV"),
|
25
|
+
blanket = document.createElement("DIV"),
|
26
|
+
blanket_container = document.createElement("DIV"),
|
27
|
+
blanket_outer = document.createElement("DIV"),
|
28
|
+
blanket_inner = document.createElement("DIV");
|
29
|
+
|
30
|
+
wrapper.className = 'chart-wrapper';
|
31
|
+
wrapper.id = container.id + "_wrapper";
|
32
|
+
wrapper.style.width = width + 'px';
|
33
|
+
wrapper.style.minHeight = height + 'px';
|
34
|
+
|
35
|
+
container.style.width = '100%';
|
36
|
+
blanket.className = 'chart-blanket';
|
37
|
+
blanket.style.display = 'none';
|
38
|
+
|
39
|
+
container.parentNode.insertBefore(wrapper, container);
|
40
|
+
|
41
|
+
blanket_inner.className = 'chart-blanket-inner';
|
42
|
+
|
43
|
+
blanket_outer.appendChild(blanket_inner);
|
44
|
+
blanket_container.appendChild(blanket_outer);
|
45
|
+
blanket.appendChild(blanket_container);
|
46
|
+
|
47
|
+
wrapper.appendChild(blanket);
|
48
|
+
wrapper.appendChild(container);
|
49
|
+
},
|
50
|
+
|
51
|
+
get_wrapper: function(container)
|
52
|
+
{
|
53
|
+
var wrapper = container;
|
54
|
+
while (wrapper && (" " + wrapper.className + " ").indexOf(" chart-wrapper ") < 0) {
|
55
|
+
wrapper = wrapper.parentElement;
|
56
|
+
}
|
57
|
+
|
58
|
+
return wrapper;
|
59
|
+
},
|
60
|
+
|
61
|
+
get_blanket: function(container)
|
62
|
+
{
|
63
|
+
var wrapper = this.get_wrapper(container);
|
64
|
+
return getElementsByClassName('chart-blanket', wrapper)[0];
|
65
|
+
},
|
66
|
+
|
67
|
+
add_loading_indicator: function(container, message, image_path) {
|
68
|
+
var loading_div = document.createElement("DIV"),
|
69
|
+
loading_image = document.createElement("IMG"),
|
70
|
+
loading = document.createTextNode(message),
|
71
|
+
blanket = this.get_blanket(container),
|
72
|
+
blanket_inner = blanket.childNodes[0].childNodes[0].childNodes[0];
|
73
|
+
|
74
|
+
loading_div.className = 'chart-loading';
|
75
|
+
loading_image.className = 'chart-loading-image';
|
76
|
+
loading_image.src = image_path;
|
77
|
+
|
78
|
+
loading_div.appendChild(loading);
|
79
|
+
|
80
|
+
blanket.style.display = '';
|
81
|
+
blanket_inner.innerHTML = "";
|
82
|
+
blanket_inner.appendChild(loading_div);
|
83
|
+
blanket_inner.appendChild(loading_image);
|
84
|
+
},
|
85
|
+
|
86
|
+
hide_loading_indicator: function(chart) {
|
87
|
+
var container = chart.container.div,
|
88
|
+
blanket = AmCharts.RB.Helpers.get_blanket(container);
|
89
|
+
|
90
|
+
if (blanket) blanket.style.display = 'none';
|
91
|
+
},
|
92
|
+
|
93
|
+
add_legend_div: function(id, main_div) {
|
94
|
+
var legend = document.getElementById(id);
|
95
|
+
|
96
|
+
if (!legend) {
|
97
|
+
legend = document.createElement("DIV");
|
98
|
+
legend.className = 'chart-legend';
|
99
|
+
legend.id = id;
|
100
|
+
legend.style.width = main_div.getWidth() + 'px';
|
101
|
+
|
102
|
+
var wrapper = main_div.parentNode;
|
103
|
+
if (main_div.nextSibling) {
|
104
|
+
wrapper.insertBefore(legend, main_div.nextSibling);
|
105
|
+
}
|
106
|
+
else {
|
107
|
+
wrapper.appendChild(legend);
|
108
|
+
}
|
109
|
+
}
|
110
|
+
|
111
|
+
return legend;
|
112
|
+
}
|
113
|
+
}
|