columbus3 0.2.1 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (199) hide show
  1. checksums.yaml +4 -4
  2. data/README.textile +62 -0
  3. data/bower_components/flot/.bower.json +19 -0
  4. data/bower_components/flot/.gitignore +3 -0
  5. data/bower_components/flot/.travis.yml +3 -0
  6. data/bower_components/flot/API.md +1498 -0
  7. data/bower_components/flot/CONTRIBUTING.md +98 -0
  8. data/bower_components/flot/FAQ.md +75 -0
  9. data/bower_components/flot/LICENSE.txt +22 -0
  10. data/bower_components/flot/Makefile +12 -0
  11. data/bower_components/flot/NEWS.md +1026 -0
  12. data/bower_components/flot/PLUGINS.md +143 -0
  13. data/bower_components/flot/README.md +110 -0
  14. data/bower_components/flot/component.json +8 -0
  15. data/bower_components/flot/examples/ajax/data-eu-gdp-growth-1.json +4 -0
  16. data/bower_components/flot/examples/ajax/data-eu-gdp-growth-2.json +4 -0
  17. data/bower_components/flot/examples/ajax/data-eu-gdp-growth-3.json +4 -0
  18. data/bower_components/flot/examples/ajax/data-eu-gdp-growth-4.json +4 -0
  19. data/bower_components/flot/examples/ajax/data-eu-gdp-growth-5.json +4 -0
  20. data/bower_components/flot/examples/ajax/data-eu-gdp-growth.json +4 -0
  21. data/bower_components/flot/examples/ajax/data-japan-gdp-growth.json +4 -0
  22. data/bower_components/flot/examples/ajax/data-usa-gdp-growth.json +4 -0
  23. data/bower_components/flot/examples/ajax/index.html +173 -0
  24. data/bower_components/flot/examples/annotating/index.html +87 -0
  25. data/bower_components/flot/examples/axes-interacting/index.html +97 -0
  26. data/bower_components/flot/examples/axes-multiple/index.html +77 -0
  27. data/bower_components/flot/examples/axes-time-zones/date.js +893 -0
  28. data/bower_components/flot/examples/axes-time-zones/index.html +114 -0
  29. data/bower_components/flot/examples/axes-time-zones/tz/africa +1181 -0
  30. data/bower_components/flot/examples/axes-time-zones/tz/antarctica +413 -0
  31. data/bower_components/flot/examples/axes-time-zones/tz/asia +2717 -0
  32. data/bower_components/flot/examples/axes-time-zones/tz/australasia +1719 -0
  33. data/bower_components/flot/examples/axes-time-zones/tz/backward +117 -0
  34. data/bower_components/flot/examples/axes-time-zones/tz/etcetera +81 -0
  35. data/bower_components/flot/examples/axes-time-zones/tz/europe +2856 -0
  36. data/bower_components/flot/examples/axes-time-zones/tz/factory +10 -0
  37. data/bower_components/flot/examples/axes-time-zones/tz/iso3166.tab +276 -0
  38. data/bower_components/flot/examples/axes-time-zones/tz/leapseconds +100 -0
  39. data/bower_components/flot/examples/axes-time-zones/tz/northamerica +3235 -0
  40. data/bower_components/flot/examples/axes-time-zones/tz/pacificnew +28 -0
  41. data/bower_components/flot/examples/axes-time-zones/tz/solar87 +390 -0
  42. data/bower_components/flot/examples/axes-time-zones/tz/solar88 +390 -0
  43. data/bower_components/flot/examples/axes-time-zones/tz/solar89 +395 -0
  44. data/bower_components/flot/examples/axes-time-zones/tz/southamerica +1711 -0
  45. data/bower_components/flot/examples/axes-time-zones/tz/systemv +38 -0
  46. data/bower_components/flot/examples/axes-time-zones/tz/yearistype.sh +38 -0
  47. data/bower_components/flot/examples/axes-time-zones/tz/zone.tab +441 -0
  48. data/bower_components/flot/examples/axes-time/index.html +137 -0
  49. data/bower_components/flot/examples/background.png +0 -0
  50. data/bower_components/flot/examples/basic-options/index.html +91 -0
  51. data/bower_components/flot/examples/basic-usage/index.html +57 -0
  52. data/bower_components/flot/examples/canvas/index.html +75 -0
  53. data/bower_components/flot/examples/categories/index.html +64 -0
  54. data/bower_components/flot/examples/examples.css +97 -0
  55. data/bower_components/flot/examples/image/hs-2004-27-a-large-web.jpg +0 -0
  56. data/bower_components/flot/examples/image/index.html +69 -0
  57. data/bower_components/flot/examples/index.html +80 -0
  58. data/bower_components/flot/examples/interacting/index.html +118 -0
  59. data/bower_components/flot/examples/navigate/arrow-down.gif +0 -0
  60. data/bower_components/flot/examples/navigate/arrow-left.gif +0 -0
  61. data/bower_components/flot/examples/navigate/arrow-right.gif +0 -0
  62. data/bower_components/flot/examples/navigate/arrow-up.gif +0 -0
  63. data/bower_components/flot/examples/navigate/index.html +153 -0
  64. data/bower_components/flot/examples/percentiles/index.html +79 -0
  65. data/bower_components/flot/examples/realtime/index.html +122 -0
  66. data/bower_components/flot/examples/resize/index.html +76 -0
  67. data/bower_components/flot/examples/selection/index.html +152 -0
  68. data/bower_components/flot/examples/series-errorbars/index.html +150 -0
  69. data/bower_components/flot/examples/series-pie/index.html +818 -0
  70. data/bower_components/flot/examples/series-toggle/index.html +121 -0
  71. data/bower_components/flot/examples/series-types/index.html +90 -0
  72. data/bower_components/flot/examples/shared/jquery-ui/jquery-ui.min.css +6 -0
  73. data/bower_components/flot/examples/stacking/index.html +107 -0
  74. data/bower_components/flot/examples/symbols/index.html +76 -0
  75. data/bower_components/flot/examples/threshold/index.html +76 -0
  76. data/bower_components/flot/examples/tracking/index.html +135 -0
  77. data/bower_components/flot/examples/visitors/index.html +147 -0
  78. data/bower_components/flot/examples/zooming/index.html +144 -0
  79. data/bower_components/flot/excanvas.js +1428 -0
  80. data/bower_components/flot/excanvas.min.js +1 -0
  81. data/bower_components/flot/flot.jquery.json +27 -0
  82. data/bower_components/flot/jquery.colorhelpers.js +180 -0
  83. data/bower_components/flot/jquery.flot.canvas.js +345 -0
  84. data/bower_components/flot/jquery.flot.categories.js +190 -0
  85. data/bower_components/flot/jquery.flot.crosshair.js +176 -0
  86. data/bower_components/flot/jquery.flot.errorbars.js +353 -0
  87. data/bower_components/flot/jquery.flot.fillbetween.js +226 -0
  88. data/bower_components/flot/jquery.flot.image.js +241 -0
  89. data/bower_components/flot/jquery.flot.js +3168 -0
  90. data/bower_components/flot/jquery.flot.navigate.js +346 -0
  91. data/bower_components/flot/jquery.flot.pie.js +820 -0
  92. data/bower_components/flot/jquery.flot.resize.js +59 -0
  93. data/bower_components/flot/jquery.flot.selection.js +360 -0
  94. data/bower_components/flot/jquery.flot.stack.js +188 -0
  95. data/bower_components/flot/jquery.flot.symbol.js +71 -0
  96. data/bower_components/flot/jquery.flot.threshold.js +142 -0
  97. data/bower_components/flot/jquery.flot.time.js +432 -0
  98. data/bower_components/flot/jquery.js +9472 -0
  99. data/bower_components/flot/package.json +11 -0
  100. data/bower_components/jquery/.bower.json +38 -0
  101. data/bower_components/jquery/MIT-LICENSE.txt +21 -0
  102. data/bower_components/jquery/bower.json +28 -0
  103. data/bower_components/jquery/dist/jquery.js +9210 -0
  104. data/bower_components/jquery/dist/jquery.min.js +5 -0
  105. data/bower_components/jquery/dist/jquery.min.map +1 -0
  106. data/bower_components/jquery/src/ajax.js +786 -0
  107. data/bower_components/jquery/src/ajax/jsonp.js +89 -0
  108. data/bower_components/jquery/src/ajax/load.js +75 -0
  109. data/bower_components/jquery/src/ajax/parseJSON.js +13 -0
  110. data/bower_components/jquery/src/ajax/parseXML.js +28 -0
  111. data/bower_components/jquery/src/ajax/script.js +64 -0
  112. data/bower_components/jquery/src/ajax/var/nonce.js +5 -0
  113. data/bower_components/jquery/src/ajax/var/rquery.js +3 -0
  114. data/bower_components/jquery/src/ajax/xhr.js +136 -0
  115. data/bower_components/jquery/src/attributes.js +11 -0
  116. data/bower_components/jquery/src/attributes/attr.js +141 -0
  117. data/bower_components/jquery/src/attributes/classes.js +158 -0
  118. data/bower_components/jquery/src/attributes/prop.js +94 -0
  119. data/bower_components/jquery/src/attributes/support.js +35 -0
  120. data/bower_components/jquery/src/attributes/val.js +161 -0
  121. data/bower_components/jquery/src/callbacks.js +205 -0
  122. data/bower_components/jquery/src/core.js +502 -0
  123. data/bower_components/jquery/src/core/access.js +60 -0
  124. data/bower_components/jquery/src/core/init.js +123 -0
  125. data/bower_components/jquery/src/core/parseHTML.js +39 -0
  126. data/bower_components/jquery/src/core/ready.js +97 -0
  127. data/bower_components/jquery/src/core/var/rsingleTag.js +4 -0
  128. data/bower_components/jquery/src/css.js +450 -0
  129. data/bower_components/jquery/src/css/addGetHookIf.js +22 -0
  130. data/bower_components/jquery/src/css/curCSS.js +57 -0
  131. data/bower_components/jquery/src/css/defaultDisplay.js +70 -0
  132. data/bower_components/jquery/src/css/hiddenVisibleSelectors.js +15 -0
  133. data/bower_components/jquery/src/css/support.js +96 -0
  134. data/bower_components/jquery/src/css/swap.js +28 -0
  135. data/bower_components/jquery/src/css/var/cssExpand.js +3 -0
  136. data/bower_components/jquery/src/css/var/getStyles.js +12 -0
  137. data/bower_components/jquery/src/css/var/isHidden.js +13 -0
  138. data/bower_components/jquery/src/css/var/rmargin.js +3 -0
  139. data/bower_components/jquery/src/css/var/rnumnonpx.js +5 -0
  140. data/bower_components/jquery/src/data.js +178 -0
  141. data/bower_components/jquery/src/data/Data.js +181 -0
  142. data/bower_components/jquery/src/data/accepts.js +20 -0
  143. data/bower_components/jquery/src/data/var/data_priv.js +5 -0
  144. data/bower_components/jquery/src/data/var/data_user.js +5 -0
  145. data/bower_components/jquery/src/deferred.js +149 -0
  146. data/bower_components/jquery/src/deprecated.js +13 -0
  147. data/bower_components/jquery/src/dimensions.js +50 -0
  148. data/bower_components/jquery/src/effects.js +648 -0
  149. data/bower_components/jquery/src/effects/Tween.js +114 -0
  150. data/bower_components/jquery/src/effects/animatedSelector.js +13 -0
  151. data/bower_components/jquery/src/event.js +868 -0
  152. data/bower_components/jquery/src/event/ajax.js +13 -0
  153. data/bower_components/jquery/src/event/alias.js +39 -0
  154. data/bower_components/jquery/src/event/support.js +9 -0
  155. data/bower_components/jquery/src/exports/amd.js +24 -0
  156. data/bower_components/jquery/src/exports/global.js +32 -0
  157. data/bower_components/jquery/src/intro.js +44 -0
  158. data/bower_components/jquery/src/jquery.js +37 -0
  159. data/bower_components/jquery/src/manipulation.js +580 -0
  160. data/bower_components/jquery/src/manipulation/_evalUrl.js +18 -0
  161. data/bower_components/jquery/src/manipulation/support.js +32 -0
  162. data/bower_components/jquery/src/manipulation/var/rcheckableType.js +3 -0
  163. data/bower_components/jquery/src/offset.js +207 -0
  164. data/bower_components/jquery/src/outro.js +1 -0
  165. data/bower_components/jquery/src/queue.js +142 -0
  166. data/bower_components/jquery/src/queue/delay.js +22 -0
  167. data/bower_components/jquery/src/selector-native.js +172 -0
  168. data/bower_components/jquery/src/selector-sizzle.js +14 -0
  169. data/bower_components/jquery/src/selector.js +1 -0
  170. data/bower_components/jquery/src/serialize.js +111 -0
  171. data/bower_components/jquery/src/sizzle/dist/sizzle.js +2067 -0
  172. data/bower_components/jquery/src/sizzle/dist/sizzle.min.js +3 -0
  173. data/bower_components/jquery/src/sizzle/dist/sizzle.min.map +1 -0
  174. data/bower_components/jquery/src/traversing.js +199 -0
  175. data/bower_components/jquery/src/traversing/findFilter.js +100 -0
  176. data/bower_components/jquery/src/traversing/var/rneedsContext.js +6 -0
  177. data/bower_components/jquery/src/var/arr.js +3 -0
  178. data/bower_components/jquery/src/var/class2type.js +4 -0
  179. data/bower_components/jquery/src/var/concat.js +5 -0
  180. data/bower_components/jquery/src/var/hasOwn.js +5 -0
  181. data/bower_components/jquery/src/var/indexOf.js +5 -0
  182. data/bower_components/jquery/src/var/pnum.js +3 -0
  183. data/bower_components/jquery/src/var/push.js +5 -0
  184. data/bower_components/jquery/src/var/rnotwhite.js +3 -0
  185. data/bower_components/jquery/src/var/slice.js +5 -0
  186. data/bower_components/jquery/src/var/strundefined.js +3 -0
  187. data/bower_components/jquery/src/var/support.js +4 -0
  188. data/bower_components/jquery/src/var/toString.js +5 -0
  189. data/bower_components/jquery/src/wrap.js +79 -0
  190. data/columbus3.gemspec +1 -1
  191. data/exe/columbus3 +72 -7
  192. data/lib/columbus3.rb +2 -1
  193. data/lib/columbus3/metadata/sidecar.rb +10 -1
  194. data/lib/columbus3/renderer/flot_renderer.rb +66 -0
  195. data/lib/columbus3/renderer/{renderer.rb → leaflet_renderer.rb} +0 -0
  196. data/lib/columbus3/version.rb +1 -1
  197. data/lib/html/flot.html.erb +106 -0
  198. metadata +194 -5
  199. data/README.md +0 -41
@@ -0,0 +1,87 @@
1
+ <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
2
+ <html>
3
+ <head>
4
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
5
+ <title>Flot Examples: Adding Annotations</title>
6
+ <link href="../examples.css" rel="stylesheet" type="text/css">
7
+ <!--[if lte IE 8]><script language="javascript" type="text/javascript" src="../../excanvas.min.js"></script><![endif]-->
8
+ <script language="javascript" type="text/javascript" src="../../jquery.js"></script>
9
+ <script language="javascript" type="text/javascript" src="../../jquery.flot.js"></script>
10
+ <script type="text/javascript">
11
+
12
+ $(function() {
13
+
14
+ var d1 = [];
15
+ for (var i = 0; i < 20; ++i) {
16
+ d1.push([i, Math.sin(i)]);
17
+ }
18
+
19
+ var data = [{ data: d1, label: "Pressure", color: "#333" }];
20
+
21
+ var markings = [
22
+ { color: "#f6f6f6", yaxis: { from: 1 } },
23
+ { color: "#f6f6f6", yaxis: { to: -1 } },
24
+ { color: "#000", lineWidth: 1, xaxis: { from: 2, to: 2 } },
25
+ { color: "#000", lineWidth: 1, xaxis: { from: 8, to: 8 } }
26
+ ];
27
+
28
+ var placeholder = $("#placeholder");
29
+
30
+ var plot = $.plot(placeholder, data, {
31
+ bars: { show: true, barWidth: 0.5, fill: 0.9 },
32
+ xaxis: { ticks: [], autoscaleMargin: 0.02 },
33
+ yaxis: { min: -2, max: 2 },
34
+ grid: { markings: markings }
35
+ });
36
+
37
+ var o = plot.pointOffset({ x: 2, y: -1.2});
38
+
39
+ // Append it to the placeholder that Flot already uses for positioning
40
+
41
+ placeholder.append("<div style='position:absolute;left:" + (o.left + 4) + "px;top:" + o.top + "px;color:#666;font-size:smaller'>Warming up</div>");
42
+
43
+ o = plot.pointOffset({ x: 8, y: -1.2});
44
+ placeholder.append("<div style='position:absolute;left:" + (o.left + 4) + "px;top:" + o.top + "px;color:#666;font-size:smaller'>Actual measurements</div>");
45
+
46
+ // Draw a little arrow on top of the last label to demonstrate canvas
47
+ // drawing
48
+
49
+ var ctx = plot.getCanvas().getContext("2d");
50
+ ctx.beginPath();
51
+ o.left += 4;
52
+ ctx.moveTo(o.left, o.top);
53
+ ctx.lineTo(o.left, o.top - 10);
54
+ ctx.lineTo(o.left + 10, o.top - 5);
55
+ ctx.lineTo(o.left, o.top);
56
+ ctx.fillStyle = "#000";
57
+ ctx.fill();
58
+
59
+ // Add the Flot version string to the footer
60
+
61
+ $("#footer").prepend("Flot " + $.plot.version + " &ndash; ");
62
+ });
63
+
64
+ </script>
65
+ </head>
66
+ <body>
67
+
68
+ <div id="header">
69
+ <h2>Adding Annotations</h2>
70
+ </div>
71
+
72
+ <div id="content">
73
+
74
+ <div class="demo-container">
75
+ <div id="placeholder" class="demo-placeholder"></div>
76
+ </div>
77
+
78
+ <p>Flot has support for simple background decorations such as lines and rectangles. They can be useful for marking up certain areas. You can easily add any HTML you need with standard DOM manipulation, e.g. for labels. For drawing custom shapes there is also direct access to the canvas.</p>
79
+
80
+ </div>
81
+
82
+ <div id="footer">
83
+ Copyright &copy; 2007 - 2014 IOLA and Ole Laursen
84
+ </div>
85
+
86
+ </body>
87
+ </html>
@@ -0,0 +1,97 @@
1
+ <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
2
+ <html>
3
+ <head>
4
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
5
+ <title>Flot Examples: Interacting with axes</title>
6
+ <link href="../examples.css" rel="stylesheet" type="text/css">
7
+ <!--[if lte IE 8]><script language="javascript" type="text/javascript" src="../../excanvas.min.js"></script><![endif]-->
8
+ <script language="javascript" type="text/javascript" src="../../jquery.js"></script>
9
+ <script language="javascript" type="text/javascript" src="../../jquery.flot.js"></script>
10
+ <script type="text/javascript">
11
+
12
+ $(function() {
13
+
14
+ function generate(start, end, fn) {
15
+ var res = [];
16
+ for (var i = 0; i <= 100; ++i) {
17
+ var x = start + i / 100 * (end - start);
18
+ res.push([x, fn(x)]);
19
+ }
20
+ return res;
21
+ }
22
+
23
+ var data = [
24
+ { data: generate(0, 10, function (x) { return Math.sqrt(x);}), xaxis: 1, yaxis:1 },
25
+ { data: generate(0, 10, function (x) { return Math.sin(x);}), xaxis: 1, yaxis:2 },
26
+ { data: generate(0, 10, function (x) { return Math.cos(x);}), xaxis: 1, yaxis:3 },
27
+ { data: generate(2, 10, function (x) { return Math.tan(x);}), xaxis: 2, yaxis: 4 }
28
+ ];
29
+
30
+ var plot = $.plot("#placeholder", data, {
31
+ xaxes: [
32
+ { position: 'bottom' },
33
+ { position: 'top'}
34
+ ],
35
+ yaxes: [
36
+ { position: 'left' },
37
+ { position: 'left' },
38
+ { position: 'right' },
39
+ { position: 'left' }
40
+ ]
41
+ });
42
+
43
+ // Create a div for each axis
44
+
45
+ $.each(plot.getAxes(), function (i, axis) {
46
+ if (!axis.show)
47
+ return;
48
+
49
+ var box = axis.box;
50
+
51
+ $("<div class='axisTarget' style='position:absolute; left:" + box.left + "px; top:" + box.top + "px; width:" + box.width + "px; height:" + box.height + "px'></div>")
52
+ .data("axis.direction", axis.direction)
53
+ .data("axis.n", axis.n)
54
+ .css({ backgroundColor: "#f00", opacity: 0, cursor: "pointer" })
55
+ .appendTo(plot.getPlaceholder())
56
+ .hover(
57
+ function () { $(this).css({ opacity: 0.10 }) },
58
+ function () { $(this).css({ opacity: 0 }) }
59
+ )
60
+ .click(function () {
61
+ $("#click").text("You clicked the " + axis.direction + axis.n + "axis!")
62
+ });
63
+ });
64
+
65
+ // Add the Flot version string to the footer
66
+
67
+ $("#footer").prepend("Flot " + $.plot.version + " &ndash; ");
68
+ });
69
+
70
+ </script>
71
+ </head>
72
+ <body>
73
+
74
+ <div id="header">
75
+ <h2>Interacting with axes</h2>
76
+ </div>
77
+
78
+ <div id="content">
79
+
80
+ <div class="demo-container">
81
+ <div id="placeholder" class="demo-placeholder"></div>
82
+ </div>
83
+
84
+ <p>With multiple axes, you sometimes need to interact with them. A simple way to do this is to draw the plot, deduce the axis placements and insert a couple of divs on top to catch events.</p>
85
+
86
+ <p>Try clicking an axis.</p>
87
+
88
+ <p id="click"></p>
89
+
90
+ </div>
91
+
92
+ <div id="footer">
93
+ Copyright &copy; 2007 - 2014 IOLA and Ole Laursen
94
+ </div>
95
+
96
+ </body>
97
+ </html>
@@ -0,0 +1,77 @@
1
+ <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
2
+ <html>
3
+ <head>
4
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
5
+ <title>Flot Examples: Multiple Axes</title>
6
+ <link href="../examples.css" rel="stylesheet" type="text/css">
7
+ <!--[if lte IE 8]><script language="javascript" type="text/javascript" src="../../excanvas.min.js"></script><![endif]-->
8
+ <script language="javascript" type="text/javascript" src="../../jquery.js"></script>
9
+ <script language="javascript" type="text/javascript" src="../../jquery.flot.js"></script>
10
+ <script language="javascript" type="text/javascript" src="../../jquery.flot.time.js"></script>
11
+ <script type="text/javascript">
12
+
13
+ $(function() {
14
+
15
+ var oilprices = [[1167692400000,61.05], [1167778800000,58.32], [1167865200000,57.35], [1167951600000,56.31], [1168210800000,55.55], [1168297200000,55.64], [1168383600000,54.02], [1168470000000,51.88], [1168556400000,52.99], [1168815600000,52.99], [1168902000000,51.21], [1168988400000,52.24], [1169074800000,50.48], [1169161200000,51.99], [1169420400000,51.13], [1169506800000,55.04], [1169593200000,55.37], [1169679600000,54.23], [1169766000000,55.42], [1170025200000,54.01], [1170111600000,56.97], [1170198000000,58.14], [1170284400000,58.14], [1170370800000,59.02], [1170630000000,58.74], [1170716400000,58.88], [1170802800000,57.71], [1170889200000,59.71], [1170975600000,59.89], [1171234800000,57.81], [1171321200000,59.06], [1171407600000,58.00], [1171494000000,57.99], [1171580400000,59.39], [1171839600000,59.39], [1171926000000,58.07], [1172012400000,60.07], [1172098800000,61.14], [1172444400000,61.39], [1172530800000,61.46], [1172617200000,61.79], [1172703600000,62.00], [1172790000000,60.07], [1173135600000,60.69], [1173222000000,61.82], [1173308400000,60.05], [1173654000000,58.91], [1173740400000,57.93], [1173826800000,58.16], [1173913200000,57.55], [1173999600000,57.11], [1174258800000,56.59], [1174345200000,59.61], [1174518000000,61.69], [1174604400000,62.28], [1174860000000,62.91], [1174946400000,62.93], [1175032800000,64.03], [1175119200000,66.03], [1175205600000,65.87], [1175464800000,64.64], [1175637600000,64.38], [1175724000000,64.28], [1175810400000,64.28], [1176069600000,61.51], [1176156000000,61.89], [1176242400000,62.01], [1176328800000,63.85], [1176415200000,63.63], [1176674400000,63.61], [1176760800000,63.10], [1176847200000,63.13], [1176933600000,61.83], [1177020000000,63.38], [1177279200000,64.58], [1177452000000,65.84], [1177538400000,65.06], [1177624800000,66.46], [1177884000000,64.40], [1178056800000,63.68], [1178143200000,63.19], [1178229600000,61.93], [1178488800000,61.47], [1178575200000,61.55], [1178748000000,61.81], [1178834400000,62.37], [1179093600000,62.46], [1179180000000,63.17], [1179266400000,62.55], [1179352800000,64.94], [1179698400000,66.27], [1179784800000,65.50], [1179871200000,65.77], [1179957600000,64.18], [1180044000000,65.20], [1180389600000,63.15], [1180476000000,63.49], [1180562400000,65.08], [1180908000000,66.30], [1180994400000,65.96], [1181167200000,66.93], [1181253600000,65.98], [1181599200000,65.35], [1181685600000,66.26], [1181858400000,68.00], [1182117600000,69.09], [1182204000000,69.10], [1182290400000,68.19], [1182376800000,68.19], [1182463200000,69.14], [1182722400000,68.19], [1182808800000,67.77], [1182895200000,68.97], [1182981600000,69.57], [1183068000000,70.68], [1183327200000,71.09], [1183413600000,70.92], [1183586400000,71.81], [1183672800000,72.81], [1183932000000,72.19], [1184018400000,72.56], [1184191200000,72.50], [1184277600000,74.15], [1184623200000,75.05], [1184796000000,75.92], [1184882400000,75.57], [1185141600000,74.89], [1185228000000,73.56], [1185314400000,75.57], [1185400800000,74.95], [1185487200000,76.83], [1185832800000,78.21], [1185919200000,76.53], [1186005600000,76.86], [1186092000000,76.00], [1186437600000,71.59], [1186696800000,71.47], [1186956000000,71.62], [1187042400000,71.00], [1187301600000,71.98], [1187560800000,71.12], [1187647200000,69.47], [1187733600000,69.26], [1187820000000,69.83], [1187906400000,71.09], [1188165600000,71.73], [1188338400000,73.36], [1188511200000,74.04], [1188856800000,76.30], [1189116000000,77.49], [1189461600000,78.23], [1189548000000,79.91], [1189634400000,80.09], [1189720800000,79.10], [1189980000000,80.57], [1190066400000,81.93], [1190239200000,83.32], [1190325600000,81.62], [1190584800000,80.95], [1190671200000,79.53], [1190757600000,80.30], [1190844000000,82.88], [1190930400000,81.66], [1191189600000,80.24], [1191276000000,80.05], [1191362400000,79.94], [1191448800000,81.44], [1191535200000,81.22], [1191794400000,79.02], [1191880800000,80.26], [1191967200000,80.30], [1192053600000,83.08], [1192140000000,83.69], [1192399200000,86.13], [1192485600000,87.61], [1192572000000,87.40], [1192658400000,89.47], [1192744800000,88.60], [1193004000000,87.56], [1193090400000,87.56], [1193176800000,87.10], [1193263200000,91.86], [1193612400000,93.53], [1193698800000,94.53], [1193871600000,95.93], [1194217200000,93.98], [1194303600000,96.37], [1194476400000,95.46], [1194562800000,96.32], [1195081200000,93.43], [1195167600000,95.10], [1195426800000,94.64], [1195513200000,95.10], [1196031600000,97.70], [1196118000000,94.42], [1196204400000,90.62], [1196290800000,91.01], [1196377200000,88.71], [1196636400000,88.32], [1196809200000,90.23], [1196982000000,88.28], [1197241200000,87.86], [1197327600000,90.02], [1197414000000,92.25], [1197586800000,90.63], [1197846000000,90.63], [1197932400000,90.49], [1198018800000,91.24], [1198105200000,91.06], [1198191600000,90.49], [1198710000000,96.62], [1198796400000,96.00], [1199142000000,99.62], [1199314800000,99.18], [1199401200000,95.09], [1199660400000,96.33], [1199833200000,95.67], [1200351600000,91.90], [1200438000000,90.84], [1200524400000,90.13], [1200610800000,90.57], [1200956400000,89.21], [1201042800000,86.99], [1201129200000,89.85], [1201474800000,90.99], [1201561200000,91.64], [1201647600000,92.33], [1201734000000,91.75], [1202079600000,90.02], [1202166000000,88.41], [1202252400000,87.14], [1202338800000,88.11], [1202425200000,91.77], [1202770800000,92.78], [1202857200000,93.27], [1202943600000,95.46], [1203030000000,95.46], [1203289200000,101.74], [1203462000000,98.81], [1203894000000,100.88], [1204066800000,99.64], [1204153200000,102.59], [1204239600000,101.84], [1204498800000,99.52], [1204585200000,99.52], [1204671600000,104.52], [1204758000000,105.47], [1204844400000,105.15], [1205103600000,108.75], [1205276400000,109.92], [1205362800000,110.33], [1205449200000,110.21], [1205708400000,105.68], [1205967600000,101.84], [1206313200000,100.86], [1206399600000,101.22], [1206486000000,105.90], [1206572400000,107.58], [1206658800000,105.62], [1206914400000,101.58], [1207000800000,100.98], [1207173600000,103.83], [1207260000000,106.23], [1207605600000,108.50], [1207778400000,110.11], [1207864800000,110.14], [1208210400000,113.79], [1208296800000,114.93], [1208383200000,114.86], [1208728800000,117.48], [1208815200000,118.30], [1208988000000,116.06], [1209074400000,118.52], [1209333600000,118.75], [1209420000000,113.46], [1209592800000,112.52], [1210024800000,121.84], [1210111200000,123.53], [1210197600000,123.69], [1210543200000,124.23], [1210629600000,125.80], [1210716000000,126.29], [1211148000000,127.05], [1211320800000,129.07], [1211493600000,132.19], [1211839200000,128.85], [1212357600000,127.76], [1212703200000,138.54], [1212962400000,136.80], [1213135200000,136.38], [1213308000000,134.86], [1213653600000,134.01], [1213740000000,136.68], [1213912800000,135.65], [1214172000000,134.62], [1214258400000,134.62], [1214344800000,134.62], [1214431200000,139.64], [1214517600000,140.21], [1214776800000,140.00], [1214863200000,140.97], [1214949600000,143.57], [1215036000000,145.29], [1215381600000,141.37], [1215468000000,136.04], [1215727200000,146.40], [1215986400000,145.18], [1216072800000,138.74], [1216159200000,134.60], [1216245600000,129.29], [1216332000000,130.65], [1216677600000,127.95], [1216850400000,127.95], [1217282400000,122.19], [1217455200000,124.08], [1217541600000,125.10], [1217800800000,121.41], [1217887200000,119.17], [1217973600000,118.58], [1218060000000,120.02], [1218405600000,114.45], [1218492000000,113.01], [1218578400000,116.00], [1218751200000,113.77], [1219010400000,112.87], [1219096800000,114.53], [1219269600000,114.98], [1219356000000,114.98], [1219701600000,116.27], [1219788000000,118.15], [1219874400000,115.59], [1219960800000,115.46], [1220306400000,109.71], [1220392800000,109.35], [1220565600000,106.23], [1220824800000,106.34]];
16
+
17
+ var exchangerates = [[1167606000000,0.7580], [1167692400000,0.7580], [1167778800000,0.75470], [1167865200000,0.75490], [1167951600000,0.76130], [1168038000000,0.76550], [1168124400000,0.76930], [1168210800000,0.76940], [1168297200000,0.76880], [1168383600000,0.76780], [1168470000000,0.77080], [1168556400000,0.77270], [1168642800000,0.77490], [1168729200000,0.77410], [1168815600000,0.77410], [1168902000000,0.77320], [1168988400000,0.77270], [1169074800000,0.77370], [1169161200000,0.77240], [1169247600000,0.77120], [1169334000000,0.7720], [1169420400000,0.77210], [1169506800000,0.77170], [1169593200000,0.77040], [1169679600000,0.7690], [1169766000000,0.77110], [1169852400000,0.7740], [1169938800000,0.77450], [1170025200000,0.77450], [1170111600000,0.7740], [1170198000000,0.77160], [1170284400000,0.77130], [1170370800000,0.76780], [1170457200000,0.76880], [1170543600000,0.77180], [1170630000000,0.77180], [1170716400000,0.77280], [1170802800000,0.77290], [1170889200000,0.76980], [1170975600000,0.76850], [1171062000000,0.76810], [1171148400000,0.7690], [1171234800000,0.7690], [1171321200000,0.76980], [1171407600000,0.76990], [1171494000000,0.76510], [1171580400000,0.76130], [1171666800000,0.76160], [1171753200000,0.76140], [1171839600000,0.76140], [1171926000000,0.76070], [1172012400000,0.76020], [1172098800000,0.76110], [1172185200000,0.76220], [1172271600000,0.76150], [1172358000000,0.75980], [1172444400000,0.75980], [1172530800000,0.75920], [1172617200000,0.75730], [1172703600000,0.75660], [1172790000000,0.75670], [1172876400000,0.75910], [1172962800000,0.75820], [1173049200000,0.75850], [1173135600000,0.76130], [1173222000000,0.76310], [1173308400000,0.76150], [1173394800000,0.760], [1173481200000,0.76130], [1173567600000,0.76270], [1173654000000,0.76270], [1173740400000,0.76080], [1173826800000,0.75830], [1173913200000,0.75750], [1173999600000,0.75620], [1174086000000,0.7520], [1174172400000,0.75120], [1174258800000,0.75120], [1174345200000,0.75170], [1174431600000,0.7520], [1174518000000,0.75110], [1174604400000,0.7480], [1174690800000,0.75090], [1174777200000,0.75310], [1174860000000,0.75310], [1174946400000,0.75270], [1175032800000,0.74980], [1175119200000,0.74930], [1175205600000,0.75040], [1175292000000,0.750], [1175378400000,0.74910], [1175464800000,0.74910], [1175551200000,0.74850], [1175637600000,0.74840], [1175724000000,0.74920], [1175810400000,0.74710], [1175896800000,0.74590], [1175983200000,0.74770], [1176069600000,0.74770], [1176156000000,0.74830], [1176242400000,0.74580], [1176328800000,0.74480], [1176415200000,0.7430], [1176501600000,0.73990], [1176588000000,0.73950], [1176674400000,0.73950], [1176760800000,0.73780], [1176847200000,0.73820], [1176933600000,0.73620], [1177020000000,0.73550], [1177106400000,0.73480], [1177192800000,0.73610], [1177279200000,0.73610], [1177365600000,0.73650], [1177452000000,0.73620], [1177538400000,0.73310], [1177624800000,0.73390], [1177711200000,0.73440], [1177797600000,0.73270], [1177884000000,0.73270], [1177970400000,0.73360], [1178056800000,0.73330], [1178143200000,0.73590], [1178229600000,0.73590], [1178316000000,0.73720], [1178402400000,0.7360], [1178488800000,0.7360], [1178575200000,0.7350], [1178661600000,0.73650], [1178748000000,0.73840], [1178834400000,0.73950], [1178920800000,0.74130], [1179007200000,0.73970], [1179093600000,0.73960], [1179180000000,0.73850], [1179266400000,0.73780], [1179352800000,0.73660], [1179439200000,0.740], [1179525600000,0.74110], [1179612000000,0.74060], [1179698400000,0.74050], [1179784800000,0.74140], [1179871200000,0.74310], [1179957600000,0.74310], [1180044000000,0.74380], [1180130400000,0.74430], [1180216800000,0.74430], [1180303200000,0.74430], [1180389600000,0.74340], [1180476000000,0.74290], [1180562400000,0.74420], [1180648800000,0.7440], [1180735200000,0.74390], [1180821600000,0.74370], [1180908000000,0.74370], [1180994400000,0.74290], [1181080800000,0.74030], [1181167200000,0.73990], [1181253600000,0.74180], [1181340000000,0.74680], [1181426400000,0.7480], [1181512800000,0.7480], [1181599200000,0.7490], [1181685600000,0.74940], [1181772000000,0.75220], [1181858400000,0.75150], [1181944800000,0.75020], [1182031200000,0.74720], [1182117600000,0.74720], [1182204000000,0.74620], [1182290400000,0.74550], [1182376800000,0.74490], [1182463200000,0.74670], [1182549600000,0.74580], [1182636000000,0.74270], [1182722400000,0.74270], [1182808800000,0.7430], [1182895200000,0.74290], [1182981600000,0.7440], [1183068000000,0.7430], [1183154400000,0.74220], [1183240800000,0.73880], [1183327200000,0.73880], [1183413600000,0.73690], [1183500000000,0.73450], [1183586400000,0.73450], [1183672800000,0.73450], [1183759200000,0.73520], [1183845600000,0.73410], [1183932000000,0.73410], [1184018400000,0.7340], [1184104800000,0.73240], [1184191200000,0.72720], [1184277600000,0.72640], [1184364000000,0.72550], [1184450400000,0.72580], [1184536800000,0.72580], [1184623200000,0.72560], [1184709600000,0.72570], [1184796000000,0.72470], [1184882400000,0.72430], [1184968800000,0.72440], [1185055200000,0.72350], [1185141600000,0.72350], [1185228000000,0.72350], [1185314400000,0.72350], [1185400800000,0.72620], [1185487200000,0.72880], [1185573600000,0.73010], [1185660000000,0.73370], [1185746400000,0.73370], [1185832800000,0.73240], [1185919200000,0.72970], [1186005600000,0.73170], [1186092000000,0.73150], [1186178400000,0.72880], [1186264800000,0.72630], [1186351200000,0.72630], [1186437600000,0.72420], [1186524000000,0.72530], [1186610400000,0.72640], [1186696800000,0.7270], [1186783200000,0.73120], [1186869600000,0.73050], [1186956000000,0.73050], [1187042400000,0.73180], [1187128800000,0.73580], [1187215200000,0.74090], [1187301600000,0.74540], [1187388000000,0.74370], [1187474400000,0.74240], [1187560800000,0.74240], [1187647200000,0.74150], [1187733600000,0.74190], [1187820000000,0.74140], [1187906400000,0.73770], [1187992800000,0.73550], [1188079200000,0.73150], [1188165600000,0.73150], [1188252000000,0.7320], [1188338400000,0.73320], [1188424800000,0.73460], [1188511200000,0.73280], [1188597600000,0.73230], [1188684000000,0.7340], [1188770400000,0.7340], [1188856800000,0.73360], [1188943200000,0.73510], [1189029600000,0.73460], [1189116000000,0.73210], [1189202400000,0.72940], [1189288800000,0.72660], [1189375200000,0.72660], [1189461600000,0.72540], [1189548000000,0.72420], [1189634400000,0.72130], [1189720800000,0.71970], [1189807200000,0.72090], [1189893600000,0.7210], [1189980000000,0.7210], [1190066400000,0.7210], [1190152800000,0.72090], [1190239200000,0.71590], [1190325600000,0.71330], [1190412000000,0.71050], [1190498400000,0.70990], [1190584800000,0.70990], [1190671200000,0.70930], [1190757600000,0.70930], [1190844000000,0.70760], [1190930400000,0.7070], [1191016800000,0.70490], [1191103200000,0.70120], [1191189600000,0.70110], [1191276000000,0.70190], [1191362400000,0.70460], [1191448800000,0.70630], [1191535200000,0.70890], [1191621600000,0.70770], [1191708000000,0.70770], [1191794400000,0.70770], [1191880800000,0.70910], [1191967200000,0.71180], [1192053600000,0.70790], [1192140000000,0.70530], [1192226400000,0.7050], [1192312800000,0.70550], [1192399200000,0.70550], [1192485600000,0.70450], [1192572000000,0.70510], [1192658400000,0.70510], [1192744800000,0.70170], [1192831200000,0.70], [1192917600000,0.69950], [1193004000000,0.69940], [1193090400000,0.70140], [1193176800000,0.70360], [1193263200000,0.70210], [1193349600000,0.70020], [1193436000000,0.69670], [1193522400000,0.6950], [1193612400000,0.6950], [1193698800000,0.69390], [1193785200000,0.6940], [1193871600000,0.69220], [1193958000000,0.69190], [1194044400000,0.69140], [1194130800000,0.68940], [1194217200000,0.68910], [1194303600000,0.69040], [1194390000000,0.6890], [1194476400000,0.68340], [1194562800000,0.68230], [1194649200000,0.68070], [1194735600000,0.68150], [1194822000000,0.68150], [1194908400000,0.68470], [1194994800000,0.68590], [1195081200000,0.68220], [1195167600000,0.68270], [1195254000000,0.68370], [1195340400000,0.68230], [1195426800000,0.68220], [1195513200000,0.68220], [1195599600000,0.67920], [1195686000000,0.67460], [1195772400000,0.67350], [1195858800000,0.67310], [1195945200000,0.67420], [1196031600000,0.67440], [1196118000000,0.67390], [1196204400000,0.67310], [1196290800000,0.67610], [1196377200000,0.67610], [1196463600000,0.67850], [1196550000000,0.68180], [1196636400000,0.68360], [1196722800000,0.68230], [1196809200000,0.68050], [1196895600000,0.67930], [1196982000000,0.68490], [1197068400000,0.68330], [1197154800000,0.68250], [1197241200000,0.68250], [1197327600000,0.68160], [1197414000000,0.67990], [1197500400000,0.68130], [1197586800000,0.68090], [1197673200000,0.68680], [1197759600000,0.69330], [1197846000000,0.69330], [1197932400000,0.69450], [1198018800000,0.69440], [1198105200000,0.69460], [1198191600000,0.69640], [1198278000000,0.69650], [1198364400000,0.69560], [1198450800000,0.69560], [1198537200000,0.6950], [1198623600000,0.69480], [1198710000000,0.69280], [1198796400000,0.68870], [1198882800000,0.68240], [1198969200000,0.67940], [1199055600000,0.67940], [1199142000000,0.68030], [1199228400000,0.68550], [1199314800000,0.68240], [1199401200000,0.67910], [1199487600000,0.67830], [1199574000000,0.67850], [1199660400000,0.67850], [1199746800000,0.67970], [1199833200000,0.680], [1199919600000,0.68030], [1200006000000,0.68050], [1200092400000,0.6760], [1200178800000,0.6770], [1200265200000,0.6770], [1200351600000,0.67360], [1200438000000,0.67260], [1200524400000,0.67640], [1200610800000,0.68210], [1200697200000,0.68310], [1200783600000,0.68420], [1200870000000,0.68420], [1200956400000,0.68870], [1201042800000,0.69030], [1201129200000,0.68480], [1201215600000,0.68240], [1201302000000,0.67880], [1201388400000,0.68140], [1201474800000,0.68140], [1201561200000,0.67970], [1201647600000,0.67690], [1201734000000,0.67650], [1201820400000,0.67330], [1201906800000,0.67290], [1201993200000,0.67580], [1202079600000,0.67580], [1202166000000,0.6750], [1202252400000,0.6780], [1202338800000,0.68330], [1202425200000,0.68560], [1202511600000,0.69030], [1202598000000,0.68960], [1202684400000,0.68960], [1202770800000,0.68820], [1202857200000,0.68790], [1202943600000,0.68620], [1203030000000,0.68520], [1203116400000,0.68230], [1203202800000,0.68130], [1203289200000,0.68130], [1203375600000,0.68220], [1203462000000,0.68020], [1203548400000,0.68020], [1203634800000,0.67840], [1203721200000,0.67480], [1203807600000,0.67470], [1203894000000,0.67470], [1203980400000,0.67480], [1204066800000,0.67330], [1204153200000,0.6650], [1204239600000,0.66110], [1204326000000,0.65830], [1204412400000,0.6590], [1204498800000,0.6590], [1204585200000,0.65810], [1204671600000,0.65780], [1204758000000,0.65740], [1204844400000,0.65320], [1204930800000,0.65020], [1205017200000,0.65140], [1205103600000,0.65140], [1205190000000,0.65070], [1205276400000,0.6510], [1205362800000,0.64890], [1205449200000,0.64240], [1205535600000,0.64060], [1205622000000,0.63820], [1205708400000,0.63820], [1205794800000,0.63410], [1205881200000,0.63440], [1205967600000,0.63780], [1206054000000,0.64390], [1206140400000,0.64780], [1206226800000,0.64810], [1206313200000,0.64810], [1206399600000,0.64940], [1206486000000,0.64380], [1206572400000,0.63770], [1206658800000,0.63290], [1206745200000,0.63360], [1206831600000,0.63330], [1206914400000,0.63330], [1207000800000,0.6330], [1207087200000,0.63710], [1207173600000,0.64030], [1207260000000,0.63960], [1207346400000,0.63640], [1207432800000,0.63560], [1207519200000,0.63560], [1207605600000,0.63680], [1207692000000,0.63570], [1207778400000,0.63540], [1207864800000,0.6320], [1207951200000,0.63320], [1208037600000,0.63280], [1208124000000,0.63310], [1208210400000,0.63420], [1208296800000,0.63210], [1208383200000,0.63020], [1208469600000,0.62780], [1208556000000,0.63080], [1208642400000,0.63240], [1208728800000,0.63240], [1208815200000,0.63070], [1208901600000,0.62770], [1208988000000,0.62690], [1209074400000,0.63350], [1209160800000,0.63920], [1209247200000,0.640], [1209333600000,0.64010], [1209420000000,0.63960], [1209506400000,0.64070], [1209592800000,0.64230], [1209679200000,0.64290], [1209765600000,0.64720], [1209852000000,0.64850], [1209938400000,0.64860], [1210024800000,0.64670], [1210111200000,0.64440], [1210197600000,0.64670], [1210284000000,0.65090], [1210370400000,0.64780], [1210456800000,0.64610], [1210543200000,0.64610], [1210629600000,0.64680], [1210716000000,0.64490], [1210802400000,0.6470], [1210888800000,0.64610], [1210975200000,0.64520], [1211061600000,0.64220], [1211148000000,0.64220], [1211234400000,0.64250], [1211320800000,0.64140], [1211407200000,0.63660], [1211493600000,0.63460], [1211580000000,0.6350], [1211666400000,0.63460], [1211752800000,0.63460], [1211839200000,0.63430], [1211925600000,0.63460], [1212012000000,0.63790], [1212098400000,0.64160], [1212184800000,0.64420], [1212271200000,0.64310], [1212357600000,0.64310], [1212444000000,0.64350], [1212530400000,0.6440], [1212616800000,0.64730], [1212703200000,0.64690], [1212789600000,0.63860], [1212876000000,0.63560], [1212962400000,0.6340], [1213048800000,0.63460], [1213135200000,0.6430], [1213221600000,0.64520], [1213308000000,0.64670], [1213394400000,0.65060], [1213480800000,0.65040], [1213567200000,0.65030], [1213653600000,0.64810], [1213740000000,0.64510], [1213826400000,0.6450], [1213912800000,0.64410], [1213999200000,0.64140], [1214085600000,0.64090], [1214172000000,0.64090], [1214258400000,0.64280], [1214344800000,0.64310], [1214431200000,0.64180], [1214517600000,0.63710], [1214604000000,0.63490], [1214690400000,0.63330], [1214776800000,0.63340], [1214863200000,0.63380], [1214949600000,0.63420], [1215036000000,0.6320], [1215122400000,0.63180], [1215208800000,0.6370], [1215295200000,0.63680], [1215381600000,0.63680], [1215468000000,0.63830], [1215554400000,0.63710], [1215640800000,0.63710], [1215727200000,0.63550], [1215813600000,0.6320], [1215900000000,0.62770], [1215986400000,0.62760], [1216072800000,0.62910], [1216159200000,0.62740], [1216245600000,0.62930], [1216332000000,0.63110], [1216418400000,0.6310], [1216504800000,0.63120], [1216591200000,0.63120], [1216677600000,0.63040], [1216764000000,0.62940], [1216850400000,0.63480], [1216936800000,0.63780], [1217023200000,0.63680], [1217109600000,0.63680], [1217196000000,0.63680], [1217282400000,0.6360], [1217368800000,0.6370], [1217455200000,0.64180], [1217541600000,0.64110], [1217628000000,0.64350], [1217714400000,0.64270], [1217800800000,0.64270], [1217887200000,0.64190], [1217973600000,0.64460], [1218060000000,0.64680], [1218146400000,0.64870], [1218232800000,0.65940], [1218319200000,0.66660], [1218405600000,0.66660], [1218492000000,0.66780], [1218578400000,0.67120], [1218664800000,0.67050], [1218751200000,0.67180], [1218837600000,0.67840], [1218924000000,0.68110], [1219010400000,0.68110], [1219096800000,0.67940], [1219183200000,0.68040], [1219269600000,0.67810], [1219356000000,0.67560], [1219442400000,0.67350], [1219528800000,0.67630], [1219615200000,0.67620], [1219701600000,0.67770], [1219788000000,0.68150], [1219874400000,0.68020], [1219960800000,0.6780], [1220047200000,0.67960], [1220133600000,0.68170], [1220220000000,0.68170], [1220306400000,0.68320], [1220392800000,0.68770], [1220479200000,0.69120], [1220565600000,0.69140], [1220652000000,0.70090], [1220738400000,0.70120], [1220824800000,0.7010], [1220911200000,0.70050]];
18
+
19
+ function euroFormatter(v, axis) {
20
+ return v.toFixed(axis.tickDecimals) + "€";
21
+ }
22
+
23
+ function doPlot(position) {
24
+ $.plot("#placeholder", [
25
+ { data: oilprices, label: "Oil price ($)" },
26
+ { data: exchangerates, label: "USD/EUR exchange rate", yaxis: 2 }
27
+ ], {
28
+ xaxes: [ { mode: "time" } ],
29
+ yaxes: [ { min: 0 }, {
30
+ // align if we are to the right
31
+ alignTicksWithAxis: position == "right" ? 1 : null,
32
+ position: position,
33
+ tickFormatter: euroFormatter
34
+ } ],
35
+ legend: { position: "sw" }
36
+ });
37
+ }
38
+
39
+ doPlot("right");
40
+
41
+ $("button").click(function () {
42
+ doPlot($(this).text());
43
+ });
44
+
45
+ // Add the Flot version string to the footer
46
+
47
+ $("#footer").prepend("Flot " + $.plot.version + " &ndash; ");
48
+ });
49
+
50
+ </script>
51
+ </head>
52
+ <body>
53
+
54
+ <div id="header">
55
+ <h2>Multiple axes</h2>
56
+ </div>
57
+
58
+ <div id="content">
59
+
60
+ <div class="demo-container">
61
+ <div id="placeholder" class="demo-placeholder"></div>
62
+ </div>
63
+
64
+ <p>Multiple axis support showing the raw oil price in US $/barrel of crude oil vs. the exchange rate from US $ to €.</p>
65
+
66
+ <p>As illustrated, you can put in multiple axes if you need to. For each data series, simply specify the axis number. In the options, you can then configure where you want the extra axes to appear.</p>
67
+
68
+ <p>Position axis <button>left</button> or <button>right</button>.</p>
69
+
70
+ </div>
71
+
72
+ <div id="footer">
73
+ Copyright &copy; 2007 - 2014 IOLA and Ole Laursen
74
+ </div>
75
+
76
+ </body>
77
+ </html>
@@ -0,0 +1,893 @@
1
+ // -----
2
+ // The `timezoneJS.Date` object gives you full-blown timezone support, independent from the timezone set on the end-user's machine running the browser. It uses the Olson zoneinfo files for its timezone data.
3
+ //
4
+ // The constructor function and setter methods use proxy JavaScript Date objects behind the scenes, so you can use strings like '10/22/2006' with the constructor. You also get the same sensible wraparound behavior with numeric parameters (like setting a value of 14 for the month wraps around to the next March).
5
+ //
6
+ // The other significant difference from the built-in JavaScript Date is that `timezoneJS.Date` also has named properties that store the values of year, month, date, etc., so it can be directly serialized to JSON and used for data transfer.
7
+
8
+ /*
9
+ * Copyright 2010 Matthew Eernisse (mde@fleegix.org)
10
+ * and Open Source Applications Foundation
11
+ *
12
+ * Licensed under the Apache License, Version 2.0 (the "License");
13
+ * you may not use this file except in compliance with the License.
14
+ * You may obtain a copy of the License at
15
+ *
16
+ * http://www.apache.org/licenses/LICENSE-2.0
17
+ *
18
+ * Unless required by applicable law or agreed to in writing, software
19
+ * distributed under the License is distributed on an "AS IS" BASIS,
20
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
21
+ * See the License for the specific language governing permissions and
22
+ * limitations under the License.
23
+ *
24
+ * Credits: Ideas included from incomplete JS implementation of Olson
25
+ * parser, "XMLDAte" by Philippe Goetz (philippe.goetz@wanadoo.fr)
26
+ *
27
+ * Contributions:
28
+ * Jan Niehusmann
29
+ * Ricky Romero
30
+ * Preston Hunt (prestonhunt@gmail.com)
31
+ * Dov. B Katz (dov.katz@morganstanley.com)
32
+ * Peter Bergström (pbergstr@mac.com)
33
+ * Long Ho
34
+ */
35
+ (function () {
36
+ // Standard initialization stuff to make sure the library is
37
+ // usable on both client and server (node) side.
38
+
39
+ var root = this;
40
+
41
+ var timezoneJS;
42
+ if (typeof exports !== 'undefined') {
43
+ timezoneJS = exports;
44
+ } else {
45
+ timezoneJS = root.timezoneJS = {};
46
+ }
47
+
48
+ timezoneJS.VERSION = '1.0.0';
49
+
50
+ // Grab the ajax library from global context.
51
+ // This can be jQuery, Zepto or fleegix.
52
+ // You can also specify your own transport mechanism by declaring
53
+ // `timezoneJS.timezone.transport` to a `function`. More details will follow
54
+ var $ = root.$ || root.jQuery || root.Zepto
55
+ , fleegix = root.fleegix
56
+ // Declare constant list of days and months. Unfortunately this doesn't leave room for i18n due to the Olson data being in English itself
57
+ , DAYS = timezoneJS.Days = ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday']
58
+ , MONTHS = timezoneJS.Months = ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December']
59
+ , SHORT_MONTHS = {}
60
+ , SHORT_DAYS = {}
61
+ , EXACT_DATE_TIME = {}
62
+ , TZ_REGEXP = new RegExp('^[a-zA-Z]+/');
63
+
64
+ //`{ "Jan": 0, "Feb": 1, "Mar": 2, "Apr": 3, "May": 4, "Jun": 5, "Jul": 6, "Aug": 7, "Sep": 8, "Oct": 9, "Nov": 10, "Dec": 11 }`
65
+ for (var i = 0; i < MONTHS.length; i++) {
66
+ SHORT_MONTHS[MONTHS[i].substr(0, 3)] = i;
67
+ }
68
+
69
+ //`{ "Sun": 0, "Mon": 1, "Tue": 2, "Wed": 3, "Thu": 4, "Fri": 5, "Sat": 6 }`
70
+ for (i = 0; i < DAYS.length; i++) {
71
+ SHORT_DAYS[DAYS[i].substr(0, 3)] = i;
72
+ }
73
+
74
+
75
+ //Handle array indexOf in IE
76
+ if (!Array.prototype.indexOf) {
77
+ Array.prototype.indexOf = function (el) {
78
+ for (var i = 0; i < this.length; i++ ) {
79
+ if (el === this[i]) return i;
80
+ }
81
+ return -1;
82
+ }
83
+ }
84
+
85
+ // Format a number to the length = digits. For ex:
86
+ //
87
+ // `_fixWidth(2, 2) = '02'`
88
+ //
89
+ // `_fixWidth(1998, 2) = '98'`
90
+ //
91
+ // This is used to pad numbers in converting date to string in ISO standard.
92
+ var _fixWidth = function (number, digits) {
93
+ if (typeof number !== "number") { throw "not a number: " + number; }
94
+ var s = number.toString();
95
+ if (number.length > digits) {
96
+ return number.substr(number.length - digits, number.length);
97
+ }
98
+ while (s.length < digits) {
99
+ s = '0' + s;
100
+ }
101
+ return s;
102
+ };
103
+
104
+ // Abstraction layer for different transport layers, including fleegix/jQuery/Zepto
105
+ //
106
+ // Object `opts` include
107
+ //
108
+ // - `url`: url to ajax query
109
+ //
110
+ // - `async`: true for asynchronous, false otherwise. If false, return value will be response from URL. This is true by default
111
+ //
112
+ // - `success`: success callback function
113
+ //
114
+ // - `error`: error callback function
115
+ // Returns response from URL if async is false, otherwise the AJAX request object itself
116
+ var _transport = function (opts) {
117
+ if ((!fleegix || typeof fleegix.xhr === 'undefined') && (!$ || typeof $.ajax === 'undefined')) {
118
+ throw new Error('Please use the Fleegix.js XHR module, jQuery ajax, Zepto ajax, or define your own transport mechanism for downloading zone files.');
119
+ }
120
+ if (!opts) return;
121
+ if (!opts.url) throw new Error ('URL must be specified');
122
+ if (!('async' in opts)) opts.async = true;
123
+ if (!opts.async) {
124
+ return fleegix && fleegix.xhr
125
+ ? fleegix.xhr.doReq({ url: opts.url, async: false })
126
+ : $.ajax({ url : opts.url, async : false }).responseText;
127
+ }
128
+ return fleegix && fleegix.xhr
129
+ ? fleegix.xhr.send({
130
+ url : opts.url,
131
+ method : 'get',
132
+ handleSuccess : opts.success,
133
+ handleErr : opts.error
134
+ })
135
+ : $.ajax({
136
+ url : opts.url,
137
+ dataType: 'text',
138
+ method : 'GET',
139
+ error : opts.error,
140
+ success : opts.success
141
+ });
142
+ };
143
+
144
+ // Constructor, which is similar to that of the native Date object itself
145
+ timezoneJS.Date = function () {
146
+ var args = Array.prototype.slice.apply(arguments)
147
+ , dt = null
148
+ , tz = null
149
+ , arr = [];
150
+
151
+
152
+ //We support several different constructors, including all the ones from `Date` object
153
+ // with a timezone string at the end.
154
+ //
155
+ //- `[tz]`: Returns object with time in `tz` specified.
156
+ //
157
+ // - `utcMillis`, `[tz]`: Return object with UTC time = `utcMillis`, in `tz`.
158
+ //
159
+ // - `Date`, `[tz]`: Returns object with UTC time = `Date.getTime()`, in `tz`.
160
+ //
161
+ // - `year, month, [date,] [hours,] [minutes,] [seconds,] [millis,] [tz]: Same as `Date` object
162
+ // with tz.
163
+ //
164
+ // - `Array`: Can be any combo of the above.
165
+ //
166
+ //If 1st argument is an array, we can use it as a list of arguments itself
167
+ if (Object.prototype.toString.call(args[0]) === '[object Array]') {
168
+ args = args[0];
169
+ }
170
+ if (typeof args[args.length - 1] === 'string' && TZ_REGEXP.test(args[args.length - 1])) {
171
+ tz = args.pop();
172
+ }
173
+ switch (args.length) {
174
+ case 0:
175
+ dt = new Date();
176
+ break;
177
+ case 1:
178
+ dt = new Date(args[0]);
179
+ break;
180
+ default:
181
+ for (var i = 0; i < 7; i++) {
182
+ arr[i] = args[i] || 0;
183
+ }
184
+ dt = new Date(arr[0], arr[1], arr[2], arr[3], arr[4], arr[5], arr[6]);
185
+ break;
186
+ }
187
+
188
+ this._useCache = false;
189
+ this._tzInfo = {};
190
+ this._day = 0;
191
+ this.year = 0;
192
+ this.month = 0;
193
+ this.date = 0;
194
+ this.hours = 0;
195
+ this.minutes = 0;
196
+ this.seconds = 0;
197
+ this.milliseconds = 0;
198
+ this.timezone = tz || null;
199
+ //Tricky part:
200
+ // For the cases where there are 1/2 arguments: `timezoneJS.Date(millis, [tz])` and `timezoneJS.Date(Date, [tz])`. The
201
+ // Date `dt` created should be in UTC. Thus the way I detect such cases is to determine if `arr` is not populated & `tz`
202
+ // is specified. Because if `tz` is not specified, `dt` can be in local time.
203
+ if (arr.length) {
204
+ this.setFromDateObjProxy(dt);
205
+ } else {
206
+ this.setFromTimeProxy(dt.getTime(), tz);
207
+ }
208
+ };
209
+
210
+ // Implements most of the native Date object
211
+ timezoneJS.Date.prototype = {
212
+ getDate: function () { return this.date; },
213
+ getDay: function () { return this._day; },
214
+ getFullYear: function () { return this.year; },
215
+ getMonth: function () { return this.month; },
216
+ getYear: function () { return this.year; },
217
+ getHours: function () { return this.hours; },
218
+ getMilliseconds: function () { return this.milliseconds; },
219
+ getMinutes: function () { return this.minutes; },
220
+ getSeconds: function () { return this.seconds; },
221
+ getUTCDate: function () { return this.getUTCDateProxy().getUTCDate(); },
222
+ getUTCDay: function () { return this.getUTCDateProxy().getUTCDay(); },
223
+ getUTCFullYear: function () { return this.getUTCDateProxy().getUTCFullYear(); },
224
+ getUTCHours: function () { return this.getUTCDateProxy().getUTCHours(); },
225
+ getUTCMilliseconds: function () { return this.getUTCDateProxy().getUTCMilliseconds(); },
226
+ getUTCMinutes: function () { return this.getUTCDateProxy().getUTCMinutes(); },
227
+ getUTCMonth: function () { return this.getUTCDateProxy().getUTCMonth(); },
228
+ getUTCSeconds: function () { return this.getUTCDateProxy().getUTCSeconds(); },
229
+ // Time adjusted to user-specified timezone
230
+ getTime: function () {
231
+ return this._timeProxy + (this.getTimezoneOffset() * 60 * 1000);
232
+ },
233
+ getTimezone: function () { return this.timezone; },
234
+ getTimezoneOffset: function () { return this.getTimezoneInfo().tzOffset; },
235
+ getTimezoneAbbreviation: function () { return this.getTimezoneInfo().tzAbbr; },
236
+ getTimezoneInfo: function () {
237
+ if (this._useCache) return this._tzInfo;
238
+ var res;
239
+ // If timezone is specified, get the correct timezone info based on the Date given
240
+ if (this.timezone) {
241
+ res = this.timezone === 'Etc/UTC' || this.timezone === 'Etc/GMT'
242
+ ? { tzOffset: 0, tzAbbr: 'UTC' }
243
+ : timezoneJS.timezone.getTzInfo(this._timeProxy, this.timezone);
244
+ }
245
+ // If no timezone was specified, use the local browser offset
246
+ else {
247
+ res = { tzOffset: this.getLocalOffset(), tzAbbr: null };
248
+ }
249
+ this._tzInfo = res;
250
+ this._useCache = true;
251
+ return res
252
+ },
253
+ getUTCDateProxy: function () {
254
+ var dt = new Date(this._timeProxy);
255
+ dt.setUTCMinutes(dt.getUTCMinutes() + this.getTimezoneOffset());
256
+ return dt;
257
+ },
258
+ setDate: function (n) { this.setAttribute('date', n); },
259
+ setFullYear: function (n) { this.setAttribute('year', n); },
260
+ setMonth: function (n) { this.setAttribute('month', n); },
261
+ setYear: function (n) { this.setUTCAttribute('year', n); },
262
+ setHours: function (n) { this.setAttribute('hours', n); },
263
+ setMilliseconds: function (n) { this.setAttribute('milliseconds', n); },
264
+ setMinutes: function (n) { this.setAttribute('minutes', n); },
265
+ setSeconds: function (n) { this.setAttribute('seconds', n); },
266
+ setTime: function (n) {
267
+ if (isNaN(n)) { throw new Error('Units must be a number.'); }
268
+ this.setFromTimeProxy(n, this.timezone);
269
+ },
270
+ setUTCDate: function (n) { this.setUTCAttribute('date', n); },
271
+ setUTCFullYear: function (n) { this.setUTCAttribute('year', n); },
272
+ setUTCHours: function (n) { this.setUTCAttribute('hours', n); },
273
+ setUTCMilliseconds: function (n) { this.setUTCAttribute('milliseconds', n); },
274
+ setUTCMinutes: function (n) { this.setUTCAttribute('minutes', n); },
275
+ setUTCMonth: function (n) { this.setUTCAttribute('month', n); },
276
+ setUTCSeconds: function (n) { this.setUTCAttribute('seconds', n); },
277
+ setFromDateObjProxy: function (dt) {
278
+ this.year = dt.getFullYear();
279
+ this.month = dt.getMonth();
280
+ this.date = dt.getDate();
281
+ this.hours = dt.getHours();
282
+ this.minutes = dt.getMinutes();
283
+ this.seconds = dt.getSeconds();
284
+ this.milliseconds = dt.getMilliseconds();
285
+ this._day = dt.getDay();
286
+ this._dateProxy = dt;
287
+ this._timeProxy = Date.UTC(this.year, this.month, this.date, this.hours, this.minutes, this.seconds, this.milliseconds);
288
+ this._useCache = false;
289
+ },
290
+ setFromTimeProxy: function (utcMillis, tz) {
291
+ var dt = new Date(utcMillis);
292
+ var tzOffset;
293
+ tzOffset = tz ? timezoneJS.timezone.getTzInfo(dt, tz).tzOffset : dt.getTimezoneOffset();
294
+ dt.setTime(utcMillis + (dt.getTimezoneOffset() - tzOffset) * 60000);
295
+ this.setFromDateObjProxy(dt);
296
+ },
297
+ setAttribute: function (unit, n) {
298
+ if (isNaN(n)) { throw new Error('Units must be a number.'); }
299
+ var dt = this._dateProxy;
300
+ var meth = unit === 'year' ? 'FullYear' : unit.substr(0, 1).toUpperCase() + unit.substr(1);
301
+ dt['set' + meth](n);
302
+ this.setFromDateObjProxy(dt);
303
+ },
304
+ setUTCAttribute: function (unit, n) {
305
+ if (isNaN(n)) { throw new Error('Units must be a number.'); }
306
+ var meth = unit === 'year' ? 'FullYear' : unit.substr(0, 1).toUpperCase() + unit.substr(1);
307
+ var dt = this.getUTCDateProxy();
308
+ dt['setUTC' + meth](n);
309
+ dt.setUTCMinutes(dt.getUTCMinutes() - this.getTimezoneOffset());
310
+ this.setFromTimeProxy(dt.getTime() + this.getTimezoneOffset() * 60000, this.timezone);
311
+ },
312
+ setTimezone: function (tz) {
313
+ var previousOffset = this.getTimezoneInfo().tzOffset;
314
+ this.timezone = tz;
315
+ this._useCache = false;
316
+ // Set UTC minutes offsets by the delta of the two timezones
317
+ this.setUTCMinutes(this.getUTCMinutes() - this.getTimezoneInfo().tzOffset + previousOffset);
318
+ },
319
+ removeTimezone: function () {
320
+ this.timezone = null;
321
+ this._useCache = false;
322
+ },
323
+ valueOf: function () { return this.getTime(); },
324
+ clone: function () {
325
+ return this.timezone ? new timezoneJS.Date(this.getTime(), this.timezone) : new timezoneJS.Date(this.getTime());
326
+ },
327
+ toGMTString: function () { return this.toString('EEE, dd MMM yyyy HH:mm:ss Z', 'Etc/GMT'); },
328
+ toLocaleString: function () {},
329
+ toLocaleDateString: function () {},
330
+ toLocaleTimeString: function () {},
331
+ toSource: function () {},
332
+ toISOString: function () { return this.toString('yyyy-MM-ddTHH:mm:ss.SSS', 'Etc/UTC') + 'Z'; },
333
+ toJSON: function () { return this.toISOString(); },
334
+ // Allows different format following ISO8601 format:
335
+ toString: function (format, tz) {
336
+ // Default format is the same as toISOString
337
+ if (!format) format = 'yyyy-MM-dd HH:mm:ss';
338
+ var result = format;
339
+ var tzInfo = tz ? timezoneJS.timezone.getTzInfo(this.getTime(), tz) : this.getTimezoneInfo();
340
+ var _this = this;
341
+ // If timezone is specified, get a clone of the current Date object and modify it
342
+ if (tz) {
343
+ _this = this.clone();
344
+ _this.setTimezone(tz);
345
+ }
346
+ var hours = _this.getHours();
347
+ return result
348
+ // fix the same characters in Month names
349
+ .replace(/a+/g, function () { return 'k'; })
350
+ // `y`: year
351
+ .replace(/y+/g, function (token) { return _fixWidth(_this.getFullYear(), token.length); })
352
+ // `d`: date
353
+ .replace(/d+/g, function (token) { return _fixWidth(_this.getDate(), token.length); })
354
+ // `m`: minute
355
+ .replace(/m+/g, function (token) { return _fixWidth(_this.getMinutes(), token.length); })
356
+ // `s`: second
357
+ .replace(/s+/g, function (token) { return _fixWidth(_this.getSeconds(), token.length); })
358
+ // `S`: millisecond
359
+ .replace(/S+/g, function (token) { return _fixWidth(_this.getMilliseconds(), token.length); })
360
+ // `M`: month. Note: `MM` will be the numeric representation (e.g February is 02) but `MMM` will be text representation (e.g February is Feb)
361
+ .replace(/M+/g, function (token) {
362
+ var _month = _this.getMonth(),
363
+ _len = token.length;
364
+ if (_len > 3) {
365
+ return timezoneJS.Months[_month];
366
+ } else if (_len > 2) {
367
+ return timezoneJS.Months[_month].substring(0, _len);
368
+ }
369
+ return _fixWidth(_month + 1, _len);
370
+ })
371
+ // `k`: AM/PM
372
+ .replace(/k+/g, function () {
373
+ if (hours >= 12) {
374
+ if (hours > 12) {
375
+ hours -= 12;
376
+ }
377
+ return 'PM';
378
+ }
379
+ return 'AM';
380
+ })
381
+ // `H`: hour
382
+ .replace(/H+/g, function (token) { return _fixWidth(hours, token.length); })
383
+ // `E`: day
384
+ .replace(/E+/g, function (token) { return DAYS[_this.getDay()].substring(0, token.length); })
385
+ // `Z`: timezone abbreviation
386
+ .replace(/Z+/gi, function () { return tzInfo.tzAbbr; });
387
+ },
388
+ toUTCString: function () { return this.toGMTString(); },
389
+ civilToJulianDayNumber: function (y, m, d) {
390
+ var a;
391
+ // Adjust for zero-based JS-style array
392
+ m++;
393
+ if (m > 12) {
394
+ a = parseInt(m/12, 10);
395
+ m = m % 12;
396
+ y += a;
397
+ }
398
+ if (m <= 2) {
399
+ y -= 1;
400
+ m += 12;
401
+ }
402
+ a = Math.floor(y / 100);
403
+ var b = 2 - a + Math.floor(a / 4)
404
+ , jDt = Math.floor(365.25 * (y + 4716)) + Math.floor(30.6001 * (m + 1)) + d + b - 1524;
405
+ return jDt;
406
+ },
407
+ getLocalOffset: function () {
408
+ return this._dateProxy.getTimezoneOffset();
409
+ }
410
+ };
411
+
412
+
413
+ timezoneJS.timezone = new function () {
414
+ var _this = this
415
+ , regionMap = {'Etc':'etcetera','EST':'northamerica','MST':'northamerica','HST':'northamerica','EST5EDT':'northamerica','CST6CDT':'northamerica','MST7MDT':'northamerica','PST8PDT':'northamerica','America':'northamerica','Pacific':'australasia','Atlantic':'europe','Africa':'africa','Indian':'africa','Antarctica':'antarctica','Asia':'asia','Australia':'australasia','Europe':'europe','WET':'europe','CET':'europe','MET':'europe','EET':'europe'}
416
+ , regionExceptions = {'Pacific/Honolulu':'northamerica','Atlantic/Bermuda':'northamerica','Atlantic/Cape_Verde':'africa','Atlantic/St_Helena':'africa','Indian/Kerguelen':'antarctica','Indian/Chagos':'asia','Indian/Maldives':'asia','Indian/Christmas':'australasia','Indian/Cocos':'australasia','America/Danmarkshavn':'europe','America/Scoresbysund':'europe','America/Godthab':'europe','America/Thule':'europe','Asia/Yekaterinburg':'europe','Asia/Omsk':'europe','Asia/Novosibirsk':'europe','Asia/Krasnoyarsk':'europe','Asia/Irkutsk':'europe','Asia/Yakutsk':'europe','Asia/Vladivostok':'europe','Asia/Sakhalin':'europe','Asia/Magadan':'europe','Asia/Kamchatka':'europe','Asia/Anadyr':'europe','Africa/Ceuta':'europe','America/Argentina/Buenos_Aires':'southamerica','America/Argentina/Cordoba':'southamerica','America/Argentina/Tucuman':'southamerica','America/Argentina/La_Rioja':'southamerica','America/Argentina/San_Juan':'southamerica','America/Argentina/Jujuy':'southamerica','America/Argentina/Catamarca':'southamerica','America/Argentina/Mendoza':'southamerica','America/Argentina/Rio_Gallegos':'southamerica','America/Argentina/Ushuaia':'southamerica','America/Aruba':'southamerica','America/La_Paz':'southamerica','America/Noronha':'southamerica','America/Belem':'southamerica','America/Fortaleza':'southamerica','America/Recife':'southamerica','America/Araguaina':'southamerica','America/Maceio':'southamerica','America/Bahia':'southamerica','America/Sao_Paulo':'southamerica','America/Campo_Grande':'southamerica','America/Cuiaba':'southamerica','America/Porto_Velho':'southamerica','America/Boa_Vista':'southamerica','America/Manaus':'southamerica','America/Eirunepe':'southamerica','America/Rio_Branco':'southamerica','America/Santiago':'southamerica','Pacific/Easter':'southamerica','America/Bogota':'southamerica','America/Curacao':'southamerica','America/Guayaquil':'southamerica','Pacific/Galapagos':'southamerica','Atlantic/Stanley':'southamerica','America/Cayenne':'southamerica','America/Guyana':'southamerica','America/Asuncion':'southamerica','America/Lima':'southamerica','Atlantic/South_Georgia':'southamerica','America/Paramaribo':'southamerica','America/Port_of_Spain':'southamerica','America/Montevideo':'southamerica','America/Caracas':'southamerica'};
417
+ function invalidTZError(t) { throw new Error('Timezone "' + t + '" is either incorrect, or not loaded in the timezone registry.'); }
418
+ function builtInLoadZoneFile(fileName, opts) {
419
+ var url = _this.zoneFileBasePath + '/' + fileName;
420
+ return !opts || !opts.async
421
+ ? _this.parseZones(_this.transport({ url : url, async : false }))
422
+ : _this.transport({
423
+ async: true,
424
+ url : url,
425
+ success : function (str) {
426
+ if (_this.parseZones(str) && typeof opts.callback === 'function') {
427
+ opts.callback();
428
+ }
429
+ return true;
430
+ },
431
+ error : function () {
432
+ throw new Error('Error retrieving "' + url + '" zoneinfo files');
433
+ }
434
+ });
435
+ }
436
+ function getRegionForTimezone(tz) {
437
+ var exc = regionExceptions[tz]
438
+ , reg
439
+ , ret;
440
+ if (exc) return exc;
441
+ reg = tz.split('/')[0];
442
+ ret = regionMap[reg];
443
+ // If there's nothing listed in the main regions for this TZ, check the 'backward' links
444
+ if (ret) return ret;
445
+ var link = _this.zones[tz];
446
+ if (typeof link === 'string') {
447
+ return getRegionForTimezone(link);
448
+ }
449
+ // Backward-compat file hasn't loaded yet, try looking in there
450
+ if (!_this.loadedZones.backward) {
451
+ // This is for obvious legacy zones (e.g., Iceland) that don't even have a prefix like "America/" that look like normal zones
452
+ _this.loadZoneFile('backward');
453
+ return getRegionForTimezone(tz);
454
+ }
455
+ invalidTZError(tz);
456
+ }
457
+ function parseTimeString(str) {
458
+ var pat = /(\d+)(?::0*(\d*))?(?::0*(\d*))?([wsugz])?$/;
459
+ var hms = str.match(pat);
460
+ hms[1] = parseInt(hms[1], 10);
461
+ hms[2] = hms[2] ? parseInt(hms[2], 10) : 0;
462
+ hms[3] = hms[3] ? parseInt(hms[3], 10) : 0;
463
+
464
+ return hms;
465
+ }
466
+ function processZone(z) {
467
+ if (!z[3]) { return; }
468
+ var yea = parseInt(z[3], 10);
469
+ var mon = 11;
470
+ var dat = 31;
471
+ if (z[4]) {
472
+ mon = SHORT_MONTHS[z[4].substr(0, 3)];
473
+ dat = parseInt(z[5], 10) || 1;
474
+ }
475
+ var string = z[6] ? z[6] : '00:00:00'
476
+ , t = parseTimeString(string);
477
+ return [yea, mon, dat, t[1], t[2], t[3]];
478
+ }
479
+ function getZone(dt, tz) {
480
+ var utcMillis = typeof dt === 'number' ? dt : new Date(dt).getTime();
481
+ var t = tz;
482
+ var zoneList = _this.zones[t];
483
+ // Follow links to get to an actual zone
484
+ while (typeof zoneList === "string") {
485
+ t = zoneList;
486
+ zoneList = _this.zones[t];
487
+ }
488
+ if (!zoneList) {
489
+ // Backward-compat file hasn't loaded yet, try looking in there
490
+ if (!_this.loadedZones.backward) {
491
+ //This is for backward entries like "America/Fort_Wayne" that
492
+ // getRegionForTimezone *thinks* it has a region file and zone
493
+ // for (e.g., America => 'northamerica'), but in reality it's a
494
+ // legacy zone we need the backward file for.
495
+ _this.loadZoneFile('backward');
496
+ return getZone(dt, tz);
497
+ }
498
+ invalidTZError(t);
499
+ }
500
+ if (zoneList.length === 0) {
501
+ throw new Error('No Zone found for "' + tz + '" on ' + dt);
502
+ }
503
+ //Do backwards lookup since most use cases deal with newer dates.
504
+ for (var i = zoneList.length - 1; i >= 0; i--) {
505
+ var z = zoneList[i];
506
+ if (z[3] && utcMillis > z[3]) break;
507
+ }
508
+ return zoneList[i+1];
509
+ }
510
+ function getBasicOffset(time) {
511
+ var off = parseTimeString(time)
512
+ , adj = time.indexOf('-') === 0 ? -1 : 1;
513
+ off = adj * (((off[1] * 60 + off[2]) * 60 + off[3]) * 1000);
514
+ return off/60/1000;
515
+ }
516
+
517
+ //if isUTC is true, date is given in UTC, otherwise it's given
518
+ // in local time (ie. date.getUTC*() returns local time components)
519
+ function getRule(dt, zone, isUTC) {
520
+ var date = typeof dt === 'number' ? new Date(dt) : dt;
521
+ var ruleset = zone[1];
522
+ var basicOffset = zone[0];
523
+
524
+ //Convert a date to UTC. Depending on the 'type' parameter, the date
525
+ // parameter may be:
526
+ //
527
+ // - `u`, `g`, `z`: already UTC (no adjustment).
528
+ //
529
+ // - `s`: standard time (adjust for time zone offset but not for DST)
530
+ //
531
+ // - `w`: wall clock time (adjust for both time zone and DST offset).
532
+ //
533
+ // DST adjustment is done using the rule given as third argument.
534
+ var convertDateToUTC = function (date, type, rule) {
535
+ var offset = 0;
536
+
537
+ if (type === 'u' || type === 'g' || type === 'z') { // UTC
538
+ offset = 0;
539
+ } else if (type === 's') { // Standard Time
540
+ offset = basicOffset;
541
+ } else if (type === 'w' || !type) { // Wall Clock Time
542
+ offset = getAdjustedOffset(basicOffset, rule);
543
+ } else {
544
+ throw("unknown type " + type);
545
+ }
546
+ offset *= 60 * 1000; // to millis
547
+
548
+ return new Date(date.getTime() + offset);
549
+ };
550
+
551
+ //Step 1: Find applicable rules for this year.
552
+ //
553
+ //Step 2: Sort the rules by effective date.
554
+ //
555
+ //Step 3: Check requested date to see if a rule has yet taken effect this year. If not,
556
+ //
557
+ //Step 4: Get the rules for the previous year. If there isn't an applicable rule for last year, then
558
+ // there probably is no current time offset since they seem to explicitly turn off the offset
559
+ // when someone stops observing DST.
560
+ //
561
+ // FIXME if this is not the case and we'll walk all the way back (ugh).
562
+ //
563
+ //Step 5: Sort the rules by effective date.
564
+ //Step 6: Apply the most recent rule before the current time.
565
+ var convertRuleToExactDateAndTime = function (yearAndRule, prevRule) {
566
+ var year = yearAndRule[0]
567
+ , rule = yearAndRule[1];
568
+ // Assume that the rule applies to the year of the given date.
569
+
570
+ var hms = rule[5];
571
+ var effectiveDate;
572
+
573
+ if (!EXACT_DATE_TIME[year])
574
+ EXACT_DATE_TIME[year] = {};
575
+
576
+ // Result for given parameters is already stored
577
+ if (EXACT_DATE_TIME[year][rule])
578
+ effectiveDate = EXACT_DATE_TIME[year][rule];
579
+ else {
580
+ //If we have a specific date, use that!
581
+ if (!isNaN(rule[4])) {
582
+ effectiveDate = new Date(Date.UTC(year, SHORT_MONTHS[rule[3]], rule[4], hms[1], hms[2], hms[3], 0));
583
+ }
584
+ //Let's hunt for the date.
585
+ else {
586
+ var targetDay
587
+ , operator;
588
+ //Example: `lastThu`
589
+ if (rule[4].substr(0, 4) === "last") {
590
+ // Start at the last day of the month and work backward.
591
+ effectiveDate = new Date(Date.UTC(year, SHORT_MONTHS[rule[3]] + 1, 1, hms[1] - 24, hms[2], hms[3], 0));
592
+ targetDay = SHORT_DAYS[rule[4].substr(4, 3)];
593
+ operator = "<=";
594
+ }
595
+ //Example: `Sun>=15`
596
+ else {
597
+ //Start at the specified date.
598
+ effectiveDate = new Date(Date.UTC(year, SHORT_MONTHS[rule[3]], rule[4].substr(5), hms[1], hms[2], hms[3], 0));
599
+ targetDay = SHORT_DAYS[rule[4].substr(0, 3)];
600
+ operator = rule[4].substr(3, 2);
601
+ }
602
+ var ourDay = effectiveDate.getUTCDay();
603
+ //Go forwards.
604
+ if (operator === ">=") {
605
+ effectiveDate.setUTCDate(effectiveDate.getUTCDate() + (targetDay - ourDay + ((targetDay < ourDay) ? 7 : 0)));
606
+ }
607
+ //Go backwards. Looking for the last of a certain day, or operator is "<=" (less likely).
608
+ else {
609
+ effectiveDate.setUTCDate(effectiveDate.getUTCDate() + (targetDay - ourDay - ((targetDay > ourDay) ? 7 : 0)));
610
+ }
611
+ }
612
+ EXACT_DATE_TIME[year][rule] = effectiveDate;
613
+ }
614
+
615
+
616
+ //If previous rule is given, correct for the fact that the starting time of the current
617
+ // rule may be specified in local time.
618
+ if (prevRule) {
619
+ effectiveDate = convertDateToUTC(effectiveDate, hms[4], prevRule);
620
+ }
621
+ return effectiveDate;
622
+ };
623
+
624
+ var findApplicableRules = function (year, ruleset) {
625
+ var applicableRules = [];
626
+ for (var i = 0; ruleset && i < ruleset.length; i++) {
627
+ //Exclude future rules.
628
+ if (ruleset[i][0] <= year &&
629
+ (
630
+ // Date is in a set range.
631
+ ruleset[i][1] >= year ||
632
+ // Date is in an "only" year.
633
+ (ruleset[i][0] === year && ruleset[i][1] === "only") ||
634
+ //We're in a range from the start year to infinity.
635
+ ruleset[i][1] === "max"
636
+ )
637
+ ) {
638
+ //It's completely okay to have any number of matches here.
639
+ // Normally we should only see two, but that doesn't preclude other numbers of matches.
640
+ // These matches are applicable to this year.
641
+ applicableRules.push([year, ruleset[i]]);
642
+ }
643
+ }
644
+ return applicableRules;
645
+ };
646
+
647
+ var compareDates = function (a, b, prev) {
648
+ var year, rule;
649
+ if (a.constructor !== Date) {
650
+ year = a[0];
651
+ rule = a[1];
652
+ a = (!prev && EXACT_DATE_TIME[year] && EXACT_DATE_TIME[year][rule])
653
+ ? EXACT_DATE_TIME[year][rule]
654
+ : convertRuleToExactDateAndTime(a, prev);
655
+ } else if (prev) {
656
+ a = convertDateToUTC(a, isUTC ? 'u' : 'w', prev);
657
+ }
658
+ if (b.constructor !== Date) {
659
+ year = b[0];
660
+ rule = b[1];
661
+ b = (!prev && EXACT_DATE_TIME[year] && EXACT_DATE_TIME[year][rule]) ? EXACT_DATE_TIME[year][rule]
662
+ : convertRuleToExactDateAndTime(b, prev);
663
+ } else if (prev) {
664
+ b = convertDateToUTC(b, isUTC ? 'u' : 'w', prev);
665
+ }
666
+ a = Number(a);
667
+ b = Number(b);
668
+ return a - b;
669
+ };
670
+
671
+ var year = date.getUTCFullYear();
672
+ var applicableRules;
673
+
674
+ applicableRules = findApplicableRules(year, _this.rules[ruleset]);
675
+ applicableRules.push(date);
676
+ //While sorting, the time zone in which the rule starting time is specified
677
+ // is ignored. This is ok as long as the timespan between two DST changes is
678
+ // larger than the DST offset, which is probably always true.
679
+ // As the given date may indeed be close to a DST change, it may get sorted
680
+ // to a wrong position (off by one), which is corrected below.
681
+ applicableRules.sort(compareDates);
682
+
683
+ //If there are not enough past DST rules...
684
+ if (applicableRules.indexOf(date) < 2) {
685
+ applicableRules = applicableRules.concat(findApplicableRules(year-1, _this.rules[ruleset]));
686
+ applicableRules.sort(compareDates);
687
+ }
688
+ var pinpoint = applicableRules.indexOf(date);
689
+ if (pinpoint > 1 && compareDates(date, applicableRules[pinpoint-1], applicableRules[pinpoint-2][1]) < 0) {
690
+ //The previous rule does not really apply, take the one before that.
691
+ return applicableRules[pinpoint - 2][1];
692
+ } else if (pinpoint > 0 && pinpoint < applicableRules.length - 1 && compareDates(date, applicableRules[pinpoint+1], applicableRules[pinpoint-1][1]) > 0) {
693
+
694
+ //The next rule does already apply, take that one.
695
+ return applicableRules[pinpoint + 1][1];
696
+ } else if (pinpoint === 0) {
697
+ //No applicable rule found in this and in previous year.
698
+ return null;
699
+ }
700
+ return applicableRules[pinpoint - 1][1];
701
+ }
702
+ function getAdjustedOffset(off, rule) {
703
+ return -Math.ceil(rule[6] - off);
704
+ }
705
+ function getAbbreviation(zone, rule) {
706
+ var res;
707
+ var base = zone[2];
708
+ if (base.indexOf('%s') > -1) {
709
+ var repl;
710
+ if (rule) {
711
+ repl = rule[7] === '-' ? '' : rule[7];
712
+ }
713
+ //FIXME: Right now just falling back to Standard --
714
+ // apparently ought to use the last valid rule,
715
+ // although in practice that always ought to be Standard
716
+ else {
717
+ repl = 'S';
718
+ }
719
+ res = base.replace('%s', repl);
720
+ }
721
+ else if (base.indexOf('/') > -1) {
722
+ //Chose one of two alternative strings.
723
+ res = base.split("/", 2)[rule[6] ? 1 : 0];
724
+ } else {
725
+ res = base;
726
+ }
727
+ return res;
728
+ }
729
+
730
+ this.zoneFileBasePath;
731
+ this.zoneFiles = ['africa', 'antarctica', 'asia', 'australasia', 'backward', 'etcetera', 'europe', 'northamerica', 'pacificnew', 'southamerica'];
732
+ this.loadingSchemes = {
733
+ PRELOAD_ALL: 'preloadAll',
734
+ LAZY_LOAD: 'lazyLoad',
735
+ MANUAL_LOAD: 'manualLoad'
736
+ };
737
+ this.loadingScheme = this.loadingSchemes.LAZY_LOAD;
738
+ this.loadedZones = {};
739
+ this.zones = {};
740
+ this.rules = {};
741
+
742
+ this.init = function (o) {
743
+ var opts = { async: true }
744
+ , def = this.defaultZoneFile = this.loadingScheme === this.loadingSchemes.PRELOAD_ALL
745
+ ? this.zoneFiles
746
+ : 'northamerica'
747
+ , done = 0
748
+ , callbackFn;
749
+ //Override default with any passed-in opts
750
+ for (var p in o) {
751
+ opts[p] = o[p];
752
+ }
753
+ if (typeof def === 'string') {
754
+ return this.loadZoneFile(def, opts);
755
+ }
756
+ //Wraps callback function in another one that makes
757
+ // sure all files have been loaded.
758
+ callbackFn = opts.callback;
759
+ opts.callback = function () {
760
+ done++;
761
+ (done === def.length) && typeof callbackFn === 'function' && callbackFn();
762
+ };
763
+ for (var i = 0; i < def.length; i++) {
764
+ this.loadZoneFile(def[i], opts);
765
+ }
766
+ };
767
+
768
+ //Get the zone files via XHR -- if the sync flag
769
+ // is set to true, it's being called by the lazy-loading
770
+ // mechanism, so the result needs to be returned inline.
771
+ this.loadZoneFile = function (fileName, opts) {
772
+ if (typeof this.zoneFileBasePath === 'undefined') {
773
+ throw new Error('Please define a base path to your zone file directory -- timezoneJS.timezone.zoneFileBasePath.');
774
+ }
775
+ //Ignore already loaded zones.
776
+ if (this.loadedZones[fileName]) {
777
+ return;
778
+ }
779
+ this.loadedZones[fileName] = true;
780
+ return builtInLoadZoneFile(fileName, opts);
781
+ };
782
+ this.loadZoneJSONData = function (url, sync) {
783
+ var processData = function (data) {
784
+ data = eval('('+ data +')');
785
+ for (var z in data.zones) {
786
+ _this.zones[z] = data.zones[z];
787
+ }
788
+ for (var r in data.rules) {
789
+ _this.rules[r] = data.rules[r];
790
+ }
791
+ };
792
+ return sync
793
+ ? processData(_this.transport({ url : url, async : false }))
794
+ : _this.transport({ url : url, success : processData });
795
+ };
796
+ this.loadZoneDataFromObject = function (data) {
797
+ if (!data) { return; }
798
+ for (var z in data.zones) {
799
+ _this.zones[z] = data.zones[z];
800
+ }
801
+ for (var r in data.rules) {
802
+ _this.rules[r] = data.rules[r];
803
+ }
804
+ };
805
+ this.getAllZones = function () {
806
+ var arr = [];
807
+ for (var z in this.zones) { arr.push(z); }
808
+ return arr.sort();
809
+ };
810
+ this.parseZones = function (str) {
811
+ var lines = str.split('\n')
812
+ , arr = []
813
+ , chunk = ''
814
+ , l
815
+ , zone = null
816
+ , rule = null;
817
+ for (var i = 0; i < lines.length; i++) {
818
+ l = lines[i];
819
+ if (l.match(/^\s/)) {
820
+ l = "Zone " + zone + l;
821
+ }
822
+ l = l.split("#")[0];
823
+ if (l.length > 3) {
824
+ arr = l.split(/\s+/);
825
+ chunk = arr.shift();
826
+ //Ignore Leap.
827
+ switch (chunk) {
828
+ case 'Zone':
829
+ zone = arr.shift();
830
+ if (!_this.zones[zone]) {
831
+ _this.zones[zone] = [];
832
+ }
833
+ if (arr.length < 3) break;
834
+ //Process zone right here and replace 3rd element with the processed array.
835
+ arr.splice(3, arr.length, processZone(arr));
836
+ if (arr[3]) arr[3] = Date.UTC.apply(null, arr[3]);
837
+ arr[0] = -getBasicOffset(arr[0]);
838
+ _this.zones[zone].push(arr);
839
+ break;
840
+ case 'Rule':
841
+ rule = arr.shift();
842
+ if (!_this.rules[rule]) {
843
+ _this.rules[rule] = [];
844
+ }
845
+ //Parse int FROM year and TO year
846
+ arr[0] = parseInt(arr[0], 10);
847
+ arr[1] = parseInt(arr[1], 10) || arr[1];
848
+ //Parse time string AT
849
+ arr[5] = parseTimeString(arr[5]);
850
+ //Parse offset SAVE
851
+ arr[6] = getBasicOffset(arr[6]);
852
+ _this.rules[rule].push(arr);
853
+ break;
854
+ case 'Link':
855
+ //No zones for these should already exist.
856
+ if (_this.zones[arr[1]]) {
857
+ throw new Error('Error with Link ' + arr[1] + '. Cannot create link of a preexisted zone.');
858
+ }
859
+ //Create the link.
860
+ _this.zones[arr[1]] = arr[0];
861
+ break;
862
+ }
863
+ }
864
+ }
865
+ return true;
866
+ };
867
+ //Expose transport mechanism and allow overwrite.
868
+ this.transport = _transport;
869
+ this.getTzInfo = function (dt, tz, isUTC) {
870
+ //Lazy-load any zones not yet loaded.
871
+ if (this.loadingScheme === this.loadingSchemes.LAZY_LOAD) {
872
+ //Get the correct region for the zone.
873
+ var zoneFile = getRegionForTimezone(tz);
874
+ if (!zoneFile) {
875
+ throw new Error('Not a valid timezone ID.');
876
+ }
877
+ if (!this.loadedZones[zoneFile]) {
878
+ //Get the file and parse it -- use synchronous XHR.
879
+ this.loadZoneFile(zoneFile);
880
+ }
881
+ }
882
+ var z = getZone(dt, tz);
883
+ var off = z[0];
884
+ //See if the offset needs adjustment.
885
+ var rule = getRule(dt, z, isUTC);
886
+ if (rule) {
887
+ off = getAdjustedOffset(off, rule);
888
+ }
889
+ var abbr = getAbbreviation(z, rule);
890
+ return { tzOffset: off, tzAbbr: abbr };
891
+ };
892
+ };
893
+ }).call(this);