audit_rails 2.0.3 → 2.0.4

Sign up to get free protection for your applications and to get access to all the features.
@@ -8,6 +8,7 @@
8
8
  * You're free to add application-wide styles to this file and they'll appear at the top of the
9
9
  * compiled file, but it's generally better to create a new file per style scope.
10
10
  *
11
+ *= require sleek_charts
11
12
  *= require audit_rails/jquery-ui
12
13
  *= require audit_rails/date-picker
13
14
  *= require audit_rails/bootstrap
@@ -1,75 +1,24 @@
1
1
  .left {
2
2
  float: left;
3
3
  }
4
+
4
5
  .hide{
5
6
  display: none;
6
7
  }
8
+
7
9
  .audit-row{
8
10
  width: 60%;
9
11
  border-radius: 15px;
10
12
  }
13
+
11
14
  .clear{
12
15
  clear: both;
13
16
  }
14
- .axis path,
15
- .axis line {
16
- fill: none;
17
- stroke: #000;
18
- shape-rendering: crispEdges;
19
- }
20
-
21
- .bar {
22
- fill: orange;
23
- }
24
-
25
- .bar:hover {
26
- fill: orangered ;
27
- }
28
-
29
- .line {
30
- fill: white;
31
- border-color: orange;
32
- }
33
- .line:hover {
34
- border-color: orangered;
35
- }
36
-
37
- .x.axis path {
38
- /*display: none;*/
39
- }
40
-
41
- .d3-tip {
42
- line-height: 1;
43
- font-weight: bold;
44
- padding: 12px;
45
- background: rgba(0, 0, 0, 0.8);
46
- color: #fff;
47
- border-radius: 2px;
48
- }
49
-
50
- /* Creates a small triangle extender for the tooltip */
51
- .d3-tip:after {
52
- box-sizing: border-box;
53
- display: inline;
54
- font-size: 10px;
55
- width: 100%;
56
- line-height: 1;
57
- color: rgba(0, 0, 0, 0.8);
58
- content: "\25BC";
59
- position: absolute;
60
- text-align: center;
61
- }
62
-
63
- /* Style northward tooltips differently */
64
- .d3-tip.n:after {
65
- margin: -1px 0 0 0;
66
- top: 100%;
67
- left: 0;
68
- }
69
17
 
70
18
  .page-views{
71
19
  width: 245px;
72
20
  }
21
+
73
22
  .left-navigation{
74
23
  min-height: 650px;
75
24
  }
@@ -78,6 +27,7 @@ a.active-item, a.active-item:hover{
78
27
  background-color: skyblue;
79
28
  color: white;
80
29
  }
30
+
81
31
  a.active-item span.badge{
82
32
  background-color: white;
83
33
  color: #428bca;
@@ -91,41 +41,12 @@ a.active-item span.badge{
91
41
  font-style: italic;
92
42
  }
93
43
 
94
-
95
44
  #pageViewsByUser{
96
45
  padding-left: 45px;
97
46
  padding-top: 10px;
98
47
  width: 680px;
99
48
  }
100
49
 
101
-
102
50
  .slice{
103
51
  font-size: 10px;
104
52
  }
105
-
106
- /* Begin hand crafted tooltip */
107
- div.tooltip {
108
- position: absolute;
109
- text-align: center;
110
- line-height: 1;
111
- font-weight: bold;
112
- padding: 12px;
113
- background: rgba(0, 0, 0, 0.8);
114
- color: #fff;
115
- border-radius: 2px;
116
- pointer-events: none;
117
- }
118
- div.tooltip:after {
119
- box-sizing: border-box;
120
- display: inline;
121
- font-size: 10px;
122
- width: 100%;
123
- line-height: 1;
124
- color: rgba(0, 0, 0, 0.8);
125
- content: "\25BC";
126
- position: absolute;
127
- text-align: center;
128
- top: 100%;
129
- left: 0%;
130
- }
131
- /* End hand crafted tooltip */
@@ -5,6 +5,13 @@ module AuditRails
5
5
  class Engine < ::Rails::Engine
6
6
  isolate_namespace AuditRails
7
7
 
8
+ initializer :append_dependent_assets_path, :group => :all do |app|
9
+ require 'sleek_charts'
10
+ engine_root = SleekCharts::Engine.root
11
+ app.config.assets.paths.push(engine_root + 'app/assets/javascripts')
12
+ app.config.assets.paths.push(engine_root + 'app/assets/stylesheets')
13
+ end
14
+
8
15
  initializer "audit_rails.load_helpers" do |app|
9
16
  ActionController::Base.send :include, AuditRails::AuditsHelper
10
17
  end
@@ -1,3 +1,3 @@
1
1
  module AuditRails
2
- VERSION = "2.0.3"
2
+ VERSION = "2.0.4"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: audit_rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.3
4
+ version: 2.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Gourav Tiwari
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-12-06 00:00:00.000000000 Z
11
+ date: 2013-12-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -30,6 +30,20 @@ dependencies:
30
30
  - - <
31
31
  - !ruby/object:Gem::Version
32
32
  version: '5'
33
+ - !ruby/object:Gem::Dependency
34
+ name: sleek_charts
35
+ requirement: !ruby/object:Gem::Requirement
36
+ requirements:
37
+ - - '>='
38
+ - !ruby/object:Gem::Version
39
+ version: '0'
40
+ type: :runtime
41
+ prerelease: false
42
+ version_requirements: !ruby/object:Gem::Requirement
43
+ requirements:
44
+ - - '>='
45
+ - !ruby/object:Gem::Version
46
+ version: '0'
33
47
  - !ruby/object:Gem::Dependency
34
48
  name: to_xls
35
49
  requirement: !ruby/object:Gem::Requirement
@@ -227,9 +241,6 @@ files:
227
241
  - app/assets/javascripts/audit_rails/application.js
228
242
  - app/assets/javascripts/audit_rails/audit.js
229
243
  - app/assets/javascripts/audit_rails/bootstrap.js
230
- - app/assets/javascripts/audit_rails/Chart.min.js
231
- - app/assets/javascripts/audit_rails/d3/d3.tip.js
232
- - app/assets/javascripts/audit_rails/d3/d3.v3.js
233
244
  - app/assets/javascripts/audit_rails/date-picker.js
234
245
  - app/assets/javascripts/audit_rails/hourly-views.js
235
246
  - app/assets/javascripts/audit_rails/jquery-ui.js
@@ -1,39 +0,0 @@
1
- var Chart=function(s){function v(a,c,b){a=A((a-c.graphMin)/(c.steps*c.stepValue),1,0);return b*c.steps*a}function x(a,c,b,e){function h(){g+=f;var k=a.animation?A(d(g),null,0):1;e.clearRect(0,0,q,u);a.scaleOverlay?(b(k),c()):(c(),b(k));if(1>=g)D(h);else if("function"==typeof a.onAnimationComplete)a.onAnimationComplete()}var f=a.animation?1/A(a.animationSteps,Number.MAX_VALUE,1):1,d=B[a.animationEasing],g=a.animation?0:1;"function"!==typeof c&&(c=function(){});D(h)}function C(a,c,b,e,h,f){var d;a=
2
- Math.floor(Math.log(e-h)/Math.LN10);h=Math.floor(h/(1*Math.pow(10,a)))*Math.pow(10,a);e=Math.ceil(e/(1*Math.pow(10,a)))*Math.pow(10,a)-h;a=Math.pow(10,a);for(d=Math.round(e/a);d<b||d>c;)a=d<b?a/2:2*a,d=Math.round(e/a);c=[];z(f,c,d,h,a);return{steps:d,stepValue:a,graphMin:h,labels:c}}function z(a,c,b,e,h){if(a)for(var f=1;f<b+1;f++)c.push(E(a,{value:(e+h*f).toFixed(0!=h%1?h.toString().split(".")[1].length:0)}))}function A(a,c,b){return!isNaN(parseFloat(c))&&isFinite(c)&&a>c?c:!isNaN(parseFloat(b))&&
3
- isFinite(b)&&a<b?b:a}function y(a,c){var b={},e;for(e in a)b[e]=a[e];for(e in c)b[e]=c[e];return b}function E(a,c){var b=!/\W/.test(a)?F[a]=F[a]||E(document.getElementById(a).innerHTML):new Function("obj","var p=[],print=function(){p.push.apply(p,arguments);};with(obj){p.push('"+a.replace(/[\r\t\n]/g," ").split("<%").join("\t").replace(/((^|%>)[^\t]*)'/g,"$1\r").replace(/\t=(.*?)%>/g,"',$1,'").split("\t").join("');").split("%>").join("p.push('").split("\r").join("\\'")+"');}return p.join('');");return c?
4
- b(c):b}var r=this,B={linear:function(a){return a},easeInQuad:function(a){return a*a},easeOutQuad:function(a){return-1*a*(a-2)},easeInOutQuad:function(a){return 1>(a/=0.5)?0.5*a*a:-0.5*(--a*(a-2)-1)},easeInCubic:function(a){return a*a*a},easeOutCubic:function(a){return 1*((a=a/1-1)*a*a+1)},easeInOutCubic:function(a){return 1>(a/=0.5)?0.5*a*a*a:0.5*((a-=2)*a*a+2)},easeInQuart:function(a){return a*a*a*a},easeOutQuart:function(a){return-1*((a=a/1-1)*a*a*a-1)},easeInOutQuart:function(a){return 1>(a/=0.5)?
5
- 0.5*a*a*a*a:-0.5*((a-=2)*a*a*a-2)},easeInQuint:function(a){return 1*(a/=1)*a*a*a*a},easeOutQuint:function(a){return 1*((a=a/1-1)*a*a*a*a+1)},easeInOutQuint:function(a){return 1>(a/=0.5)?0.5*a*a*a*a*a:0.5*((a-=2)*a*a*a*a+2)},easeInSine:function(a){return-1*Math.cos(a/1*(Math.PI/2))+1},easeOutSine:function(a){return 1*Math.sin(a/1*(Math.PI/2))},easeInOutSine:function(a){return-0.5*(Math.cos(Math.PI*a/1)-1)},easeInExpo:function(a){return 0==a?1:1*Math.pow(2,10*(a/1-1))},easeOutExpo:function(a){return 1==
6
- a?1:1*(-Math.pow(2,-10*a/1)+1)},easeInOutExpo:function(a){return 0==a?0:1==a?1:1>(a/=0.5)?0.5*Math.pow(2,10*(a-1)):0.5*(-Math.pow(2,-10*--a)+2)},easeInCirc:function(a){return 1<=a?a:-1*(Math.sqrt(1-(a/=1)*a)-1)},easeOutCirc:function(a){return 1*Math.sqrt(1-(a=a/1-1)*a)},easeInOutCirc:function(a){return 1>(a/=0.5)?-0.5*(Math.sqrt(1-a*a)-1):0.5*(Math.sqrt(1-(a-=2)*a)+1)},easeInElastic:function(a){var c=1.70158,b=0,e=1;if(0==a)return 0;if(1==(a/=1))return 1;b||(b=0.3);e<Math.abs(1)?(e=1,c=b/4):c=b/(2*
7
- Math.PI)*Math.asin(1/e);return-(e*Math.pow(2,10*(a-=1))*Math.sin((1*a-c)*2*Math.PI/b))},easeOutElastic:function(a){var c=1.70158,b=0,e=1;if(0==a)return 0;if(1==(a/=1))return 1;b||(b=0.3);e<Math.abs(1)?(e=1,c=b/4):c=b/(2*Math.PI)*Math.asin(1/e);return e*Math.pow(2,-10*a)*Math.sin((1*a-c)*2*Math.PI/b)+1},easeInOutElastic:function(a){var c=1.70158,b=0,e=1;if(0==a)return 0;if(2==(a/=0.5))return 1;b||(b=1*0.3*1.5);e<Math.abs(1)?(e=1,c=b/4):c=b/(2*Math.PI)*Math.asin(1/e);return 1>a?-0.5*e*Math.pow(2,10*
8
- (a-=1))*Math.sin((1*a-c)*2*Math.PI/b):0.5*e*Math.pow(2,-10*(a-=1))*Math.sin((1*a-c)*2*Math.PI/b)+1},easeInBack:function(a){return 1*(a/=1)*a*(2.70158*a-1.70158)},easeOutBack:function(a){return 1*((a=a/1-1)*a*(2.70158*a+1.70158)+1)},easeInOutBack:function(a){var c=1.70158;return 1>(a/=0.5)?0.5*a*a*(((c*=1.525)+1)*a-c):0.5*((a-=2)*a*(((c*=1.525)+1)*a+c)+2)},easeInBounce:function(a){return 1-B.easeOutBounce(1-a)},easeOutBounce:function(a){return(a/=1)<1/2.75?1*7.5625*a*a:a<2/2.75?1*(7.5625*(a-=1.5/2.75)*
9
- a+0.75):a<2.5/2.75?1*(7.5625*(a-=2.25/2.75)*a+0.9375):1*(7.5625*(a-=2.625/2.75)*a+0.984375)},easeInOutBounce:function(a){return 0.5>a?0.5*B.easeInBounce(2*a):0.5*B.easeOutBounce(2*a-1)+0.5}},q=s.canvas.width,u=s.canvas.height;window.devicePixelRatio&&(s.canvas.style.width=q+"px",s.canvas.style.height=u+"px",s.canvas.height=u*window.devicePixelRatio,s.canvas.width=q*window.devicePixelRatio,s.scale(window.devicePixelRatio,window.devicePixelRatio));this.PolarArea=function(a,c){r.PolarArea.defaults={scaleOverlay:!0,
10
- scaleOverride:!1,scaleSteps:null,scaleStepWidth:null,scaleStartValue:null,scaleShowLine:!0,scaleLineColor:"rgba(0,0,0,.1)",scaleLineWidth:1,scaleShowLabels:!0,scaleLabel:"<%=value%>",scaleFontFamily:"'Arial'",scaleFontSize:12,scaleFontStyle:"normal",scaleFontColor:"#666",scaleShowLabelBackdrop:!0,scaleBackdropColor:"rgba(255,255,255,0.75)",scaleBackdropPaddingY:2,scaleBackdropPaddingX:2,segmentShowStroke:!0,segmentStrokeColor:"#fff",segmentStrokeWidth:2,animation:!0,animationSteps:100,animationEasing:"easeOutBounce",
11
- animateRotate:!0,animateScale:!1,onAnimationComplete:null};var b=c?y(r.PolarArea.defaults,c):r.PolarArea.defaults;return new G(a,b,s)};this.Radar=function(a,c){r.Radar.defaults={scaleOverlay:!1,scaleOverride:!1,scaleSteps:null,scaleStepWidth:null,scaleStartValue:null,scaleShowLine:!0,scaleLineColor:"rgba(0,0,0,.1)",scaleLineWidth:1,scaleShowLabels:!1,scaleLabel:"<%=value%>",scaleFontFamily:"'Arial'",scaleFontSize:12,scaleFontStyle:"normal",scaleFontColor:"#666",scaleShowLabelBackdrop:!0,scaleBackdropColor:"rgba(255,255,255,0.75)",
12
- scaleBackdropPaddingY:2,scaleBackdropPaddingX:2,angleShowLineOut:!0,angleLineColor:"rgba(0,0,0,.1)",angleLineWidth:1,pointLabelFontFamily:"'Arial'",pointLabelFontStyle:"normal",pointLabelFontSize:12,pointLabelFontColor:"#666",pointDot:!0,pointDotRadius:3,pointDotStrokeWidth:1,datasetStroke:!0,datasetStrokeWidth:2,datasetFill:!0,animation:!0,animationSteps:60,animationEasing:"easeOutQuart",onAnimationComplete:null};var b=c?y(r.Radar.defaults,c):r.Radar.defaults;return new H(a,b,s)};this.Pie=function(a,
13
- c){r.Pie.defaults={segmentShowStroke:!0,segmentStrokeColor:"#fff",segmentStrokeWidth:2,animation:!0,animationSteps:100,animationEasing:"easeOutBounce",animateRotate:!0,animateScale:!1,onAnimationComplete:null};var b=c?y(r.Pie.defaults,c):r.Pie.defaults;return new I(a,b,s)};this.Doughnut=function(a,c){r.Doughnut.defaults={segmentShowStroke:!0,segmentStrokeColor:"#fff",segmentStrokeWidth:2,percentageInnerCutout:50,animation:!0,animationSteps:100,animationEasing:"easeOutBounce",animateRotate:!0,animateScale:!1,
14
- onAnimationComplete:null};var b=c?y(r.Doughnut.defaults,c):r.Doughnut.defaults;return new J(a,b,s)};this.Line=function(a,c){r.Line.defaults={scaleOverlay:!1,scaleOverride:!1,scaleSteps:null,scaleStepWidth:null,scaleStartValue:null,scaleLineColor:"rgba(0,0,0,.1)",scaleLineWidth:1,scaleShowLabels:!0,scaleLabel:"<%=value%>",scaleFontFamily:"'Arial'",scaleFontSize:12,scaleFontStyle:"normal",scaleFontColor:"#666",scaleShowGridLines:!0,scaleGridLineColor:"rgba(0,0,0,.05)",scaleGridLineWidth:1,bezierCurve:!0,
15
- pointDot:!0,pointDotRadius:4,pointDotStrokeWidth:2,datasetStroke:!0,datasetStrokeWidth:2,datasetFill:!0,animation:!0,animationSteps:60,animationEasing:"easeOutQuart",onAnimationComplete:null};var b=c?y(r.Line.defaults,c):r.Line.defaults;return new K(a,b,s)};this.Bar=function(a,c){r.Bar.defaults={scaleOverlay:!1,scaleOverride:!1,scaleSteps:null,scaleStepWidth:null,scaleStartValue:null,scaleLineColor:"rgba(0,0,0,.1)",scaleLineWidth:1,scaleShowLabels:!0,scaleLabel:"<%=value%>",scaleFontFamily:"'Arial'",
16
- scaleFontSize:12,scaleFontStyle:"normal",scaleFontColor:"#666",scaleShowGridLines:!0,scaleGridLineColor:"rgba(0,0,0,.05)",scaleGridLineWidth:1,barShowStroke:!0,barStrokeWidth:2,barValueSpacing:5,barDatasetSpacing:1,animation:!0,animationSteps:60,animationEasing:"easeOutQuart",onAnimationComplete:null};var b=c?y(r.Bar.defaults,c):r.Bar.defaults;return new L(a,b,s)};var G=function(a,c,b){var e,h,f,d,g,k,j,l,m;g=Math.min.apply(Math,[q,u])/2;g-=Math.max.apply(Math,[0.5*c.scaleFontSize,0.5*c.scaleLineWidth]);
17
- d=2*c.scaleFontSize;c.scaleShowLabelBackdrop&&(d+=2*c.scaleBackdropPaddingY,g-=1.5*c.scaleBackdropPaddingY);l=g;d=d?d:5;e=Number.MIN_VALUE;h=Number.MAX_VALUE;for(f=0;f<a.length;f++)a[f].value>e&&(e=a[f].value),a[f].value<h&&(h=a[f].value);f=Math.floor(l/(0.66*d));d=Math.floor(0.5*(l/d));m=c.scaleShowLabels?c.scaleLabel:null;c.scaleOverride?(j={steps:c.scaleSteps,stepValue:c.scaleStepWidth,graphMin:c.scaleStartValue,labels:[]},z(m,j.labels,j.steps,c.scaleStartValue,c.scaleStepWidth)):j=C(l,f,d,e,h,
18
- m);k=g/j.steps;x(c,function(){for(var a=0;a<j.steps;a++)if(c.scaleShowLine&&(b.beginPath(),b.arc(q/2,u/2,k*(a+1),0,2*Math.PI,!0),b.strokeStyle=c.scaleLineColor,b.lineWidth=c.scaleLineWidth,b.stroke()),c.scaleShowLabels){b.textAlign="center";b.font=c.scaleFontStyle+" "+c.scaleFontSize+"px "+c.scaleFontFamily;var e=j.labels[a];if(c.scaleShowLabelBackdrop){var d=b.measureText(e).width;b.fillStyle=c.scaleBackdropColor;b.beginPath();b.rect(Math.round(q/2-d/2-c.scaleBackdropPaddingX),Math.round(u/2-k*(a+
19
- 1)-0.5*c.scaleFontSize-c.scaleBackdropPaddingY),Math.round(d+2*c.scaleBackdropPaddingX),Math.round(c.scaleFontSize+2*c.scaleBackdropPaddingY));b.fill()}b.textBaseline="middle";b.fillStyle=c.scaleFontColor;b.fillText(e,q/2,u/2-k*(a+1))}},function(e){var d=-Math.PI/2,g=2*Math.PI/a.length,f=1,h=1;c.animation&&(c.animateScale&&(f=e),c.animateRotate&&(h=e));for(e=0;e<a.length;e++)b.beginPath(),b.arc(q/2,u/2,f*v(a[e].value,j,k),d,d+h*g,!1),b.lineTo(q/2,u/2),b.closePath(),b.fillStyle=a[e].color,b.fill(),
20
- c.segmentShowStroke&&(b.strokeStyle=c.segmentStrokeColor,b.lineWidth=c.segmentStrokeWidth,b.stroke()),d+=h*g},b)},H=function(a,c,b){var e,h,f,d,g,k,j,l,m;a.labels||(a.labels=[]);g=Math.min.apply(Math,[q,u])/2;d=2*c.scaleFontSize;for(e=l=0;e<a.labels.length;e++)b.font=c.pointLabelFontStyle+" "+c.pointLabelFontSize+"px "+c.pointLabelFontFamily,h=b.measureText(a.labels[e]).width,h>l&&(l=h);g-=Math.max.apply(Math,[l,1.5*(c.pointLabelFontSize/2)]);g-=c.pointLabelFontSize;l=g=A(g,null,0);d=d?d:5;e=Number.MIN_VALUE;
21
- h=Number.MAX_VALUE;for(f=0;f<a.datasets.length;f++)for(m=0;m<a.datasets[f].data.length;m++)a.datasets[f].data[m]>e&&(e=a.datasets[f].data[m]),a.datasets[f].data[m]<h&&(h=a.datasets[f].data[m]);f=Math.floor(l/(0.66*d));d=Math.floor(0.5*(l/d));m=c.scaleShowLabels?c.scaleLabel:null;c.scaleOverride?(j={steps:c.scaleSteps,stepValue:c.scaleStepWidth,graphMin:c.scaleStartValue,labels:[]},z(m,j.labels,j.steps,c.scaleStartValue,c.scaleStepWidth)):j=C(l,f,d,e,h,m);k=g/j.steps;x(c,function(){var e=2*Math.PI/
22
- a.datasets[0].data.length;b.save();b.translate(q/2,u/2);if(c.angleShowLineOut){b.strokeStyle=c.angleLineColor;b.lineWidth=c.angleLineWidth;for(var d=0;d<a.datasets[0].data.length;d++)b.rotate(e),b.beginPath(),b.moveTo(0,0),b.lineTo(0,-g),b.stroke()}for(d=0;d<j.steps;d++){b.beginPath();if(c.scaleShowLine){b.strokeStyle=c.scaleLineColor;b.lineWidth=c.scaleLineWidth;b.moveTo(0,-k*(d+1));for(var f=0;f<a.datasets[0].data.length;f++)b.rotate(e),b.lineTo(0,-k*(d+1));b.closePath();b.stroke()}c.scaleShowLabels&&
23
- (b.textAlign="center",b.font=c.scaleFontStyle+" "+c.scaleFontSize+"px "+c.scaleFontFamily,b.textBaseline="middle",c.scaleShowLabelBackdrop&&(f=b.measureText(j.labels[d]).width,b.fillStyle=c.scaleBackdropColor,b.beginPath(),b.rect(Math.round(-f/2-c.scaleBackdropPaddingX),Math.round(-k*(d+1)-0.5*c.scaleFontSize-c.scaleBackdropPaddingY),Math.round(f+2*c.scaleBackdropPaddingX),Math.round(c.scaleFontSize+2*c.scaleBackdropPaddingY)),b.fill()),b.fillStyle=c.scaleFontColor,b.fillText(j.labels[d],0,-k*(d+
24
- 1)))}for(d=0;d<a.labels.length;d++){b.font=c.pointLabelFontStyle+" "+c.pointLabelFontSize+"px "+c.pointLabelFontFamily;b.fillStyle=c.pointLabelFontColor;var f=Math.sin(e*d)*(g+c.pointLabelFontSize),h=Math.cos(e*d)*(g+c.pointLabelFontSize);b.textAlign=e*d==Math.PI||0==e*d?"center":e*d>Math.PI?"right":"left";b.textBaseline="middle";b.fillText(a.labels[d],f,-h)}b.restore()},function(d){var e=2*Math.PI/a.datasets[0].data.length;b.save();b.translate(q/2,u/2);for(var g=0;g<a.datasets.length;g++){b.beginPath();
25
- b.moveTo(0,d*-1*v(a.datasets[g].data[0],j,k));for(var f=1;f<a.datasets[g].data.length;f++)b.rotate(e),b.lineTo(0,d*-1*v(a.datasets[g].data[f],j,k));b.closePath();b.fillStyle=a.datasets[g].fillColor;b.strokeStyle=a.datasets[g].strokeColor;b.lineWidth=c.datasetStrokeWidth;b.fill();b.stroke();if(c.pointDot){b.fillStyle=a.datasets[g].pointColor;b.strokeStyle=a.datasets[g].pointStrokeColor;b.lineWidth=c.pointDotStrokeWidth;for(f=0;f<a.datasets[g].data.length;f++)b.rotate(e),b.beginPath(),b.arc(0,d*-1*
26
- v(a.datasets[g].data[f],j,k),c.pointDotRadius,2*Math.PI,!1),b.fill(),b.stroke()}b.rotate(e)}b.restore()},b)},I=function(a,c,b){for(var e=0,h=Math.min.apply(Math,[u/2,q/2])-5,f=0;f<a.length;f++)e+=a[f].value;x(c,null,function(d){var g=-Math.PI/2,f=1,j=1;c.animation&&(c.animateScale&&(f=d),c.animateRotate&&(j=d));for(d=0;d<a.length;d++){var l=j*a[d].value/e*2*Math.PI;b.beginPath();b.arc(q/2,u/2,f*h,g,g+l);b.lineTo(q/2,u/2);b.closePath();b.fillStyle=a[d].color;b.fill();c.segmentShowStroke&&(b.lineWidth=
27
- c.segmentStrokeWidth,b.strokeStyle=c.segmentStrokeColor,b.stroke());g+=l}},b)},J=function(a,c,b){for(var e=0,h=Math.min.apply(Math,[u/2,q/2])-5,f=h*(c.percentageInnerCutout/100),d=0;d<a.length;d++)e+=a[d].value;x(c,null,function(d){var k=-Math.PI/2,j=1,l=1;c.animation&&(c.animateScale&&(j=d),c.animateRotate&&(l=d));for(d=0;d<a.length;d++){var m=l*a[d].value/e*2*Math.PI;b.beginPath();b.arc(q/2,u/2,j*h,k,k+m,!1);b.arc(q/2,u/2,j*f,k+m,k,!0);b.closePath();b.fillStyle=a[d].color;b.fill();c.segmentShowStroke&&
28
- (b.lineWidth=c.segmentStrokeWidth,b.strokeStyle=c.segmentStrokeColor,b.stroke());k+=m}},b)},K=function(a,c,b){var e,h,f,d,g,k,j,l,m,t,r,n,p,s=0;g=u;b.font=c.scaleFontStyle+" "+c.scaleFontSize+"px "+c.scaleFontFamily;t=1;for(d=0;d<a.labels.length;d++)e=b.measureText(a.labels[d]).width,t=e>t?e:t;q/a.labels.length<t?(s=45,q/a.labels.length<Math.cos(s)*t?(s=90,g-=t):g-=Math.sin(s)*t):g-=c.scaleFontSize;d=c.scaleFontSize;g=g-5-d;e=Number.MIN_VALUE;h=Number.MAX_VALUE;for(f=0;f<a.datasets.length;f++)for(l=
29
- 0;l<a.datasets[f].data.length;l++)a.datasets[f].data[l]>e&&(e=a.datasets[f].data[l]),a.datasets[f].data[l]<h&&(h=a.datasets[f].data[l]);f=Math.floor(g/(0.66*d));d=Math.floor(0.5*(g/d));l=c.scaleShowLabels?c.scaleLabel:"";c.scaleOverride?(j={steps:c.scaleSteps,stepValue:c.scaleStepWidth,graphMin:c.scaleStartValue,labels:[]},z(l,j.labels,j.steps,c.scaleStartValue,c.scaleStepWidth)):j=C(g,f,d,e,h,l);k=Math.floor(g/j.steps);d=1;if(c.scaleShowLabels){b.font=c.scaleFontStyle+" "+c.scaleFontSize+"px "+c.scaleFontFamily;
30
- for(e=0;e<j.labels.length;e++)h=b.measureText(j.labels[e]).width,d=h>d?h:d;d+=10}r=q-d-t;m=Math.floor(r/(a.labels.length-1));n=q-t/2-r;p=g+c.scaleFontSize/2;x(c,function(){b.lineWidth=c.scaleLineWidth;b.strokeStyle=c.scaleLineColor;b.beginPath();b.moveTo(q-t/2+5,p);b.lineTo(q-t/2-r-5,p);b.stroke();0<s?(b.save(),b.textAlign="right"):b.textAlign="center";b.fillStyle=c.scaleFontColor;for(var d=0;d<a.labels.length;d++)b.save(),0<s?(b.translate(n+d*m,p+c.scaleFontSize),b.rotate(-(s*(Math.PI/180))),b.fillText(a.labels[d],
31
- 0,0),b.restore()):b.fillText(a.labels[d],n+d*m,p+c.scaleFontSize+3),b.beginPath(),b.moveTo(n+d*m,p+3),c.scaleShowGridLines&&0<d?(b.lineWidth=c.scaleGridLineWidth,b.strokeStyle=c.scaleGridLineColor,b.lineTo(n+d*m,5)):b.lineTo(n+d*m,p+3),b.stroke();b.lineWidth=c.scaleLineWidth;b.strokeStyle=c.scaleLineColor;b.beginPath();b.moveTo(n,p+5);b.lineTo(n,5);b.stroke();b.textAlign="right";b.textBaseline="middle";for(d=0;d<j.steps;d++)b.beginPath(),b.moveTo(n-3,p-(d+1)*k),c.scaleShowGridLines?(b.lineWidth=c.scaleGridLineWidth,
32
- b.strokeStyle=c.scaleGridLineColor,b.lineTo(n+r+5,p-(d+1)*k)):b.lineTo(n-0.5,p-(d+1)*k),b.stroke(),c.scaleShowLabels&&b.fillText(j.labels[d],n-8,p-(d+1)*k)},function(d){function e(b,c){return p-d*v(a.datasets[b].data[c],j,k)}for(var f=0;f<a.datasets.length;f++){b.strokeStyle=a.datasets[f].strokeColor;b.lineWidth=c.datasetStrokeWidth;b.beginPath();b.moveTo(n,p-d*v(a.datasets[f].data[0],j,k));for(var g=1;g<a.datasets[f].data.length;g++)c.bezierCurve?b.bezierCurveTo(n+m*(g-0.5),e(f,g-1),n+m*(g-0.5),
33
- e(f,g),n+m*g,e(f,g)):b.lineTo(n+m*g,e(f,g));b.stroke();c.datasetFill?(b.lineTo(n+m*(a.datasets[f].data.length-1),p),b.lineTo(n,p),b.closePath(),b.fillStyle=a.datasets[f].fillColor,b.fill()):b.closePath();if(c.pointDot){b.fillStyle=a.datasets[f].pointColor;b.strokeStyle=a.datasets[f].pointStrokeColor;b.lineWidth=c.pointDotStrokeWidth;for(g=0;g<a.datasets[f].data.length;g++)b.beginPath(),b.arc(n+m*g,p-d*v(a.datasets[f].data[g],j,k),c.pointDotRadius,0,2*Math.PI,!0),b.fill(),b.stroke()}}},b)},L=function(a,
34
- c,b){var e,h,f,d,g,k,j,l,m,t,r,n,p,s,w=0;g=u;b.font=c.scaleFontStyle+" "+c.scaleFontSize+"px "+c.scaleFontFamily;t=1;for(d=0;d<a.labels.length;d++)e=b.measureText(a.labels[d]).width,t=e>t?e:t;q/a.labels.length<t?(w=45,q/a.labels.length<Math.cos(w)*t?(w=90,g-=t):g-=Math.sin(w)*t):g-=c.scaleFontSize;d=c.scaleFontSize;g=g-5-d;e=Number.MIN_VALUE;h=Number.MAX_VALUE;for(f=0;f<a.datasets.length;f++)for(l=0;l<a.datasets[f].data.length;l++)a.datasets[f].data[l]>e&&(e=a.datasets[f].data[l]),a.datasets[f].data[l]<
35
- h&&(h=a.datasets[f].data[l]);f=Math.floor(g/(0.66*d));d=Math.floor(0.5*(g/d));l=c.scaleShowLabels?c.scaleLabel:"";c.scaleOverride?(j={steps:c.scaleSteps,stepValue:c.scaleStepWidth,graphMin:c.scaleStartValue,labels:[]},z(l,j.labels,j.steps,c.scaleStartValue,c.scaleStepWidth)):j=C(g,f,d,e,h,l);k=Math.floor(g/j.steps);d=1;if(c.scaleShowLabels){b.font=c.scaleFontStyle+" "+c.scaleFontSize+"px "+c.scaleFontFamily;for(e=0;e<j.labels.length;e++)h=b.measureText(j.labels[e]).width,d=h>d?h:d;d+=10}r=q-d-t;m=
36
- Math.floor(r/a.labels.length);s=(m-2*c.scaleGridLineWidth-2*c.barValueSpacing-(c.barDatasetSpacing*a.datasets.length-1)-(c.barStrokeWidth/2*a.datasets.length-1))/a.datasets.length;n=q-t/2-r;p=g+c.scaleFontSize/2;x(c,function(){b.lineWidth=c.scaleLineWidth;b.strokeStyle=c.scaleLineColor;b.beginPath();b.moveTo(q-t/2+5,p);b.lineTo(q-t/2-r-5,p);b.stroke();0<w?(b.save(),b.textAlign="right"):b.textAlign="center";b.fillStyle=c.scaleFontColor;for(var d=0;d<a.labels.length;d++)b.save(),0<w?(b.translate(n+
37
- d*m,p+c.scaleFontSize),b.rotate(-(w*(Math.PI/180))),b.fillText(a.labels[d],0,0),b.restore()):b.fillText(a.labels[d],n+d*m+m/2,p+c.scaleFontSize+3),b.beginPath(),b.moveTo(n+(d+1)*m,p+3),b.lineWidth=c.scaleGridLineWidth,b.strokeStyle=c.scaleGridLineColor,b.lineTo(n+(d+1)*m,5),b.stroke();b.lineWidth=c.scaleLineWidth;b.strokeStyle=c.scaleLineColor;b.beginPath();b.moveTo(n,p+5);b.lineTo(n,5);b.stroke();b.textAlign="right";b.textBaseline="middle";for(d=0;d<j.steps;d++)b.beginPath(),b.moveTo(n-3,p-(d+1)*
38
- k),c.scaleShowGridLines?(b.lineWidth=c.scaleGridLineWidth,b.strokeStyle=c.scaleGridLineColor,b.lineTo(n+r+5,p-(d+1)*k)):b.lineTo(n-0.5,p-(d+1)*k),b.stroke(),c.scaleShowLabels&&b.fillText(j.labels[d],n-8,p-(d+1)*k)},function(d){b.lineWidth=c.barStrokeWidth;for(var e=0;e<a.datasets.length;e++){b.fillStyle=a.datasets[e].fillColor;b.strokeStyle=a.datasets[e].strokeColor;for(var f=0;f<a.datasets[e].data.length;f++){var g=n+c.barValueSpacing+m*f+s*e+c.barDatasetSpacing*e+c.barStrokeWidth*e;b.beginPath();
39
- b.moveTo(g,p);b.lineTo(g,p-d*v(a.datasets[e].data[f],j,k)+c.barStrokeWidth/2);b.lineTo(g+s,p-d*v(a.datasets[e].data[f],j,k)+c.barStrokeWidth/2);b.lineTo(g+s,p);c.barShowStroke&&b.stroke();b.closePath();b.fill()}}},b)},D=window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||window.oRequestAnimationFrame||window.msRequestAnimationFrame||function(a){window.setTimeout(a,1E3/60)},F={}};
@@ -1,276 +0,0 @@
1
- // d3.tip
2
- // Copyright (c) 2013 Justin Palmer
3
- //
4
- // Tooltips for d3.js SVG visualizations
5
-
6
- // Public - contructs a new tooltip
7
- //
8
- // Returns a tip
9
- d3.tip = function() {
10
- var direction = d3_tip_direction,
11
- offset = d3_tip_offset,
12
- html = d3_tip_html,
13
- node = initNode(),
14
- svg = null,
15
- point = null
16
-
17
- function tip(vis) {
18
- svg = getSVGNode(vis)
19
- point = svg.createSVGPoint()
20
- document.body.appendChild(node)
21
- }
22
-
23
- // Public - show the tooltip on the screen
24
- //
25
- // Returns a tip
26
- tip.show = function() {
27
- var content = html.apply(this, arguments),
28
- poffset = offset.apply(this, arguments),
29
- dir = direction.apply(this, arguments),
30
- nodel = d3.select(node), i = 0,
31
- coords
32
-
33
- nodel.html(content)
34
- .style({ opacity: 1, 'pointer-events': 'all' })
35
-
36
- while(i--) nodel.classed(directions[i], false)
37
- coords = direction_callbacks.get(dir).apply(this)
38
- nodel.classed(dir, true).style({
39
- top: (coords.top + poffset[0]) + 'px',
40
- left: (coords.left + poffset[1]) + 'px'
41
- })
42
-
43
- return tip
44
- }
45
-
46
- // Public - hide the tooltip
47
- //
48
- // Returns a tip
49
- tip.hide = function() {
50
- nodel = d3.select(node)
51
- nodel.style({ opacity: 0, 'pointer-events': 'none' })
52
- return tip
53
- }
54
-
55
- // Public: Proxy attr calls to the d3 tip container. Sets or gets attribute value.
56
- //
57
- // n - name of the attribute
58
- // v - value of the attribute
59
- //
60
- // Returns tip or attribute value
61
- tip.attr = function(n, v) {
62
- if (arguments.length < 2 && typeof n === 'string') {
63
- return d3.select(node).attr(n)
64
- } else {
65
- var args = Array.prototype.slice.call(arguments)
66
- d3.selection.prototype.attr.apply(d3.select(node), args)
67
- }
68
-
69
- return tip
70
- }
71
-
72
- // Public: Proxy style calls to the d3 tip container. Sets or gets a style value.
73
- //
74
- // n - name of the property
75
- // v - value of the property
76
- //
77
- // Returns tip or style property value
78
- tip.style = function(n, v) {
79
- if (arguments.length < 2 && typeof n === 'string') {
80
- return d3.select(node).style(n)
81
- } else {
82
- var args = Array.prototype.slice.call(arguments)
83
- d3.selection.prototype.style.apply(d3.select(node), args)
84
- }
85
-
86
- return tip
87
- }
88
-
89
- // Public: Set or get the direction of the tooltip
90
- //
91
- // v - One of n(north), s(south), e(east), or w(west), nw(northwest),
92
- // sw(southwest), ne(northeast) or se(southeast)
93
- //
94
- // Returns tip or direction
95
- tip.direction = function(v) {
96
- if (!arguments.length) return direction
97
- direction = v == null ? v : d3.functor(v)
98
-
99
- return tip
100
- }
101
-
102
- // Public: Sets or gets the offset of the tip
103
- //
104
- // v - Array of [x, y] offset
105
- //
106
- // Returns offset or
107
- tip.offset = function(v) {
108
- if (!arguments.length) return offset
109
- offset = v == null ? v : d3.functor(v)
110
-
111
- return tip
112
- }
113
-
114
- // Public: sets or gets the html value of the tooltip
115
- //
116
- // v - String value of the tip
117
- //
118
- // Returns html value or tip
119
- tip.html = function(v) {
120
- if (!arguments.length) return html
121
- html = v == null ? v : d3.functor(v)
122
-
123
- return tip
124
- }
125
-
126
- function d3_tip_direction() { return 'n' }
127
- function d3_tip_offset() { return [0, 0] }
128
- function d3_tip_html() { return ' ' }
129
-
130
- var direction_callbacks = d3.map({
131
- n: direction_n,
132
- s: direction_s,
133
- e: direction_e,
134
- w: direction_w,
135
- nw: direction_nw,
136
- ne: direction_ne,
137
- sw: direction_sw,
138
- se: direction_se
139
- }),
140
-
141
- directions = direction_callbacks.keys()
142
-
143
- function direction_n() {
144
- var bbox = getScreenBBox()
145
- return {
146
- top: bbox.n.y - node.offsetHeight,
147
- left: bbox.n.x - node.offsetWidth / 2
148
- }
149
- }
150
-
151
- function direction_s() {
152
- var bbox = getScreenBBox()
153
- return {
154
- top: bbox.s.y,
155
- left: bbox.s.x - node.offsetWidth / 2
156
- }
157
- }
158
-
159
- function direction_e() {
160
- var bbox = getScreenBBox()
161
- return {
162
- top: bbox.e.y - node.offsetHeight / 2,
163
- left: bbox.e.x
164
- }
165
- }
166
-
167
- function direction_w() {
168
- var bbox = getScreenBBox()
169
- return {
170
- top: bbox.w.y - node.offsetHeight / 2,
171
- left: bbox.w.x - node.offsetWidth
172
- }
173
- }
174
-
175
- function direction_nw() {
176
- var bbox = getScreenBBox()
177
- return {
178
- top: bbox.nw.y - node.offsetHeight,
179
- left: bbox.nw.x - node.offsetWidth
180
- }
181
- }
182
-
183
- function direction_ne() {
184
- var bbox = getScreenBBox()
185
- return {
186
- top: bbox.ne.y - node.offsetHeight,
187
- left: bbox.ne.x
188
- }
189
- }
190
-
191
- function direction_sw() {
192
- var bbox = getScreenBBox()
193
- return {
194
- top: bbox.sw.y,
195
- left: bbox.sw.x - node.offsetWidth
196
- }
197
- }
198
-
199
- function direction_se() {
200
- var bbox = getScreenBBox()
201
- return {
202
- top: bbox.se.y,
203
- left: bbox.e.x
204
- }
205
- }
206
-
207
- function initNode() {
208
- var node = d3.select(document.createElement('div'))
209
- node.style({
210
- position: 'absolute',
211
- opacity: 0,
212
- pointerEvents: 'none',
213
- boxSizing: 'border-box'
214
- })
215
-
216
- return node.node()
217
- }
218
-
219
- function getSVGNode(el) {
220
- el = el.node()
221
- if(el.tagName.toLowerCase() == 'svg')
222
- return el
223
-
224
- return el.ownerSVGElement
225
- }
226
-
227
- // Private - gets the screen coordinates of a shape
228
- //
229
- // Given a shape on the screen, will return an SVGPoint for the directions
230
- // n(north), s(south), e(east), w(west), ne(northeast), se(southeast), nw(northwest),
231
- // sw(southwest).
232
- //
233
- // +-+-+
234
- // | |
235
- // + +
236
- // | |
237
- // +-+-+
238
- //
239
- // Returns an Object {n, s, e, w, nw, sw, ne, se}
240
- function getScreenBBox() {
241
- var target = d3.event.target,
242
- bbox = {},
243
- matrix = target.getScreenCTM(),
244
- tbbox = target.getBBox(),
245
- width = tbbox.width,
246
- height = tbbox.height,
247
- x = tbbox.x,
248
- y = tbbox.y,
249
- scrollTop = document.documentElement.scrollTop || document.body.scrollTop,
250
- scrollLeft = document.documentElement.scrollLeft || document.body.scrollLeft
251
-
252
-
253
- point.x = x + scrollLeft
254
- point.y = y + scrollTop
255
- bbox.nw = point.matrixTransform(matrix)
256
- point.x += width
257
- bbox.ne = point.matrixTransform(matrix)
258
- point.y += height
259
- bbox.se = point.matrixTransform(matrix)
260
- point.x -= width
261
- bbox.sw = point.matrixTransform(matrix)
262
- point.y -= height / 2
263
- bbox.w = point.matrixTransform(matrix)
264
- point.x += width
265
- bbox.e = point.matrixTransform(matrix)
266
- point.x -= width / 2
267
- point.y -= height / 2
268
- bbox.n = point.matrixTransform(matrix)
269
- point.y += height
270
- bbox.s = point.matrixTransform(matrix)
271
-
272
- return bbox
273
- }
274
-
275
- return tip
276
- };