Skip to content
Browse files

Update pizza to 0.2.1

  • Loading branch information...
1 parent 8d170b4 commit bb2ec9394d689840d2dd0876ccfc4c90a6f6fe19 Pete Cooper committed
View
5 ajax/libs/pizza/0.2.0/.gitignore
@@ -0,0 +1,5 @@
+.DS_Store
+.sass-cache/
+/bower_components/*
+node_modules
+stylesheets
View
1 ajax/libs/pizza/0.2.0/css/pizza.min.css
@@ -0,0 +1 @@
+[data-pie-id]>*:nth-child(7n+1) ,[data-bar-id]>*:nth-child(7n+1) ,[data-line-id]>*:nth-child(7n+1) {color:#f23d3d;}[data-pie-id]>*:nth-child(7n+2) ,[data-bar-id]>*:nth-child(7n+2) ,[data-line-id]>*:nth-child(7n+2) {color:#f02121;}[data-pie-id]>*:nth-child(7n+3) ,[data-bar-id]>*:nth-child(7n+3) ,[data-line-id]>*:nth-child(7n+3) {color:#e61010;}[data-pie-id]>*:nth-child(7n+4) ,[data-bar-id]>*:nth-child(7n+4) ,[data-line-id]>*:nth-child(7n+4) {color:#cf0e0e;}[data-pie-id]>*:nth-child(7n+5) ,[data-bar-id]>*:nth-child(7n+5) ,[data-line-id]>*:nth-child(7n+5) {color:#ba0d0d;}[data-pie-id]>*:nth-child(7n+6) ,[data-bar-id]>*:nth-child(7n+6) ,[data-line-id]>*:nth-child(7n+6) {color:#a70c0c;}[data-pie-id]>*:nth-child(7n+7) ,[data-bar-id]>*:nth-child(7n+7) ,[data-line-id]>*:nth-child(7n+7) {color:#960b0b;}#pie ,#donut ,#bar {max-height:450px;}svg {width:100%;height:auto;}.tooltip {margin-left:-5px;border-radius:3px;padding:5px;}ul[data-pie-id] {list-style:none;padding:10px;}
View
1 ajax/libs/pizza/0.2.0/css/vendor/foundation.css
1 addition, 0 deletions not shown because the diff is too large. Please use a local Git client to view these changes.
View
1 ajax/libs/pizza/0.2.0/css/vendor/foundation.min.css
1 addition, 0 deletions not shown because the diff is too large. Please use a local Git client to view these changes.
View
1 ajax/libs/pizza/0.2.0/css/vendor/normalize.css
@@ -0,0 +1 @@
+article ,aside ,details ,figcaption ,figure ,footer ,header ,hgroup ,main ,nav ,section ,summary {display:block;}audio ,canvas ,video {display:inline-block;}audio:not([controls]) {display:none;height:0;}[hidden] ,template {display:none;}script {display:none !important;}html {font-family:sans-serif;-ms-text-size-adjust:100%;-webkit-text-size-adjust:100%;}body {margin:0;}a {background:transparent;}a:focus {outline:thin dotted;}a:active ,a:hover {outline:0;}h1 {font-size:2em;margin:0.67em 0;}abbr[title] {border-bottom:1px dotted;}b ,strong {font-weight:bold;}dfn {font-style:italic;}hr {-moz-box-sizing:content-box;box-sizing:content-box;height:0;}mark {background:yellow;color:black;}code ,kbd ,pre ,samp {font-family:monospace,serif;font-size:1em;}pre {white-space:pre-wrap;}q {quotes:"\201C" "\201D" "\2018" "\2019";}small {font-size:80%;}sub ,sup {font-size:75%;line-height:0;position:relative;vertical-align:baseline;}sup {top:-0.5em;}sub {bottom:-0.25em;}img {border:0;}svg:not(:root) {overflow:hidden;}figure {margin:0;}fieldset {border:1px solid silver;margin:0 2px;padding:0.35em 0.625em 0.75em;}legend {border:0;padding:0;}button ,input ,select ,textarea {font-family:inherit;font-size:100%;margin:0;}button ,input {line-height:normal;}button ,select {text-transform:none;}button ,html input[type="button"] ,input[type="reset"] ,input[type="submit"] {-webkit-appearance:button;cursor:pointer;}button[disabled] ,html input[disabled] {cursor:default;}input[type="checkbox"] ,input[type="radio"] {box-sizing:border-box;padding:0;}input[type="search"] {-webkit-appearance:textfield;-moz-box-sizing:content-box;-webkit-box-sizing:content-box;box-sizing:content-box;}input[type="search"]::-webkit-search-cancel-button ,input[type="search"]::-webkit-search-decoration {-webkit-appearance:none;}button::-moz-focus-inner ,input::-moz-focus-inner {border:0;padding:0;}textarea {overflow:auto;vertical-align:top;}table {border-collapse:collapse;border-spacing:0;}
View
1 ajax/libs/pizza/0.2.0/css/vendor/normalize.min.css
@@ -0,0 +1 @@
+article,aside,details,figcaption,figure,footer,header,hgroup,main,nav,section,summary{display:block}audio,canvas,video{display:inline-block}audio:not([controls]){display:none;height:0}[hidden],template{display:none}script{display:none!important}html{font-family:sans-serif;-ms-text-size-adjust:100%;-webkit-text-size-adjust:100%}body{margin:0}a{background:transparent}a:focus{outline:thin dotted}a:active,a:hover{outline:0}h1{font-size:2em;margin:.67em 0}abbr[title]{border-bottom:1px dotted}b,strong{font-weight:bold}dfn{font-style:italic}hr{-moz-box-sizing:content-box;box-sizing:content-box;height:0}mark{background:yellow;color:black}code,kbd,pre,samp{font-family:monospace,serif;font-size:1em}pre{white-space:pre-wrap}q{quotes:"\201C" "\201D" "\2018" "\2019"}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sup{top:-0.5em}sub{bottom:-0.25em}img{border:0}svg:not(:root){overflow:hidden}figure{margin:0}fieldset{border:1px solid silver;margin:0 2px;padding:.35em .625em .75em}legend{border:0;padding:0}button,input,select,textarea{font-family:inherit;font-size:100%;margin:0}button,input{line-height:normal}button,select{text-transform:none}button,html input[type="button"],input[type="reset"],input[type="submit"]{-webkit-appearance:button;cursor:pointer}button[disabled],html input[disabled]{cursor:default}input[type="checkbox"],input[type="radio"]{box-sizing:border-box;padding:0}input[type="search"]{-webkit-appearance:textfield;-moz-box-sizing:content-box;-webkit-box-sizing:content-box;box-sizing:content-box}input[type="search"]::-webkit-search-cancel-button,input[type="search"]::-webkit-search-decoration{-webkit-appearance:none}button::-moz-focus-inner,input::-moz-focus-inner{border:0;padding:0}textarea{overflow:auto;vertical-align:top}table{border-collapse:collapse;border-spacing:0}
View
948 ajax/libs/pizza/0.2.0/js/pizza.js
@@ -0,0 +1,948 @@
+var Pizza = {
+ version : '0.2.0',
+
+ settings : {
+ donut: false,
+ donut_inner_ratio: 0.4, // between 0 and 1
+ percent_offset: 35, // relative to radius
+ show_text: true, // show or hide the percentage on the chart.
+ animation_speed: 500,
+ always_show_text: false,
+ show_grid: true,
+ bar_spacer: 100,
+ bar_intervals: 6,
+ animation_type: 'elastic' // options: backin, backout, bounce, easein,
+ // easeinout, easeout, linear
+ },
+
+ NS : 'http://www.w3.org/2000/svg',
+
+ init : function (scope, options) {
+ var self = this;
+ this.scope = scope || document.body;
+
+ var charts = $('[data-pie-id], [data-line-id], [data-bar-id]', this.scope);
+
+ $.extend(true, this.settings, options);
+
+ if (charts.length > 0) {
+ charts.each(function () {
+ return self.build($(this), options);
+ });
+ } else if ($(this.scope).is('[data-pie-id]')
+ || $(this.scope).is('[data-line-id]')
+ || $(this.scope).is('[data-bar-id]')) {
+ this.build($(this.scope), options);
+ }
+
+ this.events();
+ },
+
+ events : function () {
+ var self = this;
+
+ $(window).off('.pizza').on('resize.pizza', self.throttle(function () {
+ self.init();
+ }, 500));
+
+ $(this.scope).off('.pizza');
+
+ this.pie_events();
+ this.line_events();
+ this.bar_events();
+ },
+
+ build : function(legend, options) {
+ legend.data('settings', $.extend({}, this.settings, options, legend.data('options')));
+
+ this.data(legend, options || {});
+
+ if (legend.data('pie-id')) {
+ this.update_DOM(this.pie(legend));
+ } else if (legend.data('line-id')) {
+ this.update_DOM(this.line(legend));
+ } else if (legend.data('bar-id')) {
+ this.update_DOM(this.bar(legend));
+ }
+ },
+
+ data : function (legend, options) {
+ var data = [],
+ count = 0;
+
+ $('li', legend).each(function () {
+ var segment = $(this);
+
+ if (options.data) {
+ data.push({
+ value: options.data[segment.index()],
+ text: segment.data('text'),
+ color: segment.css('color'),
+ segment: segment
+ });
+ } else {
+ data.push({
+ x : segment.data('x'),
+ y : segment.data('y'),
+ value: segment.data('value'),
+ text: segment.data('text'),
+ color: segment.css('color'),
+ segment: segment
+ });
+ }
+ });
+
+ return legend.data('graph-data', data);
+ },
+
+ update_DOM : function (parts) {
+ var legend = parts[0],
+ graph = parts[1];
+
+ return $(this.identifier(legend)).html(graph);
+ },
+
+ animate : function (el, cx, cy, settings, scale) {
+ var self = this,
+ scale = scale || 1.05;
+
+ el.hover(function (e) {
+ var path = Snap(e.target),
+ text = Snap(path.node.nextSibling);
+
+ path.animate({
+ transform: 's' + scale + ' ' + scale + ' ' + cx + ' ' + cy
+ }, settings.animation_speed, mina[settings.animation_type]);
+
+ if (!/text/.test(text.node.nodeName)) return;
+
+ text.touchend(function () {
+ Snap(path).animate({
+ transform: 's' + scale + ' ' + scale + ' ' + cx + ' ' + cy
+ }, settings.animation_speed, mina[settings.animation_type]);
+ });
+
+ if (settings.show_text) {
+ text.animate({
+ opacity: 1
+ }, settings.animation_speed);
+ text.touchend(function () {
+ text.animate({
+ opacity: 1
+ }, settings.animation_speed);
+ });
+ }
+
+ }, function (e) {
+ var path = Snap(e.target),
+ text = Snap(path.node.nextSibling);
+
+ path.animate({
+ transform: 's1 1 ' + cx + ' ' + cy
+ }, settings.animation_speed, mina[settings.animation_type]);
+
+ if (!/text/.test(text.node.nodeName)) return;
+
+ text.animate({
+ opacity: 0
+ }, settings.animation_speed);
+ });
+
+ },
+
+ parse_options : function (string, percent, value) {
+ var matches = string.match(/{{(percent|value)}}/g),
+ output = '';
+
+ for (var i = 0; i < matches.length; i++) {
+
+ if (/percent/i.test(matches[i])) {
+ output = string.replace(matches[i], [Math.ceil(percent), '%'].join(''));
+ }
+
+ if (/value/i.test(matches[i])) {
+ output = output.replace(matches[i], value);
+ }
+ }
+
+ return output;
+ },
+
+ svg : function (legend, settings) {
+ var container = $(this.identifier(legend)),
+ svg = $('svg', container),
+ width = container.width(),
+ pie = legend.attr('data-pie-id'),
+ height = container.height();
+
+ if (svg.length > 0) {
+ svg = svg[0];
+ } else {
+ var svg = this.svg_obj('svg');
+ svg.width = width;
+ svg.height = height;
+ }
+
+ if (pie) {
+ var view_box = '-' + settings.percent_offset + ' -' + settings.percent_offset + ' ' +
+ (width + (settings.percent_offset * 1.5)) + ' ' +
+ (width + (settings.percent_offset * 1.5));
+ } else {
+ var view_box = '-' + settings.percent_offset + ' -' + settings.percent_offset + ' ' +
+ (width + (settings.percent_offset * 1.6)) + ' ' +
+ (height + (settings.percent_offset * 1.6));
+ }
+
+ this.set_attr(svg, {width: '100%', height: '100%', viewBox: view_box});
+
+ return svg;
+ },
+
+ identifier : function (legend) {
+ id = legend.data('pie-id') || legend.data('bar-id') || legend.data('line-id');
+ return '#' + id;
+ },
+
+ throttle : function(fun, delay) {
+ var timer = null;
+ return function () {
+ var context = this, args = arguments;
+ clearTimeout(timer);
+ timer = setTimeout(function () {
+ fun.apply(context, args);
+ }, delay);
+ };
+ },
+
+ svg_obj : function (type) {
+ return document.createElementNS(this.NS, type);
+ },
+
+ ticks: function (min, max, count) {
+ var span = max - min,
+ step = Math.pow(10, Math.floor(Math.log(span / count) / Math.LN10)),
+ err = count / span * step;
+
+ // Filter ticks to get closer to the desired count.
+ if (err <= .15) step *= 10;
+ else if (err <= .35) step *= 5;
+ else if (err <= .75) step *= 2;
+
+ // Round start and stop values to step interval.
+ var tstart = Math.ceil(min / step) * step,
+ tstop = Math.floor(max / step) * step + step * .5,
+ ticks = [],
+ x;
+
+ // now generate ticks
+ for (i=tstart; i < tstop; i += step) {
+ ticks.push(i);
+ }
+ return ticks;
+ },
+
+ set_attr : function (node, attrs) {
+
+ for (attr in attrs) {
+ node.setAttribute(attr, attrs[attr]);
+ }
+
+ return this;
+ },
+
+ flip : function (node, h) {
+ node.setAttribute('transform', 'translate(0, ' + h +') scale(1, -1)');
+ }
+};
+$.extend(Pizza, {
+ bar: function (legend) {
+ var settings = legend.data('settings'),
+ svg = this.svg(legend, settings),
+ data = legend.data('graph-data'),
+ current_offset = 0,
+ container = $(this.identifier(legend)),
+ base_width = container.outerWidth(),
+ base_height = container.outerHeight(),
+ max = min = 0,
+ total = 0,
+ spacer = settings.bar_spacer * (settings.bar_spacer/ base_width),
+ interval = (base_width - (data.length * spacer)) / data.length;
+
+ if (interval < 10) {
+ spacer = 1;
+ interval = (base_width - (data.length * spacer)) / data.length;
+ }
+
+ for (var i = 0; i < data.length; i++) {
+ if (max < data[i].value) max = data[i].value;
+ if (min > data[i].value) min = data[i].value;
+ total += data[i].value;
+ }
+
+ var existing_group = $('g[data-id=bars]', svg);
+
+ if (existing_group.length > 0) {
+ var g = existing_group[0];
+ } else {
+ var g = this.svg_obj('g');
+ g.setAttribute('data-id', 'bars');
+ }
+
+ if (settings.show_grid) {
+ this.assemble_grid(svg, min, max, base_width, base_height, settings);
+ }
+
+ g.setAttribute('transform', 'translate(0, ' + (base_height) +') scale(1, -1)');
+
+ for (var i = 0; i < data.length; i++) {
+ var y = (base_height) * (data[i].value / max);
+
+ var existing_rect = $('rect[data-id=r' + i +']', g);
+
+ if (existing_rect.length > 0) {
+ var rect = existing_rect[0];
+ } else {
+ var rect = this.svg_obj('rect');
+ rect.setAttribute('data-id', 'r' + i);
+ }
+
+ if (current_offset === 0) {
+ var new_offset = current_offset;
+ } else {
+ var new_offset = current_offset + spacer;
+ }
+
+ rect.setAttribute('data-y', y);
+
+ this.set_attr(rect, {
+ x : new_offset,
+ y : 0,
+ width : interval,
+ height : 0,
+ fill: data[i].color,
+ stroke: settings.stroke_color,
+ 'strokeWidth': settings.stroke_width
+ });
+
+ Snap(rect).animate({height: y}, 1500, mina[settings.animation_type]);
+
+ current_offset = new_offset + interval;
+
+ if (existing_group.length < 1) {
+ g.appendChild(rect);
+ this.animate_bar(Snap(rect), y, settings);
+ }
+ }
+
+ if (existing_group.length < 1) {
+ svg.appendChild(g);
+ }
+
+ return [legend, svg];
+ },
+
+ animate_bar : function (el, y, settings) {
+ var self = this,
+ $el = $(el),
+ new_y = y + 15;
+
+ el.hover(function (e) {
+ var path = Snap(e.target);
+
+ path.animate({
+ height: new_y
+ }, settings.animation_speed, mina[settings.animation_type]);
+
+ }, function (e) {
+ var path = Snap(e.target);
+
+ path.animate({
+ height: y
+ }, settings.animation_speed, mina[settings.animation_type]);
+ });
+
+ },
+
+ assemble_grid : function (svg, min, max, width, height, settings) {
+ var existing_group = $('g[data-id=bars]', svg);
+
+ if (existing_group.length > 0) {
+ var line_g = $('g[data-id=grid]', svg)[0],
+ text_g = $('g[data-id=labels]', svg)[0];
+ } else {
+ var line_g = this.svg_obj('g'),
+ text_g = this.svg_obj('g');
+
+ line_g.setAttribute('data-id', 'grid');
+ text_g.setAttribute('data-id', 'labels');
+ }
+
+ var ticks = this.ticks(min, max, settings.bar_intervals),
+ ticks_length = i = ticks.length,
+ interval = height/(ticks_length-1),
+ total_tick_height = 0;
+
+ while (i--) {
+ if (existing_group.length > 0) {
+ var line = $('line[data-id=l' + i + ']', line_g)[0],
+ text = $('text[data-id=t' + i + ']', text_g)[0];
+ } else {
+ var line = this.svg_obj('line'),
+ text = this.svg_obj('text');
+
+ line.setAttribute('data-id', 'l' + i);
+ text.setAttribute('data-id', 't' + i);
+ }
+
+ var line_height = total_tick_height + interval;
+
+ this.set_attr(line, {
+ x1 : 0,
+ x2 : width,
+ y1 : line_height,
+ y2 : line_height,
+ stroke : 'gray',
+ 'stroke-width' : 1,
+ 'stroke-dasharray' : '5,5'
+ })
+ .set_attr(text, {
+ x : -8,
+ y : line_height + 5,
+ 'text-anchor': 'end'
+ });
+
+ text.innerHTML = ticks[i];
+
+ if (existing_group.length < 1) {
+ line_g.appendChild(line);
+ text_g.appendChild(text);
+ }
+
+ total_tick_height = line_height;
+ }
+
+ line_g.setAttribute('transform', 'translate(0, -' + total_tick_height / ticks_length + ')');
+ text_g.setAttribute('transform', 'translate(0, -' + total_tick_height / ticks_length + ')');
+
+ if (existing_group.length < 1) {
+ svg.appendChild(line_g);
+ svg.appendChild(text_g);
+ }
+
+ },
+
+ bar_events : function () {
+ var self = this;
+
+ $(this.scope).on('mouseenter.pizza mouseleave.pizza touchstart.pizza', '[data-bar-id] li', function (e) {
+ var parent = $(this).parent(),
+ path = $('#' + parent.attr('data-bar-id') + ' rect[data-id=r' + $(this).index() + ']')[0],
+ settings = $(this).parent().data('settings'),
+ new_height = parseInt(path.getAttribute('data-y'), 10) + 15;
+
+ if (/start/i.test(e.type)) {
+ $(path).siblings('rect').each(function () {
+ if (this.nodeName) {
+ Snap(path).animate({
+ height: path.getAttribute('data-y')
+ }, settings.animation_speed, mina[settings.animation_type]);
+ }
+ });
+ }
+
+ if (/enter|start/i.test(e.type)) {
+ Snap(path).animate({
+ height: new_height
+ }, settings.animation_speed, mina[settings.animation_type]);
+ } else {
+ Snap(path).animate({
+ height: path.getAttribute('data-y')
+ }, settings.animation_speed, mina[settings.animation_type]);
+ }
+ });
+ }
+});
+$.extend(Pizza, {
+ line : function (legend) {
+ var settings = legend.data('settings'),
+ svg = this.svg(legend, settings),
+ container = $(this.identifier(legend)),
+ width = container.outerWidth(),
+ height = container.outerHeight(),
+ data = legend.data('graph-data'),
+ max_x = max_y = min_x = min_y = total_x = total_y = 0,
+ i = data.length,
+ points = '';
+
+ for (var i = 0; i < data.length; i++) {
+ if (data[i].x > max_x) max_x = data[i].x;
+ if (data[i].y > max_y) max_y = data[i].y;
+ if (min_x > data[i].x) min_x = data[i].x;
+ if (min_y > data[i].y) min_y = data[i].y;
+ total_x += data[i].x;
+ total_y += data[i].y;
+ }
+
+ var existing_group = $('g[data-id=line]', svg);
+
+ if (existing_group.length > 0) {
+ var line_g = $('g[data-id=line]', svg)[0],
+ circle_g = $('g[data-id=points]', svg)[0],
+ polyline = $('path[data-id=path]', line_g)[0];
+ } else {
+ var polyline = this.svg_obj('path'),
+ line_g = this.svg_obj('g'),
+ circle_g = this.svg_obj('g');
+
+ line_g.setAttribute('data-id', 'line');
+ circle_g.setAttribute('data-id', 'points');
+ polyline.setAttribute('data-id', 'path');
+ }
+
+ for (var i = 0; i < data.length; i++) {
+ if (existing_group.length > 0) {
+ var circle = $('circle[data-id=c' + i + ']', circle_g)[0];
+ } else {
+ var circle = this.svg_obj('circle');
+
+ circle.setAttribute('data-id', 'c' + i);
+ }
+
+ var x = (data[i].x / max_x) * width,
+ y = (data[i].y / max_y) * height;
+
+ points += x + ',' + y + ' ';
+ this.set_attr(circle, {cx: x, cy: y,r: 0,fill: data[i.color],
+ 'data-value': data[i].x + ', ' + data[i].y,
+ 'data-tooltip': '',
+ 'title': data[i].x + ', ' + data[i].y,
+ 'class': 'has-tip tip-top'});
+
+ Snap(circle).animate({
+ r: 4
+ }, 1500, mina[settings.animation_type]);
+
+ this.animate(Snap(circle), x, y, settings, 2);
+
+ if (existing_group.length < 1) {
+ circle_g.appendChild(circle);
+ }
+ }
+
+ this.flip(circle_g, height);
+ this.flip(line_g, height);
+
+ if (settings.show_grid) {
+ this.assemble_grid_x(svg, min_x, max_x, width, height, settings);
+ this.assemble_grid_y(svg, min_y, max_y, width, height, settings);
+ }
+ var v = this.points_to_path(points);
+
+ this.set_attr(polyline, {d:v, fill: 'none', stroke: 'black', 'stroke-width': 2});
+
+ if (existing_group.length < 1) {
+ line_g.appendChild(polyline);
+ svg.appendChild(line_g);
+ }
+
+ if (existing_group.length < 1) {
+ svg.appendChild(circle_g);
+ }
+
+ return [legend, svg];
+ },
+
+ assemble_grid_x : function (svg, min, max, width, height, settings) {
+ var existing_group = $('g[data-id=gridx]', svg);
+
+ if (existing_group.length > 0) {
+ var line_g = existing_group[0],
+ text_g = $('g[data-id=labelx]', svg)[0];
+ } else {
+ var line_g = this.svg_obj('g'),
+ text_g = this.svg_obj('g');
+
+ line_g.setAttribute('data-id', 'gridx');
+ text_g.setAttribute('data-id', 'labelx');
+ }
+
+ var ticks = this.ticks(min, max, settings.bar_intervals).reverse(),
+ ticks_length = i = ticks.length,
+ total_tick_width = 0,
+ interval = width/(ticks_length-1);
+
+ while (i--) {
+ if (existing_group.length > 0) {
+ var line = $('line[data-id=l' + i + ']', line_g)[0],
+ text = $('text[data-id=t' + i + ']', text_g)[0];
+ } else {
+ var line = this.svg_obj('line'),
+ text = this.svg_obj('text');
+
+ line.setAttribute('data-id', 'l' + i);
+ text.setAttribute('data-id', 't' + i);
+ }
+
+ var line_width = total_tick_width + interval;
+
+ this.set_attr(line, {
+ x1 : line_width,
+ x2 : line_width,
+ y1 : 0,
+ y2 : height,
+ stroke : 'gray',
+ 'stroke-width' : 1,
+ 'stroke-dasharray' : '5,5'
+ })
+ .set_attr(text, {
+ y: height + 20,
+ x: line_width - interval,
+ 'text-anchor': 'middle'
+ });
+
+ if (existing_group.length < 1) {
+ text.innerHTML = ticks[i];
+ text_g.appendChild(text);
+ line_g.appendChild(line);
+ }
+
+ total_tick_width = line_width;
+ }
+
+ line_g.setAttribute('transform', 'translate(-' + interval + ', 0)');
+
+ if (existing_group.length < 1) {
+ svg.appendChild(line_g);
+ svg.appendChild(text_g);
+ }
+ },
+
+ assemble_grid_y : function (svg, min, max, width, height, settings) {
+ var existing_group = $('g[data-id=gridy]', svg);
+
+ if (existing_group.length > 0) {
+ var line_g = existing_group[0],
+ text_g = $('g[data-id=labely]', svg)[0];
+ } else {
+ var line_g = this.svg_obj('g'),
+ text_g = this.svg_obj('g');
+
+ line_g.setAttribute('data-id', 'gridy');
+ text_g.setAttribute('data-id', 'labely');
+ }
+
+ var ticks = this.ticks(min, max, settings.bar_intervals),
+ ticks_length = i = ticks.length,
+ total_tick_height = 0;
+
+ while (i--) {
+ if (existing_group.length > 0) {
+ var line = $('line[data-id=l' + i + ']', line_g)[0],
+ text = $('text[data-id=t' + i + ']', text_g)[0];
+ } else {
+ var line = this.svg_obj('line'),
+ text = this.svg_obj('text');
+
+ line.setAttribute('data-id', 'l' + i);
+ text.setAttribute('data-id', 't' + i);
+ }
+
+ var line_height = total_tick_height + (height/(ticks_length-1));
+
+ this.set_attr(line, {
+ x1 : 0,
+ x2 : width,
+ y1 : line_height,
+ y2 : line_height,
+ stroke : 'gray',
+ 'stroke-width' : 1,
+ 'stroke-dasharray' : '5,5'
+ })
+ .set_attr(text, {
+ x : -8,
+ y : line_height + 5,
+ 'text-anchor': 'end'
+ });
+
+ if (existing_group.length < 1) {
+ text_g.appendChild(text);
+ line_g.appendChild(line);
+ text.innerHTML = ticks[i];
+ }
+
+ total_tick_height = line_height;
+ }
+
+ line_g.setAttribute('transform', 'translate(0, -' + total_tick_height / ticks_length + ')');
+ text_g.setAttribute('transform', 'translate(0, -' + total_tick_height / ticks_length + ')');
+
+ if (existing_group.length < 1) {
+ svg.appendChild(line_g);
+ svg.appendChild(text_g);
+ }
+
+ },
+
+ points_to_path : function (points) {
+ var points = points.split(/\s+|,/);
+ var x0=points.shift(), y0=points.shift();
+ var pathdata = 'M'+x0+','+y0+'L'+points.join(' ');
+ return ['M'+x0+','+y0+'L'].concat(points).join(' ');
+ },
+
+ line_events : function () {
+ $(this.scope).on('mouseenter.pizza mouseleave.pizza touchstart.pizza', '[data-line-id] li', function (e) {
+ var parent = $(this).parent(),
+ path = $('#' + parent.data('line-id') + ' circle[data-id="c' + $(this).index() + '"]')[0],
+ settings = $(this).parent().data('settings');
+
+ if (/start/i.test(e.type)) {
+ $(path).siblings('circle').each(function () {
+ if (this.nodeName) {
+ Snap(path).animate({
+ transform: 's1 1 ' + path.getAttribute('cx') + ' ' + path.getAttribute('cy')
+ }, settings.animation_speed, mina[settings.animation_type]);
+ }
+ });
+ }
+
+ if (/enter|start/i.test(e.type)) {
+ Snap(path).animate({
+ transform: 's2 2 ' + path.getAttribute('cx') + ' ' + path.getAttribute('cy')
+ }, settings.animation_speed, mina[settings.animation_type]);
+ $(path).trigger('mouseenter')
+ } else {
+ Snap(path).animate({
+ transform: 's1 1 ' + path.getAttribute('cx') + ' ' + path.getAttribute('cy')
+ }, settings.animation_speed, mina[settings.animation_type]);
+ $(path).trigger('mouseout')
+ }
+ });
+ }
+
+});
+$.extend(Pizza, {
+ pie : function (legend) {
+ // pie chart concept from JavaScript the
+ // Definitive Guide 6th edition by David Flanagan
+ var settings = legend.data('settings'),
+ svg = this.svg(legend, settings),
+ data = legend.data('graph-data'),
+ total = 0,
+ angles = [],
+ start_angle = 0,
+ container = $(this.identifier(legend)),
+ base = container.outerWidth();
+
+ for (var i = 0; i < data.length; i++) {
+ total += data[i].value;
+ }
+
+ for (var i = 0; i < data.length; i++) {
+ angles[i] = data[i].value / total * Math.PI * 2;
+ }
+
+ if(angles.length == 1) angles[0] = Math.PI * 2 - 0.0001; // if 1
+
+ for (var i = 0; i < data.length; i++) {
+ var end_angle = start_angle + angles[i];
+ var cx = (base / 2),
+ cy = (base / 2),
+ r = ((base / 2) * 0.85);
+
+ if (!settings.donut) {
+ // Compute the two points where our wedge intersects the circle
+ // These formulas are chosen so that an angle of 0 is at 12 o'clock
+ // and positive angles increase clockwise
+ var x1 = cx + r * Math.sin(start_angle);
+ var y1 = cy - r * Math.cos(start_angle);
+ var x2 = cx + r * Math.sin(end_angle);
+ var y2 = cy - r * Math.cos(end_angle);
+
+ // This is a flag for angles larger than than a half circle
+ // It is required by the SVG arc drawing component
+ var big = 0;
+ if (end_angle - start_angle > Math.PI) big = 1;
+
+ // This string holds the path details
+ var d = "M" + cx + "," + cy + // Start at circle center
+ " L" + x1 + "," + y1 + // Draw line to (x1,y1)
+ " A" + r + "," + r + // Draw an arc of radius r
+ " 0 " + big + " 1 " + // Arc details...
+ x2 + "," + y2 + // Arc goes to to (x2,y2)
+ " Z"; // Close path back to (cx,cy)
+ }
+
+ var existing_path = $('path[data-id="s' + i + '"]', svg);
+
+ if (existing_path.length > 0) {
+ var path = existing_path[0];
+ } else {
+ var path = this.svg_obj('path');
+ }
+
+ var percent = (data[i].value / total) * 100.0;
+
+ var existing_text = $('text[data-id="s' + i + '"]', svg);
+
+ if (existing_text.length > 0) {
+ var text = existing_text[0];
+
+ text.setAttribute('x', cx + (r + settings.percent_offset) * Math.sin(start_angle + (angles[i] / 2)));
+ text.setAttribute('y', cy - (r + settings.percent_offset) * Math.cos(start_angle + (angles[i] / 2)));
+
+ } else {
+
+ if (data[i].text) {
+ var visible_text = this.parse_options(data[i].text, percent, data[i].value);
+ } else {
+ var visible_text = Math.ceil(percent) + '%';
+ }
+ var text = this.svg_obj('text');
+
+ text.setAttribute('x', cx + (r + settings.percent_offset) * Math.sin(start_angle + (angles[i] / 2)));
+ text.setAttribute('y', cy - (r + settings.percent_offset) * Math.cos(start_angle + (angles[i] / 2)));
+ text.innerHTML = visible_text;
+ }
+
+ text.setAttribute('text-anchor', 'middle');
+
+ if (settings.always_show_text) {
+ Snap(text).animate({
+ opacity: 1
+ }, settings.animation_speed);
+ } else {
+ Snap(text).attr({
+ opacity: 0
+ }, settings.animation_speed);
+ }
+
+ text.setAttribute('data-id', 's' + i);
+
+ if (settings.donut) {
+ this.annular_sector(path, {
+ centerX:cx, centerY:cy,
+ startDegrees:start_angle, endDegrees:end_angle,
+ innerRadius: (r * settings.donut_inner_ratio), outerRadius:r
+ });
+ } else {
+ path.setAttribute('d', d);
+ }
+
+ this.set_attr(path, {
+ fill: data[i].color,
+ stroke: settings.stroke_color,
+ 'strokeWidth': settings.stroke_width,
+ 'data-cx' : cx,
+ 'data-cy' : cy,
+ 'data-id' : 's' + i
+ });
+
+ var existing_group = $('g[data-id=g' + i + ']', svg);
+
+ if (existing_group.length < 1) {
+ var g = this.svg_obj('g');
+
+ g.setAttribute('data-id', 'g' + i);
+ g.appendChild(path);
+ g.appendChild(text);
+ svg.appendChild(g);
+
+ this.animate(Snap(path), cx, cy, settings);
+ }
+
+ // The next wedge begins where this one ends
+ start_angle = end_angle;
+ }
+
+ return [legend, svg];
+ },
+
+ annular_sector : function (path, options) {
+ var opts = optionsWithDefaults(options);
+
+ var p = [ // points
+ [opts.cx + opts.r2*Math.sin(opts.startRadians),
+ opts.cy - opts.r2*Math.cos(opts.startRadians)],
+ [opts.cx + opts.r2*Math.sin(opts.closeRadians),
+ opts.cy - opts.r2*Math.cos(opts.closeRadians)],
+ [opts.cx + opts.r1*Math.sin(opts.closeRadians),
+ opts.cy - opts.r1*Math.cos(opts.closeRadians)],
+ [opts.cx + opts.r1*Math.sin(opts.startRadians),
+ opts.cy - opts.r1*Math.cos(opts.startRadians)],
+ ];
+
+ var angleDiff = opts.closeRadians - opts.startRadians;
+ var largeArc = (angleDiff % (Math.PI*2)) > Math.PI ? 1 : 0;
+ var cmds = [];
+ cmds.push("M"+p[0].join()); // Move to P0
+ cmds.push("A"+[opts.r2,opts.r2,0,largeArc,1,p[1]].join()); // Arc to P1
+ cmds.push("L"+p[2].join()); // Line to P2
+ cmds.push("A"+[opts.r1,opts.r1,0,largeArc,0,p[3]].join()); // Arc to P3
+ cmds.push("z"); // Close path (Line to P0)
+ path.setAttribute('d',cmds.join(' '));
+
+ function optionsWithDefaults(o){
+ // Create a new object so that we don't mutate the original
+ var o2 = {
+ cx : o.centerX || 0,
+ cy : o.centerY || 0,
+ startRadians : (o.startDegrees || 0),
+ closeRadians : (o.endDegrees || 0),
+ };
+
+ var t = o.thickness!==undefined ? o.thickness : 100;
+ if (o.innerRadius!==undefined) o2.r1 = o.innerRadius;
+ else if (o.outerRadius!==undefined) o2.r1 = o.outerRadius - t;
+ else o2.r1 = 200 - t;
+ if (o.outerRadius!==undefined) o2.r2 = o.outerRadius;
+ else o2.r2 = o2.r1 + t;
+
+ if (o2.r1<0) o2.r1 = 0;
+ if (o2.r2<0) o2.r2 = 0;
+
+ return o2;
+ }
+ },
+
+ pie_events : function () {
+ $(this.scope).on('mouseenter.pizza mouseleave.pizza touchstart.pizza', '[data-pie-id] li', function (e) {
+ var parent = $(this).parent(),
+ path = $('#' + parent.attr('data-pie-id') + ' path[data-id="s' + $(this).index() + '"]')[0],
+ text = path.nextSibling,
+ settings = $(this).parent().data('settings');
+
+ if (/start/i.test(e.type)) {
+ $(path).siblings('path').each(function () {
+ if (this.nodeName) {
+ Snap(path).animate({
+ transform: 's1 1 ' + path.getAttribute('data-cx') + ' ' + path.getAttribute('data-cy')
+ }, settings.animation_speed, mina[settings.animation_type]);
+ Snap($(this).next()[0]).animate({
+ opacity: 0
+ }, settings.animation_speed);
+ }
+ });
+ }
+
+ if (/enter|start/i.test(e.type)) {
+ Snap(path).animate({
+ transform: 's1.05 1.05 ' + path.getAttribute('data-cx') + ' ' + path.getAttribute('data-cy')
+ }, settings.animation_speed, mina[settings.animation_type]);
+
+ if (settings.show_text) {
+ Snap(text).animate({
+ opacity: 1
+ }, settings.animation_speed);
+ }
+ } else {
+ Snap(path).animate({
+ transform: 's1 1 ' + path.getAttribute('data-cx') + ' ' + path.getAttribute('data-cy')
+ }, settings.animation_speed, mina[settings.animation_type]);
+ Snap(text).animate({
+ opacity: 0
+ }, settings.animation_speed);
+ }
+ });
+ }
+});
View
1 ajax/libs/pizza/0.2.0/js/pizza.min.js
@@ -0,0 +1 @@
+var Pizza={version:"0.2.0",settings:{donut:false,donut_inner_ratio:0.4,percent_offset:35,show_text:true,animation_speed:500,always_show_text:false,show_grid:true,bar_spacer:100,bar_intervals:6,animation_type:"elastic"},NS:"http://www.w3.org/2000/svg",init:function(c,b){var a=this;this.scope=c||document.body;var d=$("[data-pie-id], [data-line-id], [data-bar-id]",this.scope);$.extend(true,this.settings,b);if(d.length>0){d.each(function(){return a.build($(this),b)})}else{if($(this.scope).is("[data-pie-id]")||$(this.scope).is("[data-line-id]")||$(this.scope).is("[data-bar-id]")){this.build($(this.scope),b)}}this.events()},events:function(){var a=this;$(window).off(".pizza").on("resize.pizza",a.throttle(function(){a.init()},500));$(this.scope).off(".pizza");this.pie_events();this.line_events();this.bar_events()},build:function(b,a){b.data("settings",$.extend({},this.settings,a,b.data("options")));this.data(b,a||{});if(b.data("pie-id")){this.update_DOM(this.pie(b))}else{if(b.data("line-id")){this.update_DOM(this.line(b))}else{if(b.data("bar-id")){this.update_DOM(this.bar(b))}}}},data:function(b,a){var d=[],c=0;$("li",b).each(function(){var e=$(this);if(a.data){d.push({value:a.data[e.index()],text:e.data("text"),color:e.css("color"),segment:e})}else{d.push({x:e.data("x"),y:e.data("y"),value:e.data("value"),text:e.data("text"),color:e.css("color"),segment:e})}});return b.data("graph-data",d)},update_DOM:function(c){var a=c[0],b=c[1];return $(this.identifier(a)).html(b)},animate:function(d,a,f,c,e){var b=this,e=e||1.05;d.hover(function(h){var g=Snap(h.target),j=Snap(g.node.nextSibling);g.animate({transform:"s"+e+" "+e+" "+a+" "+f},c.animation_speed,mina[c.animation_type]);if(!/text/.test(j.node.nodeName)){return}j.touchend(function(){Snap(g).animate({transform:"s"+e+" "+e+" "+a+" "+f},c.animation_speed,mina[c.animation_type])});if(c.show_text){j.animate({opacity:1},c.animation_speed);j.touchend(function(){j.animate({opacity:1},c.animation_speed)})}},function(h){var g=Snap(h.target),j=Snap(g.node.nextSibling);g.animate({transform:"s1 1 "+a+" "+f},c.animation_speed,mina[c.animation_type]);if(!/text/.test(j.node.nodeName)){return}j.animate({opacity:0},c.animation_speed)})},parse_options:function(b,d,f){var e=b.match(/{{(percent|value)}}/g),a="";for(var c=0;c<e.length;c++){if(/percent/i.test(e[c])){a=b.replace(e[c],[Math.ceil(d),"%"].join(""))}if(/value/i.test(e[c])){a=a.replace(e[c],f)}}return a},svg:function(h,g){var c=$(this.identifier(h)),d=$("svg",c),f=c.width(),b=h.attr("data-pie-id"),a=c.height();if(d.length>0){d=d[0]}else{var d=this.svg_obj("svg");d.width=f;d.height=a}if(b){var e="-"+g.percent_offset+" -"+g.percent_offset+" "+(f+(g.percent_offset*1.5))+" "+(f+(g.percent_offset*1.5))}else{var e="-"+g.percent_offset+" -"+g.percent_offset+" "+(f+(g.percent_offset*1.6))+" "+(a+(g.percent_offset*1.6))}this.set_attr(d,{width:"100%",height:"100%",viewBox:e});return d},identifier:function(a){id=a.data("pie-id")||a.data("bar-id")||a.data("line-id");return"#"+id},throttle:function(a,b){var c=null;return function(){var e=this,d=arguments;clearTimeout(c);c=setTimeout(function(){a.apply(e,d)},b)}},svg_obj:function(a){return document.createElementNS(this.NS,a)},ticks:function(c,g,d){var k=g-c,a=Math.pow(10,Math.floor(Math.log(k/d)/Math.LN10)),b=d/k*a;if(b<=0.15){a*=10}else{if(b<=0.35){a*=5}else{if(b<=0.75){a*=2}}}var f=Math.ceil(c/a)*a,e=Math.floor(g/a)*a+a*0.5,j=[],h;for(i=f;i<e;i+=a){j.push(i)}return j},set_attr:function(b,a){for(attr in a){b.setAttribute(attr,a[attr])}return this},flip:function(b,a){b.setAttribute("transform","translate(0, "+a+") scale(1, -1)")}};$.extend(Pizza,{bar:function(b){var q=b.data("settings"),j=this.svg(b,q),t=b.data("graph-data"),k=0,h=$(this.identifier(b)),s=h.outerWidth(),d=h.outerHeight(),n=min=0,u=0,e=q.bar_spacer*(q.bar_spacer/s),r=(s-(t.length*e))/t.length;if(r<10){e=1;r=(s-(t.length*e))/t.length}for(var o=0;o<t.length;o++){if(n<t[o].value){n=t[o].value}if(min>t[o].value){min=t[o].value}u+=t[o].value}var c=$("g[data-id=bars]",j);if(c.length>0){var p=c[0]}else{var p=this.svg_obj("g");p.setAttribute("data-id","bars")}if(q.show_grid){this.assemble_grid(j,min,n,s,d,q)}p.setAttribute("transform","translate(0, "+(d)+") scale(1, -1)");for(var o=0;o<t.length;o++){var f=(d)*(t[o].value/n);var m=$("rect[data-id=r"+o+"]",p);if(m.length>0){var a=m[0]}else{var a=this.svg_obj("rect");a.setAttribute("data-id","r"+o)}if(k===0){var l=k}else{var l=k+e}a.setAttribute("data-y",f);this.set_attr(a,{x:l,y:0,width:r,height:0,fill:t[o].color,stroke:q.stroke_color,strokeWidth:q.stroke_width});Snap(a).animate({height:f},1500,mina[q.animation_type]);k=l+r;if(c.length<1){p.appendChild(a);this.animate_bar(Snap(a),f,q)}}if(c.length<1){j.appendChild(p)}return[b,j]},animate_bar:function(e,f,d){var a=this,c=$(e),b=f+15;e.hover(function(h){var g=Snap(h.target);g.animate({height:b},d.animation_speed,mina[d.animation_type])},function(h){var g=Snap(h.target);g.animate({height:f},d.animation_speed,mina[d.animation_type])})},assemble_grid:function(h,g,l,a,p,e){var b=$("g[data-id=bars]",h);if(b.length>0){var k=$("g[data-id=grid]",h)[0],d=$("g[data-id=labels]",h)[0]}else{var k=this.svg_obj("g"),d=this.svg_obj("g");k.setAttribute("data-id","grid");d.setAttribute("data-id","labels")}var m=this.ticks(g,l,e.bar_intervals),f=i=m.length,c=p/(f-1),j=0;while(i--){if(b.length>0){var q=$("line[data-id=l"+i+"]",k)[0],o=$("text[data-id=t"+i+"]",d)[0]}else{var q=this.svg_obj("line"),o=this.svg_obj("text");q.setAttribute("data-id","l"+i);o.setAttribute("data-id","t"+i)}var n=j+c;this.set_attr(q,{x1:0,x2:a,y1:n,y2:n,stroke:"gray","stroke-width":1,"stroke-dasharray":"5,5"}).set_attr(o,{x:-8,y:n+5,"text-anchor":"end"});o.innerHTML=m[i];if(b.length<1){k.appendChild(q);d.appendChild(o)}j=n}k.setAttribute("transform","translate(0, -"+j/f+")");d.setAttribute("transform","translate(0, -"+j/f+")");if(b.length<1){h.appendChild(k);h.appendChild(d)}},bar_events:function(){var a=this;$(this.scope).on("mouseenter.pizza mouseleave.pizza touchstart.pizza","[data-bar-id] li",function(g){var d=$(this).parent(),f=$("#"+d.attr("data-bar-id")+" rect[data-id=r"+$(this).index()+"]")[0],c=$(this).parent().data("settings"),b=parseInt(f.getAttribute("data-y"),10)+15;if(/start/i.test(g.type)){$(f).siblings("rect").each(function(){if(this.nodeName){Snap(f).animate({height:f.getAttribute("data-y")},c.animation_speed,mina[c.animation_type])}})}if(/enter|start/i.test(g.type)){Snap(f).animate({height:b},c.animation_speed,mina[c.animation_type])}else{Snap(f).animate({height:f.getAttribute("data-y")},c.animation_speed,mina[c.animation_type])}})}});$.extend(Pizza,{line:function(a){var q=a.data("settings"),l=this.svg(a,q),j=$(this.identifier(a)),n=j.outerWidth(),k=j.outerHeight(),s=a.data("graph-data"),r=max_y=min_x=min_y=total_x=total_y=0,p=s.length,o="";for(var p=0;p<s.length;p++){if(s[p].x>r){r=s[p].x}if(s[p].y>max_y){max_y=s[p].y}if(min_x>s[p].x){min_x=s[p].x}if(min_y>s[p].y){min_y=s[p].y}total_x+=s[p].x;total_y+=s[p].y}var b=$("g[data-id=line]",l);if(b.length>0){var e=$("g[data-id=line]",l)[0],d=$("g[data-id=points]",l)[0],m=$("path[data-id=path]",e)[0]}else{var m=this.svg_obj("path"),e=this.svg_obj("g"),d=this.svg_obj("g");e.setAttribute("data-id","line");d.setAttribute("data-id","points");m.setAttribute("data-id","path")}for(var p=0;p<s.length;p++){if(b.length>0){var c=$("circle[data-id=c"+p+"]",d)[0]}else{var c=this.svg_obj("circle");c.setAttribute("data-id","c"+p)}var g=(s[p].x/r)*n,f=(s[p].y/max_y)*k;o+=g+","+f+" ";this.set_attr(c,{cx:g,cy:f,r:0,fill:s[p.color],"data-value":s[p].x+", "+s[p].y,"data-tooltip":"",title:s[p].x+", "+s[p].y,"class":"has-tip tip-top"});Snap(c).animate({r:4},1500,mina[q.animation_type]);this.animate(Snap(c),g,f,q,2);if(b.length<1){d.appendChild(c)}}this.flip(d,k);this.flip(e,k);if(q.show_grid){this.assemble_grid_x(l,min_x,r,n,k,q);this.assemble_grid_y(l,min_y,max_y,n,k,q)}var h=this.points_to_path(o);this.set_attr(m,{d:h,fill:"none",stroke:"black","stroke-width":2});if(b.length<1){e.appendChild(m);l.appendChild(e)}if(b.length<1){l.appendChild(d)}return[a,l]},assemble_grid_x:function(k,h,m,a,p,f){var b=$("g[data-id=gridx]",k);if(b.length>0){var l=b[0],d=$("g[data-id=labelx]",k)[0]}else{var l=this.svg_obj("g"),d=this.svg_obj("g");l.setAttribute("data-id","gridx");d.setAttribute("data-id","labelx")}var n=this.ticks(h,m,f.bar_intervals).reverse(),g=i=n.length,j=0,c=a/(g-1);while(i--){if(b.length>0){var q=$("line[data-id=l"+i+"]",l)[0],o=$("text[data-id=t"+i+"]",d)[0]}else{var q=this.svg_obj("line"),o=this.svg_obj("text");q.setAttribute("data-id","l"+i);o.setAttribute("data-id","t"+i)}var e=j+c;this.set_attr(q,{x1:e,x2:e,y1:0,y2:p,stroke:"gray","stroke-width":1,"stroke-dasharray":"5,5"}).set_attr(o,{y:p+20,x:e-c,"text-anchor":"middle"});if(b.length<1){o.innerHTML=n[i];d.appendChild(o);l.appendChild(q)}j=e}l.setAttribute("transform","translate(-"+c+", 0)");if(b.length<1){k.appendChild(l);k.appendChild(d)}},assemble_grid_y:function(g,f,k,a,o,d){var b=$("g[data-id=gridy]",g);if(b.length>0){var j=b[0],c=$("g[data-id=labely]",g)[0]}else{var j=this.svg_obj("g"),c=this.svg_obj("g");j.setAttribute("data-id","gridy");c.setAttribute("data-id","labely")}var l=this.ticks(f,k,d.bar_intervals),e=i=l.length,h=0;while(i--){if(b.length>0){var p=$("line[data-id=l"+i+"]",j)[0],n=$("text[data-id=t"+i+"]",c)[0]}else{var p=this.svg_obj("line"),n=this.svg_obj("text");p.setAttribute("data-id","l"+i);n.setAttribute("data-id","t"+i)}var m=h+(o/(e-1));this.set_attr(p,{x1:0,x2:a,y1:m,y2:m,stroke:"gray","stroke-width":1,"stroke-dasharray":"5,5"}).set_attr(n,{x:-8,y:m+5,"text-anchor":"end"});if(b.length<1){c.appendChild(n);j.appendChild(p);n.innerHTML=l[i]}h=m}j.setAttribute("transform","translate(0, -"+h/e+")");c.setAttribute("transform","translate(0, -"+h/e+")");if(b.length<1){g.appendChild(j);g.appendChild(c)}},points_to_path:function(c){var c=c.split(/\s+|,/);var b=c.shift(),d=c.shift();var a="M"+b+","+d+"L"+c.join(" ");return["M"+b+","+d+"L"].concat(c).join(" ")},line_events:function(){$(this.scope).on("mouseenter.pizza mouseleave.pizza touchstart.pizza","[data-line-id] li",function(d){var b=$(this).parent(),c=$("#"+b.data("line-id")+' circle[data-id="c'+$(this).index()+'"]')[0],a=$(this).parent().data("settings");if(/start/i.test(d.type)){$(c).siblings("circle").each(function(){if(this.nodeName){Snap(c).animate({transform:"s1 1 "+c.getAttribute("cx")+" "+c.getAttribute("cy")},a.animation_speed,mina[a.animation_type])}})}if(/enter|start/i.test(d.type)){Snap(c).animate({transform:"s2 2 "+c.getAttribute("cx")+" "+c.getAttribute("cy")},a.animation_speed,mina[a.animation_type]);$(c).trigger("mouseenter")}else{Snap(c).animate({transform:"s1 1 "+c.getAttribute("cx")+" "+c.getAttribute("cy")},a.animation_speed,mina[a.animation_type]);$(c).trigger("mouseout")}})}});$.extend(Pizza,{pie:function(c){var A=c.data("settings"),s=this.svg(c,A),E=c.data("graph-data"),F=0,u=[],D=0,o=$(this.identifier(c)),m=o.outerWidth();for(var w=0;w<E.length;w++){F+=E[w].value}for(var w=0;w<E.length;w++){u[w]=E[w].value/F*Math.PI*2}if(u.length==1){u[0]=Math.PI*2-0.0001}for(var w=0;w<E.length;w++){var n=D+u[w];var j=(m/2),f=(m/2),q=((m/2)*0.85);if(!A.donut){var z=j+q*Math.sin(D);var h=f-q*Math.cos(D);var x=j+q*Math.sin(n);var e=f-q*Math.cos(n);var v=0;if(n-D>Math.PI){v=1}var B="M"+j+","+f+" L"+z+","+h+" A"+q+","+q+" 0 "+v+" 1 "+x+","+e+" Z"}var k=$('path[data-id="s'+w+'"]',s);if(k.length>0){var t=k[0]}else{var t=this.svg_obj("path")}var a=(E[w].value/F)*100;var b=$('text[data-id="s'+w+'"]',s);if(b.length>0){var p=b[0];p.setAttribute("x",j+(q+A.percent_offset)*Math.sin(D+(u[w]/2)));p.setAttribute("y",f-(q+A.percent_offset)*Math.cos(D+(u[w]/2)))}else{if(E[w].text){var C=this.parse_options(E[w].text,a,E[w].value)}else{var C=Math.ceil(a)+"%"}var p=this.svg_obj("text");p.setAttribute("x",j+(q+A.percent_offset)*Math.sin(D+(u[w]/2)));p.setAttribute("y",f-(q+A.percent_offset)*Math.cos(D+(u[w]/2)));p.innerHTML=C}p.setAttribute("text-anchor","middle");if(A.always_show_text){Snap(p).animate({opacity:1},A.animation_speed)}else{Snap(p).attr({opacity:0},A.animation_speed)}p.setAttribute("data-id","s"+w);if(A.donut){this.annular_sector(t,{centerX:j,centerY:f,startDegrees:D,endDegrees:n,innerRadius:(q*A.donut_inner_ratio),outerRadius:q})}else{t.setAttribute("d",B)}this.set_attr(t,{fill:E[w].color,stroke:A.stroke_color,strokeWidth:A.stroke_width,"data-cx":j,"data-cy":f,"data-id":"s"+w});var l=$("g[data-id=g"+w+"]",s);if(l.length<1){var y=this.svg_obj("g");y.setAttribute("data-id","g"+w);y.appendChild(t);y.appendChild(p);s.appendChild(y);this.animate(Snap(t),j,f,A)}D=n}return[c,s]},annular_sector:function(h,c){var e=b(c);var g=[[e.cx+e.r2*Math.sin(e.startRadians),e.cy-e.r2*Math.cos(e.startRadians)],[e.cx+e.r2*Math.sin(e.closeRadians),e.cy-e.r2*Math.cos(e.closeRadians)],[e.cx+e.r1*Math.sin(e.closeRadians),e.cy-e.r1*Math.cos(e.closeRadians)],[e.cx+e.r1*Math.sin(e.startRadians),e.cy-e.r1*Math.cos(e.startRadians)],];var d=e.closeRadians-e.startRadians;var f=(d%(Math.PI*2))>Math.PI?1:0;var a=[];a.push("M"+g[0].join());a.push("A"+[e.r2,e.r2,0,f,1,g[1]].join());a.push("L"+g[2].join());a.push("A"+[e.r1,e.r1,0,f,0,g[3]].join());a.push("z");h.setAttribute("d",a.join(" "));function b(l){var k={cx:l.centerX||0,cy:l.centerY||0,startRadians:(l.startDegrees||0),closeRadians:(l.endDegrees||0),};var j=l.thickness!==undefined?l.thickness:100;if(l.innerRadius!==undefined){k.r1=l.innerRadius}else{if(l.outerRadius!==undefined){k.r1=l.outerRadius-j}else{k.r1=200-j}}if(l.outerRadius!==undefined){k.r2=l.outerRadius}else{k.r2=k.r1+j}if(k.r1<0){k.r1=0}if(k.r2<0){k.r2=0}return k}},pie_events:function(){$(this.scope).on("mouseenter.pizza mouseleave.pizza touchstart.pizza","[data-pie-id] li",function(d){var b=$(this).parent(),c=$("#"+b.attr("data-pie-id")+' path[data-id="s'+$(this).index()+'"]')[0],f=c.nextSibling,a=$(this).parent().data("settings");if(/start/i.test(d.type)){$(c).siblings("path").each(function(){if(this.nodeName){Snap(c).animate({transform:"s1 1 "+c.getAttribute("data-cx")+" "+c.getAttribute("data-cy")},a.animation_speed,mina[a.animation_type]);Snap($(this).next()[0]).animate({opacity:0},a.animation_speed)}})}if(/enter|start/i.test(d.type)){Snap(c).animate({transform:"s1.05 1.05 "+c.getAttribute("data-cx")+" "+c.getAttribute("data-cy")},a.animation_speed,mina[a.animation_type]);if(a.show_text){Snap(f).animate({opacity:1},a.animation_speed)}}else{Snap(c).animate({transform:"s1 1 "+c.getAttribute("data-cx")+" "+c.getAttribute("data-cy")},a.animation_speed,mina[a.animation_type]);Snap(f).animate({opacity:0},a.animation_speed)}})}});
View
30 ajax/libs/pizza/0.2.0/js/vendor/dependencies.js
30 additions, 0 deletions not shown because the diff is too large. Please use a local Git client to view these changes.
View
25 ajax/libs/pizza/0.2.0/js/vendor/dependencies.min.js
25 additions, 0 deletions not shown because the diff is too large. Please use a local Git client to view these changes.
View
8 ajax/libs/pizza/0.2.0/js/vendor/modernizr.js
@@ -0,0 +1,8 @@
+/*!
+ * Modernizr v2.7.1
+ * www.modernizr.com
+ *
+ * Copyright (c) Faruk Ates, Paul Irish, Alex Sexton
+ * Available under the BSD and MIT licenses: www.modernizr.com/license/
+ */
+window.Modernizr=function(a,b,c){function d(a){t.cssText=a}function e(a,b){return d(x.join(a+";")+(b||""))}function f(a,b){return typeof a===b}function g(a,b){return!!~(""+a).indexOf(b)}function h(a,b){for(var d in a){var e=a[d];if(!g(e,"-")&&t[e]!==c)return"pfx"==b?e:!0}return!1}function i(a,b,d){for(var e in a){var g=b[a[e]];if(g!==c)return d===!1?a[e]:f(g,"function")?g.bind(d||b):g}return!1}function j(a,b,c){var d=a.charAt(0).toUpperCase()+a.slice(1),e=(a+" "+z.join(d+" ")+d).split(" ");return f(b,"string")||f(b,"undefined")?h(e,b):(e=(a+" "+A.join(d+" ")+d).split(" "),i(e,b,c))}function k(){o.input=function(c){for(var d=0,e=c.length;e>d;d++)E[c[d]]=!!(c[d]in u);return E.list&&(E.list=!(!b.createElement("datalist")||!a.HTMLDataListElement)),E}("autocomplete autofocus list placeholder max min multiple pattern required step".split(" ")),o.inputtypes=function(a){for(var d,e,f,g=0,h=a.length;h>g;g++)u.setAttribute("type",e=a[g]),d="text"!==u.type,d&&(u.value=v,u.style.cssText="position:absolute;visibility:hidden;",/^range$/.test(e)&&u.style.WebkitAppearance!==c?(q.appendChild(u),f=b.defaultView,d=f.getComputedStyle&&"textfield"!==f.getComputedStyle(u,null).WebkitAppearance&&0!==u.offsetHeight,q.removeChild(u)):/^(search|tel)$/.test(e)||(d=/^(url|email)$/.test(e)?u.checkValidity&&u.checkValidity()===!1:u.value!=v)),D[a[g]]=!!d;return D}("search tel url email datetime date month week time datetime-local number range color".split(" "))}var l,m,n="2.7.1",o={},p=!0,q=b.documentElement,r="modernizr",s=b.createElement(r),t=s.style,u=b.createElement("input"),v=":)",w={}.toString,x=" -webkit- -moz- -o- -ms- ".split(" "),y="Webkit Moz O ms",z=y.split(" "),A=y.toLowerCase().split(" "),B={svg:"http://www.w3.org/2000/svg"},C={},D={},E={},F=[],G=F.slice,H=function(a,c,d,e){var f,g,h,i,j=b.createElement("div"),k=b.body,l=k||b.createElement("body");if(parseInt(d,10))for(;d--;)h=b.createElement("div"),h.id=e?e[d]:r+(d+1),j.appendChild(h);return f=["&#173;",'<style id="s',r,'">',a,"</style>"].join(""),j.id=r,(k?j:l).innerHTML+=f,l.appendChild(j),k||(l.style.background="",l.style.overflow="hidden",i=q.style.overflow,q.style.overflow="hidden",q.appendChild(l)),g=c(j,a),k?j.parentNode.removeChild(j):(l.parentNode.removeChild(l),q.style.overflow=i),!!g},I=function(b){var c=a.matchMedia||a.msMatchMedia;if(c)return c(b).matches;var d;return H("@media "+b+" { #"+r+" { position: absolute; } }",function(b){d="absolute"==(a.getComputedStyle?getComputedStyle(b,null):b.currentStyle).position}),d},J=function(){function a(a,e){e=e||b.createElement(d[a]||"div"),a="on"+a;var g=a in e;return g||(e.setAttribute||(e=b.createElement("div")),e.setAttribute&&e.removeAttribute&&(e.setAttribute(a,""),g=f(e[a],"function"),f(e[a],"undefined")||(e[a]=c),e.removeAttribute(a))),e=null,g}var d={select:"input",change:"input",submit:"form",reset:"form",error:"img",load:"img",abort:"img"};return a}(),K={}.hasOwnProperty;m=f(K,"undefined")||f(K.call,"undefined")?function(a,b){return b in a&&f(a.constructor.prototype[b],"undefined")}:function(a,b){return K.call(a,b)},Function.prototype.bind||(Function.prototype.bind=function(a){var b=this;if("function"!=typeof b)throw new TypeError;var c=G.call(arguments,1),d=function(){if(this instanceof d){var e=function(){};e.prototype=b.prototype;var f=new e,g=b.apply(f,c.concat(G.call(arguments)));return Object(g)===g?g:f}return b.apply(a,c.concat(G.call(arguments)))};return d}),C.flexbox=function(){return j("flexWrap")},C.flexboxlegacy=function(){return j("boxDirection")},C.canvas=function(){var a=b.createElement("canvas");return!(!a.getContext||!a.getContext("2d"))},C.canvastext=function(){return!(!o.canvas||!f(b.createElement("canvas").getContext("2d").fillText,"function"))},C.webgl=function(){return!!a.WebGLRenderingContext},C.touch=function(){var c;return"ontouchstart"in a||a.DocumentTouch&&b instanceof DocumentTouch?c=!0:H(["@media (",x.join("touch-enabled),("),r,")","{#modernizr{top:9px;position:absolute}}"].join(""),function(a){c=9===a.offsetTop}),c},C.geolocation=function(){return"geolocation"in navigator},C.postmessage=function(){return!!a.postMessage},C.websqldatabase=function(){return!!a.openDatabase},C.indexedDB=function(){return!!j("indexedDB",a)},C.hashchange=function(){return J("hashchange",a)&&(b.documentMode===c||b.documentMode>7)},C.history=function(){return!(!a.history||!history.pushState)},C.draganddrop=function(){var a=b.createElement("div");return"draggable"in a||"ondragstart"in a&&"ondrop"in a},C.websockets=function(){return"WebSocket"in a||"MozWebSocket"in a},C.rgba=function(){return d("background-color:rgba(150,255,150,.5)"),g(t.backgroundColor,"rgba")},C.hsla=function(){return d("background-color:hsla(120,40%,100%,.5)"),g(t.backgroundColor,"rgba")||g(t.backgroundColor,"hsla")},C.multiplebgs=function(){return d("background:url(https://),url(https://),red url(https://)"),/(url\s*\(.*?){3}/.test(t.background)},C.backgroundsize=function(){return j("backgroundSize")},C.borderimage=function(){return j("borderImage")},C.borderradius=function(){return j("borderRadius")},C.boxshadow=function(){return j("boxShadow")},C.textshadow=function(){return""===b.createElement("div").style.textShadow},C.opacity=function(){return e("opacity:.55"),/^0.55$/.test(t.opacity)},C.cssanimations=function(){return j("animationName")},C.csscolumns=function(){return j("columnCount")},C.cssgradients=function(){var a="background-image:",b="gradient(linear,left top,right bottom,from(#9f9),to(white));",c="linear-gradient(left top,#9f9, white);";return d((a+"-webkit- ".split(" ").join(b+a)+x.join(c+a)).slice(0,-a.length)),g(t.backgroundImage,"gradient")},C.cssreflections=function(){return j("boxReflect")},C.csstransforms=function(){return!!j("transform")},C.csstransforms3d=function(){var a=!!j("perspective");return a&&"webkitPerspective"in q.style&&H("@media (transform-3d),(-webkit-transform-3d){#modernizr{left:9px;position:absolute;height:3px;}}",function(b){a=9===b.offsetLeft&&3===b.offsetHeight}),a},C.csstransitions=function(){return j("transition")},C.fontface=function(){var a;return H('@font-face {font-family:"font";src:url("https://")}',function(c,d){var e=b.getElementById("smodernizr"),f=e.sheet||e.styleSheet,g=f?f.cssRules&&f.cssRules[0]?f.cssRules[0].cssText:f.cssText||"":"";a=/src/i.test(g)&&0===g.indexOf(d.split(" ")[0])}),a},C.generatedcontent=function(){var a;return H(["#",r,"{font:0/0 a}#",r,':after{content:"',v,'";visibility:hidden;font:3px/1 a}'].join(""),function(b){a=b.offsetHeight>=3}),a},C.video=function(){var a=b.createElement("video"),c=!1;try{(c=!!a.canPlayType)&&(c=new Boolean(c),c.ogg=a.canPlayType('video/ogg; codecs="theora"').replace(/^no$/,""),c.h264=a.canPlayType('video/mp4; codecs="avc1.42E01E"').replace(/^no$/,""),c.webm=a.canPlayType('video/webm; codecs="vp8, vorbis"').replace(/^no$/,""))}catch(d){}return c},C.audio=function(){var a=b.createElement("audio"),c=!1;try{(c=!!a.canPlayType)&&(c=new Boolean(c),c.ogg=a.canPlayType('audio/ogg; codecs="vorbis"').replace(/^no$/,""),c.mp3=a.canPlayType("audio/mpeg;").replace(/^no$/,""),c.wav=a.canPlayType('audio/wav; codecs="1"').replace(/^no$/,""),c.m4a=(a.canPlayType("audio/x-m4a;")||a.canPlayType("audio/aac;")).replace(/^no$/,""))}catch(d){}return c},C.localstorage=function(){try{return localStorage.setItem(r,r),localStorage.removeItem(r),!0}catch(a){return!1}},C.sessionstorage=function(){try{return sessionStorage.setItem(r,r),sessionStorage.removeItem(r),!0}catch(a){return!1}},C.webworkers=function(){return!!a.Worker},C.applicationcache=function(){return!!a.applicationCache},C.svg=function(){return!!b.createElementNS&&!!b.createElementNS(B.svg,"svg").createSVGRect},C.inlinesvg=function(){var a=b.createElement("div");return a.innerHTML="<svg/>",(a.firstChild&&a.firstChild.namespaceURI)==B.svg},C.smil=function(){return!!b.createElementNS&&/SVGAnimate/.test(w.call(b.createElementNS(B.svg,"animate")))},C.svgclippaths=function(){return!!b.createElementNS&&/SVGClipPath/.test(w.call(b.createElementNS(B.svg,"clipPath")))};for(var L in C)m(C,L)&&(l=L.toLowerCase(),o[l]=C[L](),F.push((o[l]?"":"no-")+l));return o.input||k(),o.addTest=function(a,b){if("object"==typeof a)for(var d in a)m(a,d)&&o.addTest(d,a[d]);else{if(a=a.toLowerCase(),o[a]!==c)return o;b="function"==typeof b?b():b,"undefined"!=typeof p&&p&&(q.className+=" "+(b?"":"no-")+a),o[a]=b}return o},d(""),s=u=null,function(a,b){function c(a,b){var c=a.createElement("p"),d=a.getElementsByTagName("head")[0]||a.documentElement;return c.innerHTML="x<style>"+b+"</style>",d.insertBefore(c.lastChild,d.firstChild)}function d(){var a=s.elements;return"string"==typeof a?a.split(" "):a}function e(a){var b=r[a[p]];return b||(b={},q++,a[p]=q,r[q]=b),b}function f(a,c,d){if(c||(c=b),k)return c.createElement(a);d||(d=e(c));var f;return f=d.cache[a]?d.cache[a].cloneNode():o.test(a)?(d.cache[a]=d.createElem(a)).cloneNode():d.createElem(a),!f.canHaveChildren||n.test(a)||f.tagUrn?f:d.frag.appendChild(f)}function g(a,c){if(a||(a=b),k)return a.createDocumentFragment();c=c||e(a);for(var f=c.frag.cloneNode(),g=0,h=d(),i=h.length;i>g;g++)f.createElement(h[g]);return f}function h(a,b){b.cache||(b.cache={},b.createElem=a.createElement,b.createFrag=a.createDocumentFragment,b.frag=b.createFrag()),a.createElement=function(c){return s.shivMethods?f(c,a,b):b.createElem(c)},a.createDocumentFragment=Function("h,f","return function(){var n=f.cloneNode(),c=n.createElement;h.shivMethods&&("+d().join().replace(/[\w\-]+/g,function(a){return b.createElem(a),b.frag.createElement(a),'c("'+a+'")'})+");return n}")(s,b.frag)}function i(a){a||(a=b);var d=e(a);return!s.shivCSS||j||d.hasCSS||(d.hasCSS=!!c(a,"article,aside,dialog,figcaption,figure,footer,header,hgroup,main,nav,section{display:block}mark{background:#FF0;color:#000}template{display:none}")),k||h(a,d),a}var j,k,l="3.7.0",m=a.html5||{},n=/^<|^(?:button|map|select|textarea|object|iframe|option|optgroup)$/i,o=/^(?:a|b|code|div|fieldset|h1|h2|h3|h4|h5|h6|i|label|li|ol|p|q|span|strong|style|table|tbody|td|th|tr|ul)$/i,p="_html5shiv",q=0,r={};!function(){try{var a=b.createElement("a");a.innerHTML="<xyz></xyz>",j="hidden"in a,k=1==a.childNodes.length||function(){b.createElement("a");var a=b.createDocumentFragment();return"undefined"==typeof a.cloneNode||"undefined"==typeof a.createDocumentFragment||"undefined"==typeof a.createElement}()}catch(c){j=!0,k=!0}}();var s={elements:m.elements||"abbr article aside audio bdi canvas data datalist details dialog figcaption figure footer header hgroup main mark meter nav output progress section summary template time video",version:l,shivCSS:m.shivCSS!==!1,supportsUnknownElements:k,shivMethods:m.shivMethods!==!1,type:"default",shivDocument:i,createElement:f,createDocumentFragment:g};a.html5=s,i(b)}(this,b),o._version=n,o._prefixes=x,o._domPrefixes=A,o._cssomPrefixes=z,o.mq=I,o.hasEvent=J,o.testProp=function(a){return h([a])},o.testAllProps=j,o.testStyles=H,o.prefixed=function(a,b,c){return b?j(a,b,c):j(a,"pfx")},q.className=q.className.replace(/(^|\s)no-js(\s|$)/,"$1$2")+(p?" js "+F.join(" "):""),o}(this,this.document);
View
8 ajax/libs/pizza/0.2.0/js/vendor/modernizr.min.js
@@ -0,0 +1,8 @@
+/*!
+ * Modernizr v2.7.1
+ * www.modernizr.com
+ *
+ * Copyright (c) Faruk Ates, Paul Irish, Alex Sexton
+ * Available under the BSD and MIT licenses: www.modernizr.com/license/
+ */
+window.Modernizr=function(ay,ax,aw){function av(b){ae.cssText=b}function au(d,c){return av(aa.join(d+";")+(c||""))}function at(d,c){return typeof d===c}function ar(d,c){return !!~(""+d).indexOf(c)}function aq(f,c){for(var h in f){var g=f[h];if(!ar(g,"-")&&ae[g]!==aw){return"pfx"==c?g:!0}}return !1}function ap(f,c,j){for(var i in f){var h=c[f[i]];if(h!==aw){return j===!1?f[i]:at(h,"function")?h.bind(j||c):h}}return !1}function ao(g,f,j){var i=g.charAt(0).toUpperCase()+g.slice(1),h=(g+" "+Y.join(i+" ")+i).split(" ");return at(f,"string")||at(f,"undefined")?aq(h,f):(h=(g+" "+X.join(i+" ")+i).split(" "),ap(h,f,j))}function an(){aj.input=function(f){for(var b=0,a=f.length;a>b;b++){T[f[b]]=!!(f[b] in ad)}return T.list&&(T.list=!(!ax.createElement("datalist")||!ay.HTMLDataListElement)),T}("autocomplete autofocus list placeholder max min multiple pattern required step".split(" ")),aj.inputtypes=function(b){for(var l,k,j,i=0,c=b.length;c>i;i++){ad.setAttribute("type",k=b[i]),l="text"!==ad.type,l&&(ad.value=ac,ad.style.cssText="position:absolute;visibility:hidden;",/^range$/.test(k)&&ad.style.WebkitAppearance!==aw?(ah.appendChild(ad),j=ax.defaultView,l=j.getComputedStyle&&"textfield"!==j.getComputedStyle(ad,null).WebkitAppearance&&0!==ad.offsetHeight,ah.removeChild(ad)):/^(search|tel)$/.test(k)||(l=/^(url|email)$/.test(k)?ad.checkValidity&&ad.checkValidity()===!1:ad.value!=ac)),U[b[i]]=!!l}return U}("search tel url email datetime date month week time datetime-local number range color".split(" "))}var am,al,ak="2.7.1",aj={},ai=!0,ah=ax.documentElement,ag="modernizr",af=ax.createElement(ag),ae=af.style,ad=ax.createElement("input"),ac=":)",ab={}.toString,aa=" -webkit- -moz- -o- -ms- ".split(" "),Z="Webkit Moz O ms",Y=Z.split(" "),X=Z.toLowerCase().split(" "),W={svg:"http://www.w3.org/2000/svg"},V={},U={},T={},S=[],R=S.slice,Q=function(v,u,t,s){var r,q,p,o,n=ax.createElement("div"),m=ax.body,b=m||ax.createElement("body");if(parseInt(t,10)){for(;t--;){p=ax.createElement("div"),p.id=s?s[t]:ag+(t+1),n.appendChild(p)}}return r=["&#173;",'<style id="s',ag,'">',v,"</style>"].join(""),n.id=ag,(m?n:b).innerHTML+=r,b.appendChild(n),m||(b.style.background="",b.style.overflow="hidden",o=ah.style.overflow,ah.style.overflow="hidden",ah.appendChild(b)),q=u(n,v),m?n.parentNode.removeChild(n):(b.parentNode.removeChild(b),ah.style.overflow=o),!!q},P=function(a){var f=ay.matchMedia||ay.msMatchMedia;if(f){return f(a).matches}var e;return Q("@media "+a+" { #"+ag+" { position: absolute; } }",function(c){e="absolute"==(ay.getComputedStyle?getComputedStyle(c,null):c.currentStyle).position}),e},O=function(){function b(d,h){h=h||ax.createElement(c[d]||"div"),d="on"+d;var f=d in h;return f||(h.setAttribute||(h=ax.createElement("div")),h.setAttribute&&h.removeAttribute&&(h.setAttribute(d,""),f=at(h[d],"function"),at(h[d],"undefined")||(h[d]=aw),h.removeAttribute(d))),h=null,f}var c={select:"input",change:"input",submit:"form",reset:"form",error:"img",load:"img",abort:"img"};return b}(),N={}.hasOwnProperty;al=at(N,"undefined")||at(N.call,"undefined")?function(d,c){return c in d&&at(d.constructor.prototype[c],"undefined")}:function(d,c){return N.call(d,c)},Function.prototype.bind||(Function.prototype.bind=function(f){var e=this;if("function"!=typeof e){throw new TypeError}var h=R.call(arguments,1),g=function(){if(this instanceof g){var c=function(){};c.prototype=e.prototype;var b=new c,a=e.apply(b,h.concat(R.call(arguments)));return Object(a)===a?a:b}return e.apply(f,h.concat(R.call(arguments)))};return g}),V.flexbox=function(){return ao("flexWrap")},V.flexboxlegacy=function(){return ao("boxDirection")},V.canvas=function(){var b=ax.createElement("canvas");return !(!b.getContext||!b.getContext("2d"))},V.canvastext=function(){return !(!aj.canvas||!at(ax.createElement("canvas").getContext("2d").fillText,"function"))},V.webgl=function(){return !!ay.WebGLRenderingContext},V.touch=function(){var a;return"ontouchstart" in ay||ay.DocumentTouch&&ax instanceof DocumentTouch?a=!0:Q(["@media (",aa.join("touch-enabled),("),ag,")","{#modernizr{top:9px;position:absolute}}"].join(""),function(b){a=9===b.offsetTop}),a},V.geolocation=function(){return"geolocation" in navigator},V.postmessage=function(){return !!ay.postMessage},V.websqldatabase=function(){return !!ay.openDatabase},V.indexedDB=function(){return !!ao("indexedDB",ay)},V.hashchange=function(){return O("hashchange",ay)&&(ax.documentMode===aw||ax.documentMode>7)},V.history=function(){return !(!ay.history||!history.pushState)},V.draganddrop=function(){var b=ax.createElement("div");return"draggable" in b||"ondragstart" in b&&"ondrop" in b},V.websockets=function(){return"WebSocket" in ay||"MozWebSocket" in ay},V.rgba=function(){return av("background-color:rgba(150,255,150,.5)"),ar(ae.backgroundColor,"rgba")},V.hsla=function(){return av("background-color:hsla(120,40%,100%,.5)"),ar(ae.backgroundColor,"rgba")||ar(ae.backgroundColor,"hsla")},V.multiplebgs=function(){return av("background:url(https://),url(https://),red url(https://)"),/(url\s*\(.*?){3}/.test(ae.background)},V.backgroundsize=function(){return ao("backgroundSize")},V.borderimage=function(){return ao("borderImage")},V.borderradius=function(){return ao("borderRadius")},V.boxshadow=function(){return ao("boxShadow")},V.textshadow=function(){return""===ax.createElement("div").style.textShadow},V.opacity=function(){return au("opacity:.55"),/^0.55$/.test(ae.opacity)},V.cssanimations=function(){return ao("animationName")},V.csscolumns=function(){return ao("columnCount")},V.cssgradients=function(){var e="background-image:",d="gradient(linear,left top,right bottom,from(#9f9),to(white));",f="linear-gradient(left top,#9f9, white);";return av((e+"-webkit- ".split(" ").join(d+e)+aa.join(f+e)).slice(0,-e.length)),ar(ae.backgroundImage,"gradient")},V.cssreflections=function(){return ao("boxReflect")},V.csstransforms=function(){return !!ao("transform")},V.csstransforms3d=function(){var b=!!ao("perspective");return b&&"webkitPerspective" in ah.style&&Q("@media (transform-3d),(-webkit-transform-3d){#modernizr{left:9px;position:absolute;height:3px;}}",function(a){b=9===a.offsetLeft&&3===a.offsetHeight}),b},V.csstransitions=function(){return ao("transition")},V.fontface=function(){var b;return Q('@font-face {font-family:"font";src:url("https://")}',function(k,j){var i=ax.getElementById("smodernizr"),h=i.sheet||i.styleSheet,a=h?h.cssRules&&h.cssRules[0]?h.cssRules[0].cssText:h.cssText||"":"";b=/src/i.test(a)&&0===a.indexOf(j.split(" ")[0])}),b},V.generatedcontent=function(){var b;return Q(["#",ag,"{font:0/0 a}#",ag,':after{content:"',ac,'";visibility:hidden;font:3px/1 a}'].join(""),function(a){b=a.offsetHeight>=3}),b},V.video=function(){var b=ax.createElement("video"),f=!1;try{(f=!!b.canPlayType)&&(f=new Boolean(f),f.ogg=b.canPlayType('video/ogg; codecs="theora"').replace(/^no$/,""),f.h264=b.canPlayType('video/mp4; codecs="avc1.42E01E"').replace(/^no$/,""),f.webm=b.canPlayType('video/webm; codecs="vp8, vorbis"').replace(/^no$/,""))}catch(e){}return f},V.audio=function(){var b=ax.createElement("audio"),f=!1;try{(f=!!b.canPlayType)&&(f=new Boolean(f),f.ogg=b.canPlayType('audio/ogg; codecs="vorbis"').replace(/^no$/,""),f.mp3=b.canPlayType("audio/mpeg;").replace(/^no$/,""),f.wav=b.canPlayType('audio/wav; codecs="1"').replace(/^no$/,""),f.m4a=(b.canPlayType("audio/x-m4a;")||b.canPlayType("audio/aac;")).replace(/^no$/,""))}catch(e){}return f},V.localstorage=function(){try{return localStorage.setItem(ag,ag),localStorage.removeItem(ag),!0}catch(b){return !1}},V.sessionstorage=function(){try{return sessionStorage.setItem(ag,ag),sessionStorage.removeItem(ag),!0}catch(b){return !1}},V.webworkers=function(){return !!ay.Worker},V.applicationcache=function(){return !!ay.applicationCache},V.svg=function(){return !!ax.createElementNS&&!!ax.createElementNS(W.svg,"svg").createSVGRect},V.inlinesvg=function(){var b=ax.createElement("div");return b.innerHTML="<svg/>",(b.firstChild&&b.firstChild.namespaceURI)==W.svg},V.smil=function(){return !!ax.createElementNS&&/SVGAnimate/.test(ab.call(ax.createElementNS(W.svg,"animate")))},V.svgclippaths=function(){return !!ax.createElementNS&&/SVGClipPath/.test(ab.call(ax.createElementNS(W.svg,"clipPath")))};for(var M in V){al(V,M)&&(am=M.toLowerCase(),aj[am]=V[M](),S.push((aj[am]?"":"no-")+am))}return aj.input||an(),aj.addTest=function(e,c){if("object"==typeof e){for(var f in e){al(e,f)&&aj.addTest(f,e[f])}}else{if(e=e.toLowerCase(),aj[e]!==aw){return aj}c="function"==typeof c?c():c,"undefined"!=typeof ai&&ai&&(ah.className+=" "+(c?"":"no-")+e),aj[e]=c}return aj},av(""),af=ad=null,function(L,K){function J(f,e){var h=f.createElement("p"),g=f.getElementsByTagName("head")[0]||f.documentElement;return h.innerHTML="x<style>"+e+"</style>",g.insertBefore(h.lastChild,g.firstChild)}function I(){var b=t.elements;return"string"==typeof b?b.split(" "):b}function H(d){var c=u[d[w]];return c||(c={},v++,d[w]=v,u[v]=c),c}function G(b,h,g){if(h||(h=K),B){return h.createElement(b)}g||(g=H(h));var e;return e=g.cache[b]?g.cache[b].cloneNode():x.test(b)?(g.cache[b]=g.createElem(b)).cloneNode():g.createElem(b),!e.canHaveChildren||y.test(b)||e.tagUrn?e:g.frag.appendChild(e)}function F(b,l){if(b||(b=K),B){return b.createDocumentFragment()}l=l||H(b);for(var k=l.frag.cloneNode(),j=0,e=I(),d=e.length;d>j;j++){k.createElement(e[j])}return k}function E(d,c){c.cache||(c.cache={},c.createElem=d.createElement,c.createFrag=d.createDocumentFragment,c.frag=c.createFrag()),d.createElement=function(a){return t.shivMethods?G(a,d,c):c.createElem(a)},d.createDocumentFragment=Function("h,f","return function(){var n=f.cloneNode(),c=n.createElement;h.shivMethods&&("+I().join().replace(/[\w\-]+/g,function(b){return c.createElem(b),c.frag.createElement(b),'c("'+b+'")'})+");return n}")(t,c.frag)}function D(b){b||(b=K);var c=H(b);return !t.shivCSS||C||c.hasCSS||(c.hasCSS=!!J(b,"article,aside,dialog,figcaption,figure,footer,header,hgroup,main,nav,section{display:block}mark{background:#FF0;color:#000}template{display:none}")),B||E(b,c),b}var C,B,A="3.7.0",z=L.html5||{},y=/^<|^(?:button|map|select|textarea|object|iframe|option|optgroup)$/i,x=/^(?:a|b|code|div|fieldset|h1|h2|h3|h4|h5|h6|i|label|li|ol|p|q|span|strong|style|table|tbody|td|th|tr|ul)$/i,w="_html5shiv",v=0,u={};!function(){try{var b=K.createElement("a");b.innerHTML="<xyz></xyz>",C="hidden" in b,B=1==b.childNodes.length||function(){K.createElement("a");var c=K.createDocumentFragment();return"undefined"==typeof c.cloneNode||"undefined"==typeof c.createDocumentFragment||"undefined"==typeof c.createElement}()}catch(d){C=!0,B=!0}}();var t={elements:z.elements||"abbr article aside audio bdi canvas data datalist details dialog figcaption figure footer header hgroup main mark meter nav output progress section summary template time video",version:A,shivCSS:z.shivCSS!==!1,supportsUnknownElements:B,shivMethods:z.shivMethods!==!1,type:"default",shivDocument:D,createElement:G,createDocumentFragment:F};L.html5=t,D(K)}(this,ax),aj._version=ak,aj._prefixes=aa,aj._domPrefixes=X,aj._cssomPrefixes=Y,aj.mq=P,aj.hasEvent=O,aj.testProp=function(b){return aq([b])},aj.testAllProps=ao,aj.testStyles=Q,aj.prefixed=function(e,d,f){return d?ao(e,d,f):ao(e,"pfx")},ah.className=ah.className.replace(/(^|\s)no-js(\s|$)/,"$1$2")+(ai?" js "+S.join(" "):""),aj}(this,this.document);
View
5 ajax/libs/pizza/0.2.1/.gitignore
@@ -0,0 +1,5 @@
+.DS_Store
+.sass-cache/
+/bower_components/*
+node_modules
+stylesheets
View
31 ajax/libs/pizza/0.2.1/css/pizza.css
@@ -0,0 +1,31 @@
+[data-pie-id] > *:nth-child(7n+1), [data-bar-id] > *:nth-child(7n+1), [data-line-id] > *:nth-child(7n+1) {
+ color: #f23d3d; }
+[data-pie-id] > *:nth-child(7n+2), [data-bar-id] > *:nth-child(7n+2), [data-line-id] > *:nth-child(7n+2) {
+ color: #f02121; }
+[data-pie-id] > *:nth-child(7n+3), [data-bar-id] > *:nth-child(7n+3), [data-line-id] > *:nth-child(7n+3) {
+ color: #e61010; }
+[data-pie-id] > *:nth-child(7n+4), [data-bar-id] > *:nth-child(7n+4), [data-line-id] > *:nth-child(7n+4) {
+ color: #cf0e0e; }
+[data-pie-id] > *:nth-child(7n+5), [data-bar-id] > *:nth-child(7n+5), [data-line-id] > *:nth-child(7n+5) {
+ color: #ba0d0d; }
+[data-pie-id] > *:nth-child(7n+6), [data-bar-id] > *:nth-child(7n+6), [data-line-id] > *:nth-child(7n+6) {
+ color: #a70c0c; }
+[data-pie-id] > *:nth-child(7n+7), [data-bar-id] > *:nth-child(7n+7), [data-line-id] > *:nth-child(7n+7) {
+ color: #960b0b; }
+
+#pie, #donut, #bar {
+ max-height: 450px; }
+
+
+svg {
+ width: 100%;
+ height: auto; }
+
+.tooltip {
+ margin-left: -5px;
+ border-radius: 3px;
+ padding: 5px; }
+
+ul[data-pie-id] {
+ list-style: none;
+ padding: 10px; }
View
1 ajax/libs/pizza/0.2.1/css/pizza.min.css
@@ -0,0 +1 @@
+[data-pie-id]>*:nth-child(7n+1),[data-bar-id]>*:nth-child(7n+1),[data-line-id]>*:nth-child(7n+1){color:#f23d3d}[data-pie-id]>*:nth-child(7n+2),[data-bar-id]>*:nth-child(7n+2),[data-line-id]>*:nth-child(7n+2){color:#f02121}[data-pie-id]>*:nth-child(7n+3),[data-bar-id]>*:nth-child(7n+3),[data-line-id]>*:nth-child(7n+3){color:#e61010}[data-pie-id]>*:nth-child(7n+4),[data-bar-id]>*:nth-child(7n+4),[data-line-id]>*:nth-child(7n+4){color:#cf0e0e}[data-pie-id]>*:nth-child(7n+5),[data-bar-id]>*:nth-child(7n+5),[data-line-id]>*:nth-child(7n+5){color:#ba0d0d}[data-pie-id]>*:nth-child(7n+6),[data-bar-id]>*:nth-child(7n+6),[data-line-id]>*:nth-child(7n+6){color:#a70c0c}[data-pie-id]>*:nth-child(7n+7),[data-bar-id]>*:nth-child(7n+7),[data-line-id]>*:nth-child(7n+7){color:#960b0b}#pie,#donut,#bar{max-height:450px}svg{width:100%;height:auto}.tooltip{margin-left:-5px;border-radius:3px;padding:5px}ul[data-pie-id]{list-style:none;padding:10px}
View
4,982 ajax/libs/pizza/0.2.1/css/vendor/foundation.css
4,982 additions, 0 deletions not shown because the diff is too large. Please use a local Git client to view these changes.
View
1 ajax/libs/pizza/0.2.1/css/vendor/foundation.min.css
1 addition, 0 deletions not shown because the diff is too large. Please use a local Git client to view these changes.
View
310 ajax/libs/pizza/0.2.1/css/vendor/normalize.css
@@ -0,0 +1,310 @@
+/*! normalize.css v2.1.2 | MIT License | git.io/normalize */
+/* ==========================================================================
+ HTML5 display definitions
+ ========================================================================== */
+/**
+ * Correct `block` display not defined in IE 8/9.
+ */
+article, aside, details, figcaption, figure, footer, header, hgroup, main, nav, section, summary {
+ display: block; }
+
+/**
+ * Correct `inline-block` display not defined in IE 8/9.
+ */
+audio, canvas, video {
+ display: inline-block; }
+
+/**
+ * Prevent modern browsers from displaying `audio` without controls.
+ * Remove excess height in iOS 5 devices.
+ */
+audio:not([controls]) {
+ display: none;
+ height: 0; }
+
+/**
+ * Address `[hidden]` styling not present in IE 8/9.
+ * Hide the `template` element in IE, Safari, and Firefox < 22.
+ */
+[hidden], template {
+ display: none; }
+
+script {
+ display: none !important; }
+
+/* ==========================================================================
+ Base
+ ========================================================================== */
+/**
+ * 1. Set default font family to sans-serif.
+ * 2. Prevent iOS text size adjust after orientation change, without disabling
+ * user zoom.
+ */
+html {
+ font-family: sans-serif;
+ /* 1 */
+ -ms-text-size-adjust: 100%;
+ /* 2 */
+ -webkit-text-size-adjust: 100%;
+ /* 2 */ }
+
+/**
+ * Remove default margin.
+ */
+body {
+ margin: 0; }
+
+/* ==========================================================================
+ Links
+ ========================================================================== */
+/**
+ * Remove the gray background color from active links in IE 10.
+ */
+a {
+ background: transparent; }
+
+/**
+ * Address `outline` inconsistency between Chrome and other browsers.
+ */
+a:focus {
+ outline: thin dotted; }
+
+/**
+ * Improve readability when focused and also mouse hovered in all browsers.
+ */
+a:active, a:hover {
+ outline: 0; }
+
+/* ==========================================================================
+ Typography
+ ========================================================================== */
+/**
+ * Address variable `h1` font-size and margin within `section` and `article`
+ * contexts in Firefox 4+, Safari 5, and Chrome.
+ */
+h1 {
+ font-size: 2em;
+ margin: 0.67em 0; }
+
+/**
+ * Address styling not present in IE 8/9, Safari 5, and Chrome.
+ */
+abbr[title] {
+ border-bottom: 1px dotted; }
+
+/**
+ * Address style set to `bolder` in Firefox 4+, Safari 5, and Chrome.
+ */
+b, strong {
+ font-weight: bold; }
+
+/**
+ * Address styling not present in Safari 5 and Chrome.
+ */
+dfn {
+ font-style: italic; }
+
+/**
+ * Address differences between Firefox and other browsers.
+ */
+hr {
+ -moz-box-sizing: content-box;
+ box-sizing: content-box;
+ height: 0; }
+
+/**
+ * Address styling not present in IE 8/9.
+ */
+mark {
+ background: yellow;
+ color: black; }
+
+/**
+ * Correct font family set oddly in Safari 5 and Chrome.
+ */
+code, kbd, pre, samp {
+ font-family: monospace, serif;
+ font-size: 1em; }
+
+/**
+ * Improve readability of pre-formatted text in all browsers.
+ */
+pre {
+ white-space: pre-wrap; }
+
+/**
+ * Set consistent quote types.
+ */
+q {
+ quotes: "\201C" "\201D" "\2018" "\2019"; }
+
+/**
+ * Address inconsistent and variable font size in all browsers.
+ */
+small {
+ font-size: 80%; }
+
+/**
+ * Prevent `sub` and `sup` affecting `line-height` in all browsers.
+ */
+sub, sup {
+ font-size: 75%;
+ line-height: 0;
+ position: relative;
+ vertical-align: baseline; }
+
+sup {
+ top: -0.5em; }
+
+sub {
+ bottom: -0.25em; }
+
+/* ==========================================================================
+ Embedded content
+ ========================================================================== */
+/**
+ * Remove border when inside `a` element in IE 8/9.
+ */
+img {
+ border: 0; }
+
+/**
+ * Correct overflow displayed oddly in IE 9.
+ */
+svg:not(:root) {
+ overflow: hidden; }
+
+/* ==========================================================================
+ Figures
+ ========================================================================== */
+/**
+ * Address margin not present in IE 8/9 and Safari 5.
+ */
+figure {
+ margin: 0; }
+
+/* ==========================================================================
+ Forms
+ ========================================================================== */
+/**
+ * Define consistent border, margin, and padding.
+ */
+fieldset {
+ border: 1px solid silver;
+ margin: 0 2px;
+ padding: 0.35em 0.625em 0.75em; }
+
+/**
+ * 1. Correct `color` not being inherited in IE 8/9.
+ * 2. Remove padding so people aren't caught out if they zero out fieldsets.
+ */
+legend {
+ border: 0;
+ /* 1 */
+ padding: 0;
+ /* 2 */ }
+
+/**
+ * 1. Correct font family not being inherited in all browsers.
+ * 2. Correct font size not being inherited in all browsers.
+ * 3. Address margins set differently in Firefox 4+, Safari 5, and Chrome.
+ */
+button, input, select, textarea {
+ font-family: inherit;
+ /* 1 */
+ font-size: 100%;
+ /* 2 */
+ margin: 0;
+ /* 3 */ }
+
+/**
+ * Address Firefox 4+ setting `line-height` on `input` using `!important` in
+ * the UA stylesheet.
+ */
+button, input {
+ line-height: normal; }
+
+/**
+ * Address inconsistent `text-transform` inheritance for `button` and `select`.
+ * All other form control elements do not inherit `text-transform` values.
+ * Correct `button` style inheritance in Chrome, Safari 5+, and IE 8+.
+ * Correct `select` style inheritance in Firefox 4+ and Opera.
+ */
+button, select {
+ text-transform: none; }
+
+/**
+ * 1. Avoid the WebKit bug in Android 4.0.* where (2) destroys native `audio`
+ * and `video` controls.
+ * 2. Correct inability to style clickable `input` types in iOS.
+ * 3. Improve usability and consistency of cursor style between image-type
+ * `input` and others.
+ */
+button, html input[type="button"], input[type="reset"], input[type="submit"] {
+ -webkit-appearance: button;
+ /* 2 */
+ cursor: pointer;
+ /* 3 */ }
+
+/**
+ * Re-set default cursor for disabled elements.
+ */
+button[disabled], html input[disabled] {
+ cursor: default; }
+
+/**
+ * 1. Address box sizing set to `content-box` in IE 8/9.
+ * 2. Remove excess padding in IE 8/9.
+ */
+input[type="checkbox"], input[type="radio"] {
+ box-sizing: border-box;
+ /* 1 */
+ padding: 0;
+ /* 2 */ }
+
+/**
+ * 1. Address `appearance` set to `searchfield` in Safari 5 and Chrome.
+ * 2. Address `box-sizing` set to `border-box` in Safari 5 and Chrome
+ * (include `-moz` to future-proof).
+ */
+input[type="search"] {
+ -webkit-appearance: textfield;
+ /* 1 */
+ -moz-box-sizing: content-box;
+ -webkit-box-sizing: content-box;
+ /* 2 */
+ box-sizing: content-box; }
+
+/**
+ * Remove inner padding and search cancel button in Safari 5 and Chrome
+ * on OS X.
+ */
+input[type="search"]::-webkit-search-cancel-button, input[type="search"]::-webkit-search-decoration {
+ -webkit-appearance: none; }
+
+/**
+ * Remove inner padding and border in Firefox 4+.
+ */
+button::-moz-focus-inner, input::-moz-focus-inner {
+ border: 0;
+ padding: 0; }
+
+/**
+ * 1. Remove default vertical scrollbar in IE 8/9.
+ * 2. Improve readability and alignment in all browsers.
+ */
+textarea {
+ overflow: auto;
+ /* 1 */
+ vertical-align: top;
+ /* 2 */ }
+
+/* ==========================================================================
+ Tables
+ ========================================================================== */
+/**
+ * Remove most spacing between table cells.
+ */
+table {
+ border-collapse: collapse;
+ border-spacing: 0; }
View
1 ajax/libs/pizza/0.2.1/css/vendor/normalize.min.css
@@ -0,0 +1 @@
+/*! normalize.css v2.1.2 | MIT License | git.io/normalize */article,aside,details,figcaption,figure,footer,header,hgroup,main,nav,section,summary{display:block}audio,canvas,video{display:inline-block}audio:not([controls]){display:none;height:0}[hidden],template{display:none}script{display:none!important}html{font-family:sans-serif;-ms-text-size-adjust:100%;-webkit-text-size-adjust:100%}body{margin:0}a{background:transparent}a:focus{outline:thin dotted}a:active,a:hover{outline:0}h1{font-size:2em;margin:.67em 0}abbr[title]{border-bottom:1px dotted}b,strong{font-weight:bold}dfn{font-style:italic}hr{-moz-box-sizing:content-box;box-sizing:content-box;height:0}mark{background:yellow;color:black}code,kbd,pre,samp{font-family:monospace,serif;font-size:1em}pre{white-space:pre-wrap}q{quotes:"\201C" "\201D" "\2018" "\2019"}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sup{top:-0.5em}sub{bottom:-0.25em}img{border:0}svg:not(:root){overflow:hidden}figure{margin:0}fieldset{border:1px solid silver;margin:0 2px;padding:.35em .625em .75em}legend{border:0;padding:0}button,input,select,textarea{font-family:inherit;font-size:100%;margin:0}button,input{line-height:normal}button,select{text-transform:none}button,html input[type="button"],input[type="reset"],input[type="submit"]{-webkit-appearance:button;cursor:pointer}button[disabled],html input[disabled]{cursor:default}input[type="checkbox"],input[type="radio"]{box-sizing:border-box;padding:0}input[type="search"]{-webkit-appearance:textfield;-moz-box-sizing:content-box;-webkit-box-sizing:content-box;box-sizing:content-box}input[type="search"]::-webkit-search-cancel-button,input[type="search"]::-webkit-search-decoration{-webkit-appearance:none}button::-moz-focus-inner,input::-moz-focus-inner{border:0;padding:0}textarea{overflow:auto;vertical-align:top}table{border-collapse:collapse;border-spacing:0}
View
948 ajax/libs/pizza/0.2.1/js/pizza.js
@@ -0,0 +1,948 @@
+var Pizza = {
+ version : '0.2.1',
+
+ settings : {
+ donut: false,
+ donut_inner_ratio: 0.4, // between 0 and 1
+ percent_offset: 35, // relative to radius
+ show_text: true, // show or hide the percentage on the chart.
+ animation_speed: 500,
+ always_show_text: false,
+ show_grid: true,
+ bar_spacer: 100,
+ bar_intervals: 6,
+ animation_type: 'elastic' // options: backin, backout, bounce, easein,
+ // easeinout, easeout, linear
+ },
+
+ NS : 'http://www.w3.org/2000/svg',
+
+ init : function (scope, options) {
+ var self = this;
+ this.scope = scope || document.body;
+
+ var charts = $('[data-pie-id], [data-line-id], [data-bar-id]', this.scope);
+
+ $.extend(true, this.settings, options);
+
+ if (charts.length > 0) {
+ charts.each(function () {
+ return self.build($(this), options);
+ });
+ } else if ($(this.scope).is('[data-pie-id]')
+ || $(this.scope).is('[data-line-id]')
+ || $(this.scope).is('[data-bar-id]')) {
+ this.build($(this.scope), options);
+ }
+
+ this.events();
+ },
+
+ events : function () {
+ var self = this;
+
+ $(window).off('.pizza').on('resize.pizza', self.throttle(function () {
+ self.init();
+ }, 500));
+
+ $(this.scope).off('.pizza');
+
+ this.pie_events();
+ this.line_events();
+ this.bar_events();
+ },
+
+ build : function(legend, options) {
+ legend.data('settings', $.extend({}, this.settings, options, legend.data('options')));
+
+ this.data(legend, options || {});
+
+ if (legend.data('pie-id')) {
+ this.update_DOM(this.pie(legend));
+ } else if (legend.data('line-id')) {
+ this.update_DOM(this.line(legend));
+ } else if (legend.data('bar-id')) {
+ this.update_DOM(this.bar(legend));
+ }
+ },
+
+ data : function (legend, options) {
+ var data = [],
+ count = 0;
+
+ $('li', legend).each(function () {
+ var segment = $(this);
+
+ if (options.data) {
+ data.push({
+ value: options.data[segment.index()],
+ text: segment.data('text'),
+ color: segment.css('color'),
+ segment: segment
+ });
+ } else {
+ data.push({
+ x : segment.data('x'),
+ y : segment.data('y'),
+ value: segment.data('value'),
+ text: segment.data('text'),
+ color: segment.css('color'),
+ segment: segment
+ });
+ }
+ });
+
+ return legend.data('graph-data', data);
+ },
+
+ update_DOM : function (parts) {
+ var legend = parts[0],
+ graph = parts[1];
+
+ return $(this.identifier(legend)).html(graph);
+ },
+
+ animate : function (el, cx, cy, settings, scale) {
+ var self = this,
+ scale = scale || 1.05;
+
+ el.hover(function (e) {
+ var path = Snap(e.target),
+ text = Snap(path.node.nextSibling);
+
+ path.animate({
+ transform: 's' + scale + ' ' + scale + ' ' + cx + ' ' + cy
+ }, settings.animation_speed, mina[settings.animation_type]);
+
+ if (!/text/.test(text.node.nodeName)) return;
+
+ text.touchend(function () {
+ Snap(path).animate({
+ transform: 's' + scale + ' ' + scale + ' ' + cx + ' ' + cy
+ }, settings.animation_speed, mina[settings.animation_type]);
+ });
+
+ if (settings.show_text) {
+ text.animate({
+ opacity: 1
+ }, settings.animation_speed);
+ text.touchend(function () {
+ text.animate({
+ opacity: 1
+ }, settings.animation_speed);
+ });
+ }
+
+ }, function (e) {
+ var path = Snap(e.target),
+ text = Snap(path.node.nextSibling);
+
+ path.animate({
+ transform: 's1 1 ' + cx + ' ' + cy
+ }, settings.animation_speed, mina[settings.animation_type]);
+
+ if (!/text/.test(text.node.nodeName)) return;
+
+ text.animate({
+ opacity: 0
+ }, settings.animation_speed);
+ });
+
+ },
+
+ parse_options : function (string, percent, value) {
+ var matches = string.match(/{{(percent|value)}}/g),
+ output = '';
+
+ for (var i = 0; i < matches.length; i++) {
+
+ if (/percent/i.test(matches[i])) {
+ output = string.replace(matches[i], [Math.ceil(percent), '%'].join(''));
+ }
+
+ if (/value/i.test(matches[i])) {
+ output = output.replace(matches[i], value);
+ }
+ }
+
+ return output;
+ },
+
+ svg : function (legend, settings) {
+ var container = $(this.identifier(legend)),
+ svg = $('svg', container),
+ width = container.width(),
+ pie = legend.attr('data-pie-id'),
+ height = container.height();
+
+ if (svg.length > 0) {
+ svg = svg[0];
+ } else {
+ var svg = this.svg_obj('svg');
+ svg.width = width;
+ svg.height = height;
+ }
+
+ if (pie) {
+ var view_box = '-' + settings.percent_offset + ' -' + settings.percent_offset + ' ' +
+ (width + (settings.percent_offset * 1.5)) + ' ' +
+ (width + (settings.percent_offset * 1.5));
+ } else {
+ var view_box = '-' + settings.percent_offset + ' -' + settings.percent_offset + ' ' +
+ (width + (settings.percent_offset * 1.6)) + ' ' +
+ (height + (settings.percent_offset * 1.6));
+ }
+
+ this.set_attr(svg, {width: '100%', height: '100%', viewBox: view_box});
+
+ return svg;
+ },
+
+ identifier : function (legend) {
+ id = legend.data('pie-id') || legend.data('bar-id') || legend.data('line-id');
+ return '#' + id;
+ },
+
+ throttle : function(fun, delay) {
+ var timer = null;
+ return function () {
+ var context = this, args = arguments;
+ clearTimeout(timer);
+ timer = setTimeout(function () {
+ fun.apply(context, args);
+ }, delay);
+ };
+ },
+
+ svg_obj : function (type) {
+ return document.createElementNS(this.NS, type);
+ },
+
+ ticks: function (min, max, count) {
+ var span = max - min,
+ step = Math.pow(10, Math.floor(Math.log(span / count) / Math.LN10)),
+ err = count / span * step;
+
+ // Filter ticks to get closer to the desired count.
+ if (err <= .15) step *= 10;
+ else if (err <= .35) step *= 5;
+ else if (err <= .75) step *= 2;
+
+ // Round start and stop values to step interval.
+ var tstart = Math.ceil(min / step) * step,
+ tstop = Math.floor(max / step) * step + step * .5,
+ ticks = [],
+ x;
+
+ // now generate ticks
+ for (i=tstart; i < tstop; i += step) {
+ ticks.push(i);
+ }
+ return ticks;
+ },
+
+ set_attr : function (node, attrs) {
+
+ for (attr in attrs) {
+ node.setAttribute(attr, attrs[attr]);
+ }
+
+ return this;
+ },
+
+ flip : function (node, h) {
+ node.setAttribute('transform', 'translate(0, ' + h +') scale(1, -1)');
+ }
+};
+$.extend(Pizza, {
+ bar: function (legend) {
+ var settings = legend.data('settings'),
+ svg = this.svg(legend, settings),
+ data = legend.data('graph-data'),
+ current_offset = 0,
+ container = $(this.identifier(legend)),
+ base_width = container.outerWidth(),
+ base_height = container.outerHeight(),
+ max = min = 0,
+ total = 0,
+ spacer = settings.bar_spacer * (settings.bar_spacer/ base_width),
+ interval = (base_width - (data.length * spacer)) / data.length;
+
+ if (interval < 10) {
+ spacer = 1;
+ interval = (base_width - (data.length * spacer)) / data.length;
+ }
+
+ for (var i = 0; i < data.length; i++) {
+ if (max < data[i].value) max = data[i].value;
+ if (min > data[i].value) min = data[i].value;
+ total += data[i].value;
+ }
+
+ var existing_group = $('g[data-id=bars]', svg);
+
+ if (existing_group.length > 0) {
+ var g = existing_group[0];
+ } else {
+ var g = this.svg_obj('g');
+ g.setAttribute('data-id', 'bars');
+ }
+
+ if (settings.show_grid) {
+ this.assemble_grid(svg, min, max, base_width, base_height, settings);
+ }
+
+ g.setAttribute('transform', 'translate(0, ' + (base_height) +') scale(1, -1)');
+
+ for (var i = 0; i < data.length; i++) {
+ var y = (base_height) * (data[i].value / max);
+
+ var existing_rect = $('rect[data-id=r' + i +']', g);
+
+ if (existing_rect.length > 0) {
+ var rect = existing_rect[0];
+ } else {
+ var rect = this.svg_obj('rect');
+ rect.setAttribute('data-id', 'r' + i);
+ }
+
+ if (current_offset === 0) {
+ var new_offset = current_offset;
+ } else {
+ var new_offset = current_offset + spacer;
+ }
+
+ rect.setAttribute('data-y', y);
+
+ this.set_attr(rect, {
+ x : new_offset,
+ y : 0,
+ width : interval,
+ height : 0,
+ fill: data[i].color,
+ stroke: settings.stroke_color,
+ 'strokeWidth': settings.stroke_width
+ });
+
+ Snap(rect).animate({height: y}, 1500, mina[settings.animation_type]);
+
+ current_offset = new_offset + interval;
+
+ if (existing_group.length < 1) {
+ g.appendChild(rect);
+ this.animate_bar(Snap(rect), y, settings);
+ }
+ }
+
+ if (existing_group.length < 1) {
+ svg.appendChild(g);
+ }
+
+ return [legend, svg];
+ },
+
+ animate_bar : function (el, y, settings) {
+ var self = this,
+ $el = $(el),
+ new_y = y + 15;
+
+ el.hover(function (e) {
+ var path = Snap(e.target);
+
+ path.animate({
+ height: new_y
+ }, settings.animation_speed, mina[settings.animation_type]);
+
+ }, function (e) {
+ var path = Snap(e.target);
+
+ path.animate({
+ height: y
+ }, settings.animation_speed, mina[settings.animation_type]);
+ });
+
+ },
+
+ assemble_grid : function (svg, min, max, width, height, settings) {
+ var existing_group = $('g[data-id=bars]', svg);
+
+ if (existing_group.length > 0) {
+ var line_g = $('g[data-id=grid]', svg)[0],
+ text_g = $('g[data-id=labels]', svg)[0];
+ } else {
+ var line_g = this.svg_obj('g'),
+ text_g = this.svg_obj('g');
+
+ line_g.setAttribute('data-id', 'grid');
+ text_g.setAttribute('data-id', 'labels');
+ }
+
+ var ticks = this.ticks(min, max, settings.bar_intervals),
+ ticks_length = i = ticks.length,
+ interval = height/(ticks_length-1),
+ total_tick_height = 0;
+
+ while (i--) {
+ if (existing_group.length > 0) {
+ var line = $('line[data-id=l' + i + ']', line_g)[0],
+ text = $('text[data-id=t' + i + ']', text_g)[0];
+ } else {
+ var line = this.svg_obj('line'),
+ text = this.svg_obj('text');
+
+ line.setAttribute('data-id', 'l' + i);
+ text.setAttribute('data-id', 't' + i);
+ }
+
+ var line_height = total_tick_height + interval;
+
+ this.set_attr(line, {
+ x1 : 0,
+ x2 : width,
+ y1 : line_height,
+ y2 : line_height,
+ stroke : 'gray',
+ 'stroke-width' : 1,
+ 'stroke-dasharray' : '5,5'
+ })
+ .set_attr(text, {
+ x : -8,
+ y : line_height + 5,
+ 'text-anchor': 'end'
+ });
+
+ text.innerHTML = ticks[i];
+
+ if (existing_group.length < 1) {
+ line_g.appendChild(line);
+ text_g.appendChild(text);
+ }
+
+ total_tick_height = line_height;
+ }
+
+ line_g.setAttribute('transform', 'translate(0, -' + total_tick_height / ticks_length + ')');
+ text_g.setAttribute('transform', 'translate(0, -' + total_tick_height / ticks_length + ')');
+
+ if (existing_group.length < 1) {
+ svg.appendChild(line_g);
+ svg.appendChild(text_g);
+ }
+
+ },
+
+ bar_events : function () {
+ var self = this;
+
+ $(this.scope).on('mouseenter.pizza mouseleave.pizza touchstart.pizza', '[data-bar-id] li', function (e) {
+ var parent = $(this).parent(),
+ path = $('#' + parent.attr('data-bar-id') + ' rect[data-id=r' + $(this).index() + ']')[0],
+ settings = $(this).parent().data('settings'),
+ new_height = parseInt(path.getAttribute('data-y'), 10) + 15;
+
+ if (/start/i.test(e.type)) {
+ $(path).siblings('rect').each(function () {
+ if (this.nodeName) {
+ Snap(path).animate({
+ height: path.getAttribute('data-y')
+ }, settings.animation_speed, mina[settings.animation_type]);
+ }
+ });
+ }
+
+ if (/enter|start/i.test(e.type)) {
+ Snap(path).animate({
+ height: new_height
+ }, settings.animation_speed, mina[settings.animation_type]);
+ } else {
+ Snap(path).animate({
+ height: path.getAttribute('data-y')
+ }, settings.animation_speed, mina[settings.animation_type]);
+ }
+ });
+ }
+});
+$.extend(Pizza, {
+ line : function (legend) {
+ var settings = legend.data('settings'),
+ svg = this.svg(legend, settings),
+ container = $(this.identifier(legend)),
+ width = container.outerWidth(),
+ height = container.outerHeight(),
+ data = legend.data('graph-data'),
+ max_x = max_y = min_x = min_y = total_x = total_y = 0,
+ i = data.length,
+ points = '';
+
+ for (var i = 0; i < data.length; i++) {
+ if (data[i].x > max_x) max_x = data[i].x;
+ if (data[i].y > max_y) max_y = data[i].y;
+ if (min_x > data[i].x) min_x = data[i].x;
+ if (min_y > data[i].y) min_y = data[i].y;
+ total_x += data[i].x;
+ total_y += data[i].y;
+ }
+
+ var existing_group = $('g[data-id=line]', svg);
+
+ if (existing_group.length > 0) {
+ var line_g = $('g[data-id=line]', svg)[0],
+ circle_g = $('g[data-id=points]', svg)[0],
+ polyline = $('path[data-id=path]', line_g)[0];
+ } else {
+ var polyline = this.svg_obj('path'),
+ line_g = this.svg_obj('g'),
+ circle_g = this.svg_obj('g');
+
+ line_g.setAttribute('data-id', 'line');
+ circle_g.setAttribute('data-id', 'points');
+ polyline.setAttribute('data-id', 'path');
+ }
+
+ for (var i = 0; i < data.length; i++) {
+ if (existing_group.length > 0) {
+ var circle = $('circle[data-id=c' + i + ']', circle_g)[0];
+ } else {
+ var circle = this.svg_obj('circle');
+
+ circle.setAttribute('data-id', 'c' + i);
+ }
+
+ var x = (data[i].x / max_x) * width,
+ y = (data[i].y / max_y) * height;
+
+ points += x + ',' + y + ' ';
+ this.set_attr(circle, {cx: x, cy: y,r: 0,fill: data[i.color],
+ 'data-value': data[i].x + ', ' + data[i].y,
+ 'data-tooltip': '',
+ 'title': data[i].x + ', ' + data[i].y,
+ 'class': 'has-tip tip-top'});
+
+ Snap(circle).animate({
+ r: 4
+ }, 1500, mina[settings.animation_type]);
+
+ this.animate(Snap(circle), x, y, settings, 2);
+
+ if (existing_group.length < 1) {
+ circle_g.appendChild(circle);
+ }
+ }
+
+ this.flip(circle_g, height);
+ this.flip(line_g, height);
+
+ if (settings.show_grid) {
+ this.assemble_grid_x(svg, min_x, max_x, width, height, settings);
+ this.assemble_grid_y(svg, min_y, max_y, width, height, settings);
+ }
+ var v = this.points_to_path(points);
+
+ this.set_attr(polyline, {d:v, fill: 'none', stroke: 'black', 'stroke-width': 2});
+
+ if (existing_group.length < 1) {
+ line_g.appendChild(polyline);
+ svg.appendChild(line_g);
+ }
+
+ if (existing_group.length < 1) {
+ svg.appendChild(circle_g);
+ }
+
+ return [legend, svg];
+ },
+
+ assemble_grid_x : function (svg, min, max, width, height, settings) {
+ var existing_group = $('g[data-id=gridx]', svg);
+
+ if (existing_group.length > 0) {
+ var line_g = existing_group[0],
+ text_g = $('g[data-id=labelx]', svg)[0];
+ } else {
+ var line_g = this.svg_obj('g'),
+ text_g = this.svg_obj('g');
+
+ line_g.setAttribute('data-id', 'gridx');
+ text_g.setAttribute('data-id', 'labelx');
+ }
+
+ var ticks = this.ticks(min, max, settings.bar_intervals).reverse(),
+ ticks_length = i = ticks.length,
+ total_tick_width = 0,
+ interval = width/(ticks_length-1);
+
+ while (i--) {
+ if (existing_group.length > 0) {
+ var line = $('line[data-id=l' + i + ']', line_g)[0],
+ text = $('text[data-id=t' + i + ']', text_g)[0];
+ } else {
+ var line = this.svg_obj('line'),
+ text = this.svg_obj('text');
+
+ line.setAttribute('data-id', 'l' + i);
+ text.setAttribute('data-id', 't' + i);
+ }
+
+ var line_width = total_tick_width + interval;
+
+ this.set_attr(line, {
+ x1 : line_width,
+ x2 : line_width,
+ y1 : 0,
+ y2 : height,
+ stroke : 'gray',
+ 'stroke-width' : 1,
+ 'stroke-dasharray' : '5,5'
+ })
+ .set_attr(text, {
+ y: height + 20,
+ x: line_width - interval,
+ 'text-anchor': 'middle'
+ });
+
+ if (existing_group.length < 1) {
+ text.innerHTML = ticks[i];
+ text_g.appendChild(text);
+ line_g.appendChild(line);
+ }
+
+ total_tick_width = line_width;
+ }
+
+ line_g.setAttribute('transform', 'translate(-' + interval + ', 0)');
+
+ if (existing_group.length < 1) {
+ svg.appendChild(line_g);
+ svg.appendChild(text_g);
+ }
+ },
+
+ assemble_grid_y : function (svg, min, max, width, height, settings) {
+ var existing_group = $('g[data-id=gridy]', svg);
+
+ if (existing_group.length > 0) {
+ var line_g = existing_group[0],
+ text_g = $('g[data-id=labely]', svg)[0];
+ } else {
+ var line_g = this.svg_obj('g'),
+ text_g = this.svg_obj('g');
+
+ line_g.setAttribute('data-id', 'gridy');
+ text_g.setAttribute('data-id', 'labely');
+ }
+
+ var ticks = this.ticks(min, max, settings.bar_intervals),
+ ticks_length = i = ticks.length,
+ total_tick_height = 0;
+
+ while (i--) {
+ if (existing_group.length > 0) {
+ var line = $('line[data-id=l' + i + ']', line_g)[0],
+ text = $('text[data-id=t' + i + ']', text_g)[0];
+ } else {
+ var line = this.svg_obj('line'),
+ text = this.svg_obj('text');
+
+ line.setAttribute('data-id', 'l' + i);
+ text.setAttribute('data-id', 't' + i);
+ }
+
+ var line_height = total_tick_height + (height/(ticks_length-1));
+
+ this.set_attr(line, {
+ x1 : 0,
+ x2 : width,
+ y1 : line_height,
+ y2 : line_height,
+ stroke : 'gray',
+ 'stroke-width' : 1,
+ 'stroke-dasharray' : '5,5'
+ })
+ .set_attr(text, {
+ x : -8,
+ y : line_height + 5,
+ 'text-anchor': 'end'
+ });
+
+ if (existing_group.length < 1) {
+ text_g.appendChild(text);
+ line_g.appendChild(line);
+ text.innerHTML = ticks[i];
+ }
+
+ total_tick_height = line_height;
+ }
+
+ line_g.setAttribute('transform', 'translate(0, -' + total_tick_height / ticks_length + ')');
+ text_g.setAttribute('transform', 'translate(0, -' + total_tick_height / ticks_length + ')');
+
+ if (existing_group.length < 1) {
+ svg.appendChild(line_g);
+ svg.appendChild(text_g);
+ }
+
+ },
+
+ points_to_path : function (points) {
+ var points = points.split(/\s+|,/);
+ var x0=points.shift(), y0=points.shift();
+ var pathdata = 'M'+x0+','+y0+'L'+points.join(' ');
+ return ['M'+x0+','+y0+'L'].concat(points).join(' ');
+ },
+
+ line_events : function () {
+ $(this.scope).on('mouseenter.pizza mouseleave.pizza touchstart.pizza', '[data-line-id] li', function (e) {
+ var parent = $(this).parent(),
+ path = $('#' + parent.data('line-id') + ' circle[data-id="c' + $(this).index() + '"]')[0],
+ settings = $(this).parent().data('settings');
+
+ if (/start/i.test(e.type)) {
+ $(path).siblings('circle').each(function () {
+ if (this.nodeName) {
+ Snap(path).animate({
+ transform: 's1 1 ' + path.getAttribute('cx') + ' ' + path.getAttribute('cy')
+ }, settings.animation_speed, mina[settings.animation_type]);
+ }
+ });
+ }
+
+ if (/enter|start/i.test(e.type)) {
+ Snap(path).animate({
+ transform: 's2 2 ' + path.getAttribute('cx') + ' ' + path.getAttribute('cy')
+ }, settings.animation_speed, mina[settings.animation_type]);