rgraph-rails 1.0.5 → 1.0.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (67) hide show
  1. checksums.yaml +8 -8
  2. data/.travis.yml +0 -1
  3. data/README.md +3 -3
  4. data/lib/rgraph-rails/version.rb +1 -1
  5. data/vendor/assets/javascripts/RGraph.bar.js +239 -3764
  6. data/vendor/assets/javascripts/RGraph.bipolar.js +115 -1986
  7. data/vendor/assets/javascripts/RGraph.common.annotate.js +35 -399
  8. data/vendor/assets/javascripts/RGraph.common.context.js +30 -600
  9. data/vendor/assets/javascripts/RGraph.common.core.js +403 -5187
  10. data/vendor/assets/javascripts/RGraph.common.csv.js +19 -275
  11. data/vendor/assets/javascripts/RGraph.common.deprecated.js +35 -454
  12. data/vendor/assets/javascripts/RGraph.common.dynamic.js +84 -1189
  13. data/vendor/assets/javascripts/RGraph.common.effects.js +90 -1548
  14. data/vendor/assets/javascripts/RGraph.common.key.js +54 -755
  15. data/vendor/assets/javascripts/RGraph.common.resizing.js +37 -567
  16. data/vendor/assets/javascripts/RGraph.common.sheets.js +29 -356
  17. data/vendor/assets/javascripts/RGraph.common.tooltips.js +32 -614
  18. data/vendor/assets/javascripts/RGraph.common.zoom.js +14 -223
  19. data/vendor/assets/javascripts/RGraph.cornergauge.js +71 -0
  20. data/vendor/assets/javascripts/RGraph.drawing.background.js +35 -620
  21. data/vendor/assets/javascripts/RGraph.drawing.circle.js +35 -576
  22. data/vendor/assets/javascripts/RGraph.drawing.image.js +52 -807
  23. data/vendor/assets/javascripts/RGraph.drawing.marker1.js +41 -717
  24. data/vendor/assets/javascripts/RGraph.drawing.marker2.js +37 -668
  25. data/vendor/assets/javascripts/RGraph.drawing.marker3.js +36 -563
  26. data/vendor/assets/javascripts/RGraph.drawing.poly.js +40 -608
  27. data/vendor/assets/javascripts/RGraph.drawing.rect.js +35 -597
  28. data/vendor/assets/javascripts/RGraph.drawing.text.js +34 -642
  29. data/vendor/assets/javascripts/RGraph.drawing.xaxis.js +50 -809
  30. data/vendor/assets/javascripts/RGraph.drawing.yaxis.js +51 -856
  31. data/vendor/assets/javascripts/RGraph.fuel.js +58 -964
  32. data/vendor/assets/javascripts/RGraph.funnel.js +55 -984
  33. data/vendor/assets/javascripts/RGraph.gantt.js +75 -1241
  34. data/vendor/assets/javascripts/RGraph.gauge.js +87 -1397
  35. data/vendor/assets/javascripts/RGraph.hbar.js +143 -2376
  36. data/vendor/assets/javascripts/RGraph.hprogress.js +80 -1397
  37. data/vendor/assets/javascripts/RGraph.line.js +241 -4162
  38. data/vendor/assets/javascripts/RGraph.meter.js +74 -1278
  39. metadata +3 -30
  40. data/vendor/assets/images/bg.png +0 -0
  41. data/vendor/assets/images/bullet.png +0 -0
  42. data/vendor/assets/images/facebook-large.png +0 -0
  43. data/vendor/assets/images/google-plus-large.png +0 -0
  44. data/vendor/assets/images/logo.png +0 -0
  45. data/vendor/assets/images/meter-image-sd-needle.png +0 -0
  46. data/vendor/assets/images/meter-image-sd.png +0 -0
  47. data/vendor/assets/images/meter-sketch-needle.png +0 -0
  48. data/vendor/assets/images/meter-sketch.png +0 -0
  49. data/vendor/assets/images/odometer-background.png +0 -0
  50. data/vendor/assets/images/rgraph.jpg +0 -0
  51. data/vendor/assets/images/title.png +0 -0
  52. data/vendor/assets/images/twitter-large.png +0 -0
  53. data/vendor/assets/javascripts/RGraph.modaldialog.js +0 -301
  54. data/vendor/assets/javascripts/RGraph.odo.js +0 -1265
  55. data/vendor/assets/javascripts/RGraph.pie.js +0 -2272
  56. data/vendor/assets/javascripts/RGraph.radar.js +0 -1847
  57. data/vendor/assets/javascripts/RGraph.rose.js +0 -1877
  58. data/vendor/assets/javascripts/RGraph.rscatter.js +0 -1425
  59. data/vendor/assets/javascripts/RGraph.scatter.js +0 -2970
  60. data/vendor/assets/javascripts/RGraph.semicircularprogress.js +0 -1015
  61. data/vendor/assets/javascripts/RGraph.thermometer.js +0 -1129
  62. data/vendor/assets/javascripts/RGraph.vprogress.js +0 -1452
  63. data/vendor/assets/javascripts/RGraph.waterfall.js +0 -1252
  64. data/vendor/assets/javascripts/financial-data.js +0 -1067
  65. data/vendor/assets/stylesheets/ModalDialog.css +0 -90
  66. data/vendor/assets/stylesheets/animations.css +0 -3347
  67. data/vendor/assets/stylesheets/website.css +0 -446
@@ -1,224 +1,15 @@
1
- // version: 2016-06-04
2
- /**
3
- * o--------------------------------------------------------------------------------o
4
- * | This file is part of the RGraph package - you can learn more at: |
5
- * | |
6
- * | http://www.rgraph.net |
7
- * | |
8
- * | RGraph is dual licensed under the Open Source GPL (General Public License) |
9
- * | v2.0 license and a commercial license which means that you're not bound by |
10
- * | the terms of the GPL. The commercial license starts at just 99 GBP and |
11
- * | you can read about it here: |
12
- * | |
13
- * | http://www.rgraph.net/license |
14
- * o--------------------------------------------------------------------------------o
15
- */
16
1
 
17
- RGraph = window.RGraph || {isRGraph: true};
18
-
19
-
20
- // Module pattern
21
- (function (win, doc, undefined)
22
- {
23
- var RG = RGraph,
24
- ua = navigator.userAgent,
25
- ma = Math;
26
-
27
-
28
-
29
-
30
- /**
31
- * A zoom in function
32
- *
33
- * @param e object The event object
34
- */
35
- RG.zoom =
36
- RG.Zoom = function (e)
37
- {
38
- e = RGraph.fixEventObject(e);
39
-
40
-
41
- /**
42
- * Triggered from a context menu
43
- */
44
- if (e && e.target && e.target.__canvas__) {
45
- var canvas = e.target.__canvas__;
46
-
47
- /**
48
- * This is here to facilitate zooming by just a single left click
49
- */
50
- } else if (e && e.target && e.target.__object__) {
51
- var canvas = e.target.__object__.canvas;
52
- e.stopPropagation(); // Hmmmm
53
- }
54
-
55
- // Fallback for MSIE9
56
- if (!canvas) {
57
- var registry_canvas = RGraph.Registry.get('chart.contextmenu').__canvas__;
58
- if (registry_canvas) {
59
- var canvas = registry_canvas;
60
- }
61
- }
62
-
63
- var obj = canvas.__object__;
64
- var context = obj.context;
65
- var dataurl = canvas.toDataURL();
66
- var tmp = canvas;
67
- var coords = RG.getCanvasXY(canvas);
68
- var factor = obj.Get('chart.zoom.factor') - 1;
69
-
70
- var x = coords[0];
71
- var y = coords[1];
72
-
73
- var img = document.createElement('img');
74
- img.className = 'RGraph_zoomed_canvas';
75
- img.style.border = '1px solid #ccc';
76
- img.style.width = canvas.width + 'px';
77
- img.style.height = canvas.height + 'px';
78
- img.style.position = 'absolute';
79
- img.style.left = x + 'px';
80
- img.style.top = y + 'px';
81
- img.style.backgroundColor = 'white';
82
- img.style.opacity = obj.Get('chart.zoom.fade.in') ? 0 : 1;
83
- img.style.zIndex = 99;
84
- img.src = dataurl;
85
- document.body.appendChild(img);
86
-
87
- //RGraph.Registry.Set('chart.zoomedimage', img);
88
- // Store the zoomed image in a global var - NOT the registry
89
- RGraph.zoom_image = img;
90
- RGraph.zoom_image.obj = obj;
91
-
92
- // Image onclick should not hide the image
93
- img.onclick = function (e)
94
- {
95
- e = RGraph.fixEventObject(e);
96
- e.stopPropagation();
97
- return false;
98
- }
99
-
100
- //setTimeout(function (){document.body.onclick = RGraph.HideZoomedCanvas;}, 1);
101
-
102
-
103
- var width = parseInt(canvas.width);
104
- var height = parseInt(canvas.height);
105
- var frames = obj.Get('chart.zoom.frames');
106
- var delay = obj.Get('chart.zoom.delay');
107
-
108
- // Increase the width over 10 frames - center
109
- if (obj.Get('chart.zoom.hdir') == 'center') {
110
-
111
- for (var i=1; i<=frames; ++i) {
112
- var newWidth = width * factor * (i/frames) + width;
113
- var rightHandEdge = x + canvas.width;
114
- var newLeft = (x + (canvas.width / 2)) - (newWidth / 2);
115
-
116
- setTimeout("RGraph.zoom_image.style.width = '" + String(newWidth) + "px'; RGraph.zoom_image.style.left = '" + newLeft + "px'", i * delay);
117
- }
118
-
119
- // Left
120
- } else if (obj.Get('chart.zoom.hdir') == 'left') {
121
- for (var i=1; i<=frames; ++i) {
122
- var newWidth = width * factor * (i/frames) + width;
123
- var rightHandEdge = x + canvas.width;
124
- var newLeft = rightHandEdge - newWidth;
125
-
126
- setTimeout("RGraph.zoom_image.style.width = '" + String(newWidth) + "px'; RGraph.zoom_image.style.left = '" + newLeft + "px'", i * delay);
127
- }
128
-
129
- // Right (default)
130
- } else {
131
- for (var i=1; i<=frames; ++i) {
132
- var newWidth = width * factor * (i/frames) + width;
133
- setTimeout("RGraph.zoom_image.style.width = '" + String(newWidth) + "px'", i * delay);
134
- }
135
- }
136
-
137
- // Increase the height over 10 frames - up
138
- if (obj.Get('chart.zoom.vdir') == 'up') {
139
- for (var i=1; i<=frames; ++i) {
140
- var newHeight = (height * factor * (i/frames)) + height;
141
- var bottomEdge = y + canvas.height;
142
- var newTop = bottomEdge - newHeight;
143
-
144
- setTimeout("RGraph.zoom_image.style.height = '" + String(newHeight) + "px'; RGraph.zoom_image.style.top = '" + newTop + "px'", i * delay);
145
- }
146
-
147
- // center
148
- } else if (obj.Get('chart.zoom.vdir') == 'center') {
149
- for (var i=1; i<=frames; ++i) {
150
- var newHeight = (height * factor * (i/frames)) + height;
151
- var bottomEdge = (y + (canvas.height / 2)) + (newHeight / 2);
152
- var newTop = bottomEdge - newHeight;
153
-
154
- setTimeout("RGraph.zoom_image.style.height = '" + String(newHeight) + "px'; RGraph.zoom_image.style.top = '" + newTop + "px'", i * delay);
155
- }
156
-
157
- // Down (default
158
- } else {
159
- for (var i=1; i<=frames; ++i) {
160
- setTimeout("RGraph.zoom_image.style.height = '" + String(height * factor * (i/frames) + height) + "px'", i * delay);
161
- }
162
- }
163
-
164
- // If enabled, increase the opactity over the requested number of frames
165
- if (obj.Get('chart.zoom.fade.in')) {
166
- for (var i=1; i<=frames; ++i) {
167
- setTimeout("RGraph.zoom_image.style.opacity = " + Number(i / frames), i * (delay / 2));
168
- }
169
- }
170
-
171
- // If stipulated, produce a shadow
172
- if (obj.Get('chart.zoom.shadow')) {
173
- for (var i=1; i<=frames; ++i) {
174
- setTimeout("RGraph.zoom_image.style.boxShadow = 'rgba(128,128,128," + Number(i / frames) / 2 + ") 0 0 25px'", i * delay);
175
- setTimeout("RGraph.zoom_image.style.MozBoxShadow = 'rgba(128,128,128," + Number(i / frames) / 2 + ") 0 0 25px'", i * delay);
176
- setTimeout("RGraph.zoom_image.style.WebkitBoxShadow = 'rgba(128,128,128," + Number(i / frames) / 2 + ") 0 0 25px'", i * delay);
177
- }
178
- }
179
-
180
-
181
-
182
- /**
183
- * Create the background. As of March 2013 this is always done
184
- */
185
- var div = document.createElement('DIV');
186
- div.style.backgroundColor = 'white';
187
- div.style.opacity = 0;
188
- div.style.position = 'fixed';
189
- div.style.top = 0;
190
- div.style.left = 0;
191
- div.style.width = (screen.width + 100) + 'px';
192
- div.style.height = (screen.height + 100) + 'px';
193
- div.style.zIndex = 98;
194
-
195
- // Hides the zoomed caboodle
196
- div.onclick =
197
- div.oncontextmenu = function (e)
198
- {
199
- return RG.hideZoomedCanvas(e);
200
- }
201
-
202
- div.origHeight = div.style.height;
203
-
204
- document.body.appendChild(div);
205
-
206
- RG.zoom_background = div;
207
-
208
- // If the window is resized, hide the zoom
209
- //window.onresize = RGraph.HideZoomedCanvas;
210
-
211
- for (var i=1; i<=frames; ++i) {
212
- setTimeout("RGraph.zoom_background.style.opacity = " + (Number(i / frames) * 0.8), i * (delay / 2));
213
- }
214
-
215
- /**
216
- * Fire the onzoom event
217
- */
218
- RG.fireCustomEvent(obj, 'onzoom');
219
- }
220
-
221
-
222
-
223
- // End module pattern
224
- })(window, document);
2
+ RGraph=window.RGraph||{isRGraph:true};(function(win,doc,undefined)
3
+ {var RG=RGraph,ua=navigator.userAgent,ma=Math;RG.zoom=RG.Zoom=function(e)
4
+ {e=RGraph.fixEventObject(e);if(e&&e.target&&e.target.__canvas__){var canvas=e.target.__canvas__;}else if(e&&e.target&&e.target.__object__){var canvas=e.target.__object__.canvas;e.stopPropagation();}
5
+ if(!canvas){var registry_canvas=RGraph.Registry.get('chart.contextmenu').__canvas__;if(registry_canvas){var canvas=registry_canvas;}}
6
+ var obj=canvas.__object__;var context=obj.context;var dataurl=canvas.toDataURL();var tmp=canvas;var coords=RG.getCanvasXY(canvas);var factor=obj.Get('chart.zoom.factor')-1;var x=coords[0];var y=coords[1];var img=document.createElement('img');img.className='RGraph_zoomed_canvas';img.style.border='1px solid #ccc';img.style.width=canvas.width+'px';img.style.height=canvas.height+'px';img.style.position='absolute';img.style.left=x+'px';img.style.top=y+'px';img.style.backgroundColor='white';img.style.opacity=obj.Get('chart.zoom.fade.in')?0:1;img.style.zIndex=99;img.src=dataurl;document.body.appendChild(img);RGraph.zoom_image=img;RGraph.zoom_image.obj=obj;img.onclick=function(e)
7
+ {e=RGraph.fixEventObject(e);e.stopPropagation();return false;}
8
+ var width=parseInt(canvas.width);var height=parseInt(canvas.height);var frames=obj.Get('chart.zoom.frames');var delay=obj.Get('chart.zoom.delay');if(obj.Get('chart.zoom.hdir')=='center'){for(var i=1;i<=frames;++i){var newWidth=width*factor*(i/frames)+width;var rightHandEdge=x+canvas.width;var newLeft=(x+(canvas.width/2))-(newWidth/2);setTimeout("RGraph.zoom_image.style.width = '"+String(newWidth)+"px'; RGraph.zoom_image.style.left = '"+newLeft+"px'",i*delay);}}else if(obj.Get('chart.zoom.hdir')=='left'){for(var i=1;i<=frames;++i){var newWidth=width*factor*(i/frames)+width;var rightHandEdge=x+canvas.width;var newLeft=rightHandEdge-newWidth;setTimeout("RGraph.zoom_image.style.width = '"+String(newWidth)+"px'; RGraph.zoom_image.style.left = '"+newLeft+"px'",i*delay);}}else{for(var i=1;i<=frames;++i){var newWidth=width*factor*(i/frames)+width;setTimeout("RGraph.zoom_image.style.width = '"+String(newWidth)+"px'",i*delay);}}
9
+ if(obj.Get('chart.zoom.vdir')=='up'){for(var i=1;i<=frames;++i){var newHeight=(height*factor*(i/frames))+height;var bottomEdge=y+canvas.height;var newTop=bottomEdge-newHeight;setTimeout("RGraph.zoom_image.style.height = '"+String(newHeight)+"px'; RGraph.zoom_image.style.top = '"+newTop+"px'",i*delay);}}else if(obj.Get('chart.zoom.vdir')=='center'){for(var i=1;i<=frames;++i){var newHeight=(height*factor*(i/frames))+height;var bottomEdge=(y+(canvas.height/2))+(newHeight/2);var newTop=bottomEdge-newHeight;setTimeout("RGraph.zoom_image.style.height = '"+String(newHeight)+"px'; RGraph.zoom_image.style.top = '"+newTop+"px'",i*delay);}}else{for(var i=1;i<=frames;++i){setTimeout("RGraph.zoom_image.style.height = '"+String(height*factor*(i/frames)+height)+"px'",i*delay);}}
10
+ if(obj.Get('chart.zoom.fade.in')){for(var i=1;i<=frames;++i){setTimeout("RGraph.zoom_image.style.opacity = "+Number(i/frames),i*(delay/2));}}
11
+ if(obj.Get('chart.zoom.shadow')){for(var i=1;i<=frames;++i){setTimeout("RGraph.zoom_image.style.boxShadow = 'rgba(128,128,128,"+Number(i/frames)/2+") 0 0 25px'",i*delay);setTimeout("RGraph.zoom_image.style.MozBoxShadow = 'rgba(128,128,128,"+Number(i/frames)/2+") 0 0 25px'",i*delay);setTimeout("RGraph.zoom_image.style.WebkitBoxShadow = 'rgba(128,128,128,"+Number(i/frames)/2+") 0 0 25px'",i*delay);}}
12
+ var div=document.createElement('DIV');div.style.backgroundColor='white';div.style.opacity=0;div.style.position='fixed';div.style.top=0;div.style.left=0;div.style.width=(screen.width+100)+'px';div.style.height=(screen.height+100)+'px';div.style.zIndex=98;div.onclick=div.oncontextmenu=function(e)
13
+ {return RG.hideZoomedCanvas(e);}
14
+ div.origHeight=div.style.height;document.body.appendChild(div);RG.zoom_background=div;for(var i=1;i<=frames;++i){setTimeout("RGraph.zoom_background.style.opacity = "+(Number(i/frames)*0.8),i*(delay/2));}
15
+ RG.fireCustomEvent(obj,'onzoom');}})(window,document);
@@ -0,0 +1,71 @@
1
+
2
+ RGraph=window.RGraph||{isRGraph:true};RGraph.CornerGauge=function(conf)
3
+ {if(typeof conf==='object'&&typeof conf.min==='number'&&typeof conf.max==='number'&&typeof conf.value!=='undefined'&&typeof conf.id==='string'){var id=conf.id
4
+ var canvas=document.getElementById(id);var min=conf.min;var max=conf.max;var value=conf.value;var parseConfObjectForOptions=true;}else{var id=conf;var canvas=document.getElementById(id);var min=arguments[1];var max=arguments[2];var value=arguments[3];}
5
+ this.id=id;this.canvas=canvas;this.context=this.canvas.getContext?this.canvas.getContext("2d",{alpha:(typeof id==='object'&&id.alpha===false)?false:true}):null;this.canvas.__object__=this;this.type='cornergauge';this.min=min;this.max=max;this.value=RGraph.stringsToNumbers(value);this.angles={};this.angles.needle=[];this.centerpin={};this.isRGraph=true;this.currentValue=null;this.uid=RGraph.CreateUID();this.canvas.uid=this.canvas.uid?this.canvas.uid:RGraph.CreateUID();this.coordsText=[];this.original_colors=[];this.firstDraw=true;if(typeof(this.value)=='object'){for(var i=0;i<this.value.length;++i){if(this.value[i]>this.max)this.value[i]=max;if(this.value[i]<this.min)this.value[i]=min;}}else{if(this.value>this.max)this.value=max;if(this.value<this.min)this.value=min;}
6
+ this.properties={'chart.centerx':null,'chart.centery':null,'chart.radius':null,'chart.gutter.left':25,'chart.gutter.right':25,'chart.gutter.top':25,'chart.gutter.bottom':25,'chart.strokestyle':'black','chart.linewidth':2,'chart.title':'','chart.title.vpos':0.5,'chart.title.size':null,'chart.title.x':null,'chart.title.y':null,'chart.title.bold':true,'chart.text.font':'Arial','chart.text.color':'#666','chart.text.size':10,'chart.background.gradient.color1':'#ddd','chart.background.gradient.color2':'white','chart.shadow':true,'chart.shadow.color':'gray','chart.shadow.offsetx':0,'chart.shadow.offsety':0,'chart.shadow.blur':15,'chart.scale.decimals':0,'chart.scale.point':'.','chart.scale.thousand':',','chart.units.pre':'','chart.units.post':'','chart.resizable':false,'chart.chart.resize.handle.background':null,'chart.adjustable':false,'chart.annotatable':false,'chart.annotate.color':'black','chart.colors.ranges':null,'chart.red.start':min+(0.9*(this.max-min)),'chart.green.end':min+(0.7*(this.max-min)),'chart.red.color':'red','chart.yellow.color':'yellow','chart.green.color':'#0f0','chart.value.text':true,'chart.value.text.units.pre':'','chart.value.text.units.post':'','chart.value.text.boxed':true,'chart.value.text.font':'Arial','chart.value.text.size':18,'chart.value.text.bold':false,'chart.value.text.decimals':0,'chart.centerpin.stroke':'rgba(0,0,0,0)','chart.centerpin.fill':null,'chart.centerpin.color':'blue','chart.needle.colors':['#ccc','#D5604D','red','green','yellow'],'chart.zoom.factor':1.5,'chart.zoom.fade.in':true,'chart.zoom.fade.out':true,'chart.zoom.hdir':'right','chart.zoom.vdir':'down','chart.zoom.frames':25,'chart.zoom.delay':16.666,'chart.zoom.shadow':true,'chart.zoom.background':true}
7
+ if(!this.canvas.__rgraph_aa_translated__){this.context.translate(0.5,0.5);this.canvas.__rgraph_aa_translated__=true;}
8
+ var RG=RGraph;var ca=this.canvas;var co=ca.getContext('2d');var prop=this.properties;var jq=jQuery;var pa=RG.Path;var win=window;var doc=document;var ma=Math;this.set=this.Set=function(name,value)
9
+ {if(arguments.length===1&&typeof arguments[0]==='object'){RG.parseObjectStyleConfig(this,arguments[0]);return this;}
10
+ name=name.toLowerCase();if(name.substr(0,6)!='chart.'){name='chart.'+name;}
11
+ prop[name]=value;return this;};this.get=this.Get=function(name)
12
+ {if(name.substr(0,6)!='chart.'){name='chart.'+name;}
13
+ return prop[name];};this.draw=this.Draw=function()
14
+ {RG.FireCustomEvent(this,'onbeforedraw');this.currentValue=this.value;if(typeof this.gutterLeft=='undefined'){this.gutterLeft=prop['chart.gutter.left'];this.gutterRight=prop['chart.gutter.right'];this.gutterTop=prop['chart.gutter.top'];this.gutterBottom=prop['chart.gutter.bottom'];}
15
+ this.radius=Math.min((ca.width-this.gutterLeft-this.gutterRight),(ca.height-this.gutterTop-this.gutterBottom));if(typeof(prop['chart.radius'])=='number')this.radius=prop['chart.radius'];this.centerx=(ca.width/2)-(this.radius/2)+Math.max(30,this.radius*0.1);this.centery=(ca.height/2)+(this.radius/2)-(this.radius*0.1);this.coordsText=[];if(typeof prop['chart.centerx']==='number')this.centerx=prop['chart.centerx'];if(typeof prop['chart.centery']==='number')this.centery=prop['chart.centery'];if(!this.colorsParsed){this.parseColors();this.colorsParsed=true;}
16
+ this.DrawBackGround();this.DrawTickmarks();this.DrawColorBands();this.DrawLabel();this.DrawLabels();if(typeof this.value==='object'){for(var i=0,len=this.value.length;i<len;++i){this.DrawNeedle(i,this.value[i],this.radius-65);}}else{this.DrawNeedle(0,this.value,this.radius-65);}
17
+ this.DrawCenterpin();var size=prop['chart.title.size']?prop['chart.title.size']:prop['chart.text.size']+2
18
+ prop['chart.title.y']=this.centery+20-this.radius-((1.5*size)/2);RGraph.DrawTitle(this,prop['chart.title'],this.guttertop,this.centerx+(this.radius/2),size);if(prop['chart.contextmenu']){RGraph.ShowContext(this);}
19
+ if(prop['chart.resizable']){RGraph.AllowResizing(this);}
20
+ RGraph.InstallEventListeners(this);if(this.firstDraw){RG.fireCustomEvent(this,'onfirstdraw');this.firstDraw=false;this.firstDrawFunc();}
21
+ RGraph.FireCustomEvent(this,'ondraw');return this;};this.drawBackGround=this.DrawBackGround=function()
22
+ {if(prop['chart.shadow']){RGraph.SetShadow(this,prop['chart.shadow.color'],prop['chart.shadow.offsetx'],prop['chart.shadow.offsety'],prop['chart.shadow.blur']);}
23
+ co.strokeStyle=prop['chart.strokestyle'];co.lineWidth=prop['chart.linewidth']?prop['chart.linewidth']:0.0001;co.beginPath();co.arc(this.centerx,this.centery,30,0,RGraph.TWOPI,false);co.stroke();co.beginPath();co.moveTo(this.centerx-20,this.centery+20);co.arc(this.centerx-20,this.centery+20,this.radius,RGraph.PI+RGraph.HALFPI,RGraph.TWOPI,false);co.closePath();co.fill();co.stroke();RG.NoShadow(this);co.strokeStyle=prop['chart.strokestyle'];co.lineWidth=prop['chart.linewidth']?prop['chart.linewidth']:0.0001;co.beginPath();co.moveTo(this.centerx-20,this.centery+20);co.arc(this.centerx-20,this.centery+20,this.radius,RGraph.PI+RGraph.HALFPI,RGraph.TWOPI,false);co.closePath();co.stroke();RGraph.NoShadow(this);co.lineWidth=0;co.fillStyle=RGraph.RadialGradient(this,this.centerx,this.centery,0,this.centerx,this.centery,this.radius*0.5,prop['chart.background.gradient.color1'],prop['chart.background.gradient.color2']);co.beginPath();co.moveTo(this.centerx,this.centery);co.arc(this.centerx,this.centery,30,0,RGraph.TWOPI,0);co.closePath();co.fill();co.beginPath();co.moveTo(this.centerx-20,this.centery+20);co.lineTo(this.centerx-20,this.centery+20-this.radius);co.arc(this.centerx-20,this.centery+20,this.radius,RGraph.PI+RGraph.HALFPI,RGraph.TWOPI,false);co.closePath();co.fill();co.beginPath();co.lineWidth=1;co.strokeStyle='#eee';for(var i=0;i<=5;++i){var p1=RG.getRadiusEndPoint(this.centerx,this.centery,(RGraph.HALFPI/5*i)+RGraph.PI+RGraph.HALFPI,30);var p2=RG.getRadiusEndPoint(this.centerx,this.centery,(RGraph.HALFPI/5*i)+RGraph.PI+RGraph.HALFPI,this.radius-90);co.moveTo(p1[0],p1[1]);co.lineTo(p2[0],p2[1]);}
24
+ co.stroke();};this.drawNeedle=this.DrawNeedle=function(index,value,radius)
25
+ {var grad=RG.RadialGradient(this,this.centerx,this.centery,0,this.centerx,this.centery,20,'rgba(0,0,0,0)',prop['chart.needle.colors'][index])
26
+ this.angles.needle[index]=(((value-this.min)/(this.max-this.min))*RG.HALFPI)+RG.PI+RG.HALFPI;co.lineWidth=1
27
+ co.strokeStyle='rgba(0,0,0,0)';co.fillStyle=grad;co.beginPath();co.moveTo(this.centerx,this.centery);co.arc(this.centerx,this.centery,10,this.angles.needle[index]-RG.HALFPI,this.angles.needle[index]-RG.HALFPI+0.000001,false);co.arc(this.centerx,this.centery,radius-30,this.angles.needle[index],this.angles.needle[index]+0.000001,false);co.arc(this.centerx,this.centery,10,this.angles.needle[index]+RG.HALFPI,this.angles.needle[index]+RG.HALFPI+0.000001,false);co.stroke();co.fill();};this.drawCenterpin=this.DrawCenterpin=function()
28
+ {if(!prop['chart.centerpin.fill']){prop['chart.centerpin.fill']=RG.RadialGradient(this,this.centerx+5,this.centery-5,0,this.centerx+5,this.centery-5,20,'white',prop['chart.centerpin.color'])}
29
+ co.strokeStyle=prop['chart.centerpin.stroke'];co.fillStyle=prop['chart.centerpin.fill'];co.beginPath();co.lineWidth=2;co.arc(this.centerx,this.centery,15,0,RGraph.TWOPI,false);co.stroke();co.fill();};this.drawLabels=this.DrawLabels=function()
30
+ {var numLabels=6;co.fillStyle=prop['chart.text.color'];for(var i=0;i<numLabels;++i){co.beginPath();var num=Number(this.min+((this.max-this.min)*(i/(numLabels-1)))).toFixed(prop['chart.scale.decimals']);num=RG.number_format(this,num,prop['chart.units.pre'],prop['chart.units.post']);var angle=(i*18)/(180/RG.PI);RG.Text2(this,{'font':prop['chart.text.font'],'size':prop['chart.text.size'],'x':this.centerx+ma.sin(angle)*(this.radius-53),'y':this.centery-ma.cos(angle)*(this.radius-53),'text':String(num),'valign':'top','halign':'center','angle':90*(i/(numLabels-1)),'tag':'scale'});co.fill();}};this.drawTickmarks=this.DrawTickmarks=function()
31
+ {var bigTicks=5;var smallTicks=25;for(var i=0;i<smallTicks;++i){co.beginPath();var angle=(RG.HALFPI/(smallTicks-1))*i
32
+ co.lineWidth=1;co.arc(this.centerx,this.centery,this.radius-44,RG.PI+RG.HALFPI+angle,RG.PI+RG.HALFPI+angle+0.0001,false);co.arc(this.centerx,this.centery,this.radius-46,RG.PI+RG.HALFPI+angle,RG.PI+RG.HALFPI+angle+0.0001,false);co.stroke();}
33
+ for(var i=0;i<bigTicks;++i){co.beginPath();var angle=(RG.HALFPI/(bigTicks-1))*i
34
+ co.lineWidth=1;co.arc(this.centerx,this.centery,this.radius-43,RG.PI+RG.HALFPI+angle,RG.PI+RG.HALFPI+angle+0.0001,false);co.arc(this.centerx,this.centery,this.radius-47,RG.PI+RG.HALFPI+angle,RG.PI+RG.HALFPI+angle+0.0001,false);co.stroke();}};this.DrawColorBands=function()
35
+ {if(RG.is_array(prop['chart.colors.ranges'])){var ranges=prop['chart.colors.ranges'];for(var i=0,len=ranges.length;i<len;++i){co.fillStyle=ranges[i][2];co.lineWidth=0;co.beginPath();co.arc(this.centerx,this.centery,this.radius-54-(prop['chart.text.size']*1.5),(((ranges[i][0]-this.min)/(this.max-this.min))*RG.HALFPI)+(RG.PI+RG.HALFPI),(((ranges[i][1]-this.min)/(this.max-this.min))*RG.HALFPI)+(RG.PI+RG.HALFPI),false);co.arc(this.centerx,this.centery,this.radius-54-10-(prop['chart.text.size']*1.5),(((ranges[i][1]-this.min)/(this.max-this.min))*RG.HALFPI)+(RG.PI+RG.HALFPI),(((ranges[i][0]-this.min)/(this.max-this.min))*RG.HALFPI)+(RG.PI+RG.HALFPI),true);co.closePath();co.fill();}
36
+ return;}
37
+ co.strokeStyle=prop['chart.green.color'];co.fillStyle=prop['chart.green.color'];var greenStart=RG.PI+RG.HALFPI;var greenEnd=greenStart+(RG.TWOPI-greenStart)*((prop['chart.green.end']-this.min)/(this.max-this.min))
38
+ co.beginPath();co.arc(this.centerx,this.centery,this.radius-54-(prop['chart.text.size']*1.5),greenStart,greenEnd,false);co.arc(this.centerx,this.centery,this.radius-54-(prop['chart.text.size']*1.5)-10,greenEnd,greenStart,true);co.fill();co.strokeStyle=prop['chart.yellow.color'];co.fillStyle=prop['chart.yellow.color'];var yellowStart=greenEnd;var yellowEnd=(((prop['chart.red.start']-this.min)/(this.max-this.min))*RG.HALFPI)+RG.PI+RG.HALFPI;co.beginPath();co.arc(this.centerx,this.centery,this.radius-54-(prop['chart.text.size']*1.5),yellowStart,yellowEnd,false);co.arc(this.centerx,this.centery,this.radius-54-(prop['chart.text.size']*1.5)-10,yellowEnd,yellowStart,true);co.fill();co.strokeStyle=prop['chart.red.color'];co.fillStyle=prop['chart.red.color'];var redStart=yellowEnd;var redEnd=RGraph.TWOPI;co.beginPath();co.arc(this.centerx,this.centery,this.radius-54-(prop['chart.text.size']*1.5),redStart,redEnd,false);co.arc(this.centerx,this.centery,this.radius-54-(prop['chart.text.size']*1.5)-10,redEnd,redStart,true);co.fill();};this.drawLabel=this.DrawLabel=function()
39
+ {if(prop['chart.value.text']){co.strokeStyle=prop['chart.text.color'];co.fillStyle=prop['chart.text.color'];var value=typeof(this.value)=='number'?this.value.toFixed(prop['chart.value.text.decimals']):this.value;if(typeof(value)=='object'){for(var i=0;i<value.length;++i){value[i]=parseFloat(value[i]).toFixed(prop['chart.value.text.decimals']);}
40
+ value=value.toString();}
41
+ RG.Text2(this,{'font':prop['chart.value.text.font'],'size':prop['chart.value.text.size'],'x':this.centerx+(ma.cos((RG.PI/180)*45)*(this.radius/3)),'y':this.centery-(ma.sin((RG.PI/180)*45)*(this.radius/3)),'text':prop['chart.value.text.units.pre']+value+prop['chart.value.text.units.post'],'valign':'center','halign':'center','bounding':prop['chart.value.text.boxed'],'boundingFill':'white','bold':prop['chart.value.text.bold'],'tag':'value.text'});}};this.getShape=function(e){};this.getValue=function(e)
42
+ {var mouseXY=RGraph.getMouseXY(e);var mouseX=mouseXY[0];var mouseY=mouseXY[1];var angle=RG.getAngleByXY(this.centerx,this.centery,mouseX,mouseY);if(angle>RG.TWOPI&&angle<(RG.PI+RG.HALFPI)){return null;}
43
+ var value=((angle-(RG.PI+RG.HALFPI))/(RG.TWOPI-(RG.PI+RG.HALFPI)))*(this.max-this.min);value=value+this.min;if(value<this.min){value=this.min}
44
+ if(value>this.max){value=this.max}
45
+ if(mouseX>this.centerx&&mouseY>this.centery){value=this.max;}
46
+ return value;};this.getObjectByXY=function(e)
47
+ {var mouseXY=RGraph.getMouseXY(e);if(mouseXY[0]>(this.centerx-5)&&mouseXY[0]<(this.centerx+this.radius)&&mouseXY[1]>(this.centery-this.radius)&&mouseXY[1]<(this.centery+5)&&RG.getHypLength(this.centerx,this.centery,mouseXY[0],mouseXY[1])<=this.radius){return this;}};this.adjusting_mousemove=this.Adjusting_mousemove=function(e)
48
+ {if(prop['chart.adjustable']&&RG.Registry.Get('chart.adjusting')&&RG.Registry.Get('chart.adjusting').uid==this.uid){this.value=this.getValue(e);RG.Clear(ca);RG.RedrawCanvas(ca);RG.FireCustomEvent(this,'onadjust');}};this.getAngle=function(value)
49
+ {if(value<this.min||value>this.max){return null;}
50
+ var angle=((value-this.min)/(this.max-this.min))*RG.HALFPI
51
+ angle+=(RG.PI+RG.HALFPI);return angle;};this.parseColors=function()
52
+ {if(this.original_colors.length===0){this.original_colors['chart.colors.ranges']=RG.array_clone(prop['chart.colors.ranges']);this.original_colors['chart.green.color']=RG.array_clone(prop['chart.green.color']);this.original_colors['chart.yellow.color']=RG.array_clone(prop['chart.yellow.color']);this.original_colors['chart.red.color']=RG.array_clone(prop['chart.red.color']);}
53
+ if(!RG.is_null(prop['chart.colors.ranges'])){for(var i=0;i<prop['chart.colors.ranges'].length;++i){prop['chart.colors.ranges'][i][2]=this.parseSingleColorForGradient(prop['chart.colors.ranges'][i][2]);}}else{prop['chart.green.color']=this.parseSingleColorForGradient(prop['chart.green.color']);prop['chart.yellow.color']=this.parseSingleColorForGradient(prop['chart.yellow.color']);prop['chart.red.color']=this.parseSingleColorForGradient(prop['chart.red.color']);}};this.reset=function()
54
+ {};this.parseSingleColorForGradient=function(color)
55
+ {if(!color||typeof(color)!='string'){return color;}
56
+ if(color.match(/^gradient\((.*)\)$/i)){var parts=RegExp.$1.split(':');var radius_start=this.radius-54-prop['chart.text.size'];var radius_end=radius_start-15;var grad=co.createRadialGradient(this.centerx,this.centery,radius_start,this.centerx,this.centery,radius_end);var diff=1/(parts.length-1);grad.addColorStop(0,RG.trim(parts[0]));for(var j=1,len=parts.length;j<len;++j){grad.addColorStop(j*diff,RG.trim(parts[j]));}}
57
+ return grad?grad:color;};this.on=function(type,func)
58
+ {if(type.substr(0,2)!=='on'){type='on'+type;}
59
+ this[type]=func;return this;};this.firstDrawFunc=function()
60
+ {};this.grow=function()
61
+ {var opt=arguments[0];var callback=arguments[1];var numFrames=30;var frame=0;var obj=this;if(typeof this.value==='number'){var origValue=Number(this.currentValue);if(this.currentValue===null){this.currentValue=this.min;origValue=this.min;}
62
+ var newValue=this.value;var diff=newValue-origValue;var step=(diff/numFrames);var frame=0;var iterator=function()
63
+ {frame++;obj.value=((frame/numFrames)*diff)+origValue
64
+ if(obj.value>obj.max)obj.value=obj.max;if(obj.value<obj.min)obj.value=obj.min;RGraph.Clear(obj.canvas);RGraph.RedrawCanvas(obj.canvas);if(frame<30){RGraph.Effects.updateCanvas(iterator);}else if(typeof callback==='function'){callback(obj);}};iterator();}else{if(obj.currentValue==null){obj.currentValue=[];for(var i=0,len=obj.value.length;i<len;++i){obj.currentValue[i]=obj.min;}
65
+ origValue=RG.array_clone(obj.currentValue);}
66
+ var origValue=RG.array_clone(obj.currentValue);var newValue=RG.array_clone(obj.value);var diff=[];var step=[];for(var i=0,len=newValue.length;i<len;++i){diff[i]=newValue[i]-Number(obj.currentValue[i]);step[i]=(diff[i]/numFrames);}
67
+ var max=this.max;var min=this.min;var iterator=function()
68
+ {frame++;for(var i=0,len=obj.value.length;i<len;++i){obj.value[i]=((frame/numFrames)*diff[i])+origValue[i];if(obj.value[i]>max)obj.value[i]=max;if(obj.value[i]<min)obj.value[i]=min;RG.clear(obj.canvas);RG.redrawCanvas(obj.canvas);}
69
+ if(frame<30){RG.Effects.updateCanvas(iterator);}else if(typeof callback==='function'){callback(obj);}};iterator();}
70
+ return this;}
71
+ RG.Register(this);if(parseConfObjectForOptions){RG.parseObjectStyleConfig(this,conf.options);}};