diff --git a/libreplan-webapp/src/main/webapp/jqplot/excanvas.js b/libreplan-webapp/src/main/webapp/jqplot/excanvas.js
deleted file mode 100644
index 4ca9653fc..000000000
--- a/libreplan-webapp/src/main/webapp/jqplot/excanvas.js
+++ /dev/null
@@ -1,1438 +0,0 @@
-// Memory Leaks patch from http://explorercanvas.googlecode.com/svn/trunk/
-// svn : r73
-// ------------------------------------------------------------------
-// Copyright 2006 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-
-// Known Issues:
-//
-// * Patterns only support repeat.
-// * Radial gradient are not implemented. The VML version of these look very
-// different from the canvas one.
-// * Clipping paths are not implemented.
-// * Coordsize. The width and height attribute have higher priority than the
-// width and height style values which isn't correct.
-// * Painting mode isn't implemented.
-// * Canvas width/height should is using content-box by default. IE in
-// Quirks mode will draw the canvas using border-box. Either change your
-// doctype to HTML5
-// (http://www.whatwg.org/specs/web-apps/current-work/#the-doctype)
-// or use Box Sizing Behavior from WebFX
-// (http://webfx.eae.net/dhtml/boxsizing/boxsizing.html)
-// * Non uniform scaling does not correctly scale strokes.
-// * Optimize. There is always room for speed improvements.
-
-// Only add this code if we do not already have a canvas implementation
-if (!document.createElement('canvas').getContext) {
-
-(function() {
-
- // alias some functions to make (compiled) code shorter
- var m = Math;
- var mr = m.round;
- var ms = m.sin;
- var mc = m.cos;
- var abs = m.abs;
- var sqrt = m.sqrt;
-
- // this is used for sub pixel precision
- var Z = 10;
- var Z2 = Z / 2;
-
- var IE_VERSION = +navigator.userAgent.match(/MSIE ([\d.]+)?/)[1];
-
- /**
- * This funtion is assigned to the elements as element.getContext().
- * @this {HTMLElement}
- * @return {CanvasRenderingContext2D_}
- */
- function getContext() {
- return this.context_ ||
- (this.context_ = new CanvasRenderingContext2D_(this));
- }
-
- var slice = Array.prototype.slice;
-
- /**
- * Binds a function to an object. The returned function will always use the
- * passed in {@code obj} as {@code this}.
- *
- * Example:
- *
- * g = bind(f, obj, a, b)
- * g(c, d) // will do f.call(obj, a, b, c, d)
- *
- * @param {Function} f The function to bind the object to
- * @param {Object} obj The object that should act as this when the function
- * is called
- * @param {*} var_args Rest arguments that will be used as the initial
- * arguments when the function is called
- * @return {Function} A new function that has bound this
- */
- function bind(f, obj, var_args) {
- var a = slice.call(arguments, 2);
- return function() {
- return f.apply(obj, a.concat(slice.call(arguments)));
- };
- }
-
- function encodeHtmlAttribute(s) {
- return String(s).replace(/&/g, '&').replace(/"/g, '"');
- }
-
- function addNamespace(doc, prefix, urn) {
- if (!doc.namespaces[prefix]) {
- doc.namespaces.add(prefix, urn, '#default#VML');
- }
- }
-
- function addNamespacesAndStylesheet(doc) {
- addNamespace(doc, 'g_vml_', 'urn:schemas-microsoft-com:vml');
- addNamespace(doc, 'g_o_', 'urn:schemas-microsoft-com:office:office');
-
- // Setup default CSS. Only add one style sheet per document
- if (!doc.styleSheets['ex_canvas_']) {
- var ss = doc.createStyleSheet();
- ss.owningElement.id = 'ex_canvas_';
- ss.cssText = 'canvas{display:inline-block;overflow:hidden;' +
- // default size is 300x150 in Gecko and Opera
- 'text-align:left;width:300px;height:150px}';
- }
- }
-
- // Add namespaces and stylesheet at startup.
- addNamespacesAndStylesheet(document);
-
- var G_vmlCanvasManager_ = {
- init: function(opt_doc) {
- var doc = opt_doc || document;
- // Create a dummy element so that IE will allow canvas elements to be
- // recognized.
- doc.createElement('canvas');
- doc.attachEvent('onreadystatechange', bind(this.init_, this, doc));
- },
-
- init_: function(doc) {
- // find all canvas elements
- var els = doc.getElementsByTagName('canvas');
- for (var i = 0; i < els.length; i++) {
- this.initElement(els[i]);
- }
- },
-
- /**
- * Public initializes a canvas element so that it can be used as canvas
- * element from now on. This is called automatically before the page is
- * loaded but if you are creating elements using createElement you need to
- * make sure this is called on the element.
- * @param {HTMLElement} el The canvas element to initialize.
- * @return {HTMLElement} the element that was created.
- */
- initElement: function(el) {
- if (!el.getContext) {
- el.getContext = getContext;
-
- // Add namespaces and stylesheet to document of the element.
- addNamespacesAndStylesheet(el.ownerDocument);
-
- // Remove fallback content. There is no way to hide text nodes so we
- // just remove all childNodes. We could hide all elements and remove
- // text nodes but who really cares about the fallback content.
- el.innerHTML = '';
-
- // do not use inline function because that will leak memory
- el.attachEvent('onpropertychange', onPropertyChange);
- el.attachEvent('onresize', onResize);
-
- var attrs = el.attributes;
- if (attrs.width && attrs.width.specified) {
- // TODO: use runtimeStyle and coordsize
- // el.getContext().setWidth_(attrs.width.nodeValue);
- el.style.width = attrs.width.nodeValue + 'px';
- } else {
- el.width = el.clientWidth;
- }
- if (attrs.height && attrs.height.specified) {
- // TODO: use runtimeStyle and coordsize
- // el.getContext().setHeight_(attrs.height.nodeValue);
- el.style.height = attrs.height.nodeValue + 'px';
- } else {
- el.height = el.clientHeight;
- }
- //el.getContext().setCoordsize_()
- }
- return el;
- },
-
- // Memory Leaks patch : see http://code.google.com/p/explorercanvas/issues/detail?id=82
- uninitElement: function(el){
- if (el.getContext) {
- var ctx = el.getContext();
- delete ctx.element_;
- delete ctx.canvas;
- el.innerHTML = "";
- //el.outerHTML = "";
- el.context_ = null;
- el.getContext = null;
- el.detachEvent("onpropertychange", onPropertyChange);
- el.detachEvent("onresize", onResize);
- }
- }
- };
-
- function onPropertyChange(e) {
- var el = e.srcElement;
-
- switch (e.propertyName) {
- case 'width':
- el.getContext().clearRect();
- el.style.width = el.attributes.width.nodeValue + 'px';
- // In IE8 this does not trigger onresize.
- el.firstChild.style.width = el.clientWidth + 'px';
- break;
- case 'height':
- el.getContext().clearRect();
- el.style.height = el.attributes.height.nodeValue + 'px';
- el.firstChild.style.height = el.clientHeight + 'px';
- break;
- }
- }
-
- function onResize(e) {
- var el = e.srcElement;
- if (el.firstChild) {
- el.firstChild.style.width = el.clientWidth + 'px';
- el.firstChild.style.height = el.clientHeight + 'px';
- }
- }
-
- G_vmlCanvasManager_.init();
-
- // precompute "00" to "FF"
- var decToHex = [];
- for (var i = 0; i < 16; i++) {
- for (var j = 0; j < 16; j++) {
- decToHex[i * 16 + j] = i.toString(16) + j.toString(16);
- }
- }
-
- function createMatrixIdentity() {
- return [
- [1, 0, 0],
- [0, 1, 0],
- [0, 0, 1]
- ];
- }
-
- function matrixMultiply(m1, m2) {
- var result = createMatrixIdentity();
-
- for (var x = 0; x < 3; x++) {
- for (var y = 0; y < 3; y++) {
- var sum = 0;
-
- for (var z = 0; z < 3; z++) {
- sum += m1[x][z] * m2[z][y];
- }
-
- result[x][y] = sum;
- }
- }
- return result;
- }
-
- function copyState(o1, o2) {
- o2.fillStyle = o1.fillStyle;
- o2.lineCap = o1.lineCap;
- o2.lineJoin = o1.lineJoin;
- o2.lineWidth = o1.lineWidth;
- o2.miterLimit = o1.miterLimit;
- o2.shadowBlur = o1.shadowBlur;
- o2.shadowColor = o1.shadowColor;
- o2.shadowOffsetX = o1.shadowOffsetX;
- o2.shadowOffsetY = o1.shadowOffsetY;
- o2.strokeStyle = o1.strokeStyle;
- o2.globalAlpha = o1.globalAlpha;
- o2.font = o1.font;
- o2.textAlign = o1.textAlign;
- o2.textBaseline = o1.textBaseline;
- o2.arcScaleX_ = o1.arcScaleX_;
- o2.arcScaleY_ = o1.arcScaleY_;
- o2.lineScale_ = o1.lineScale_;
- }
-
- var colorData = {
- aliceblue: '#F0F8FF',
- antiquewhite: '#FAEBD7',
- aquamarine: '#7FFFD4',
- azure: '#F0FFFF',
- beige: '#F5F5DC',
- bisque: '#FFE4C4',
- black: '#000000',
- blanchedalmond: '#FFEBCD',
- blueviolet: '#8A2BE2',
- brown: '#A52A2A',
- burlywood: '#DEB887',
- cadetblue: '#5F9EA0',
- chartreuse: '#7FFF00',
- chocolate: '#D2691E',
- coral: '#FF7F50',
- cornflowerblue: '#6495ED',
- cornsilk: '#FFF8DC',
- crimson: '#DC143C',
- cyan: '#00FFFF',
- darkblue: '#00008B',
- darkcyan: '#008B8B',
- darkgoldenrod: '#B8860B',
- darkgray: '#A9A9A9',
- darkgreen: '#006400',
- darkgrey: '#A9A9A9',
- darkkhaki: '#BDB76B',
- darkmagenta: '#8B008B',
- darkolivegreen: '#556B2F',
- darkorange: '#FF8C00',
- darkorchid: '#9932CC',
- darkred: '#8B0000',
- darksalmon: '#E9967A',
- darkseagreen: '#8FBC8F',
- darkslateblue: '#483D8B',
- darkslategray: '#2F4F4F',
- darkslategrey: '#2F4F4F',
- darkturquoise: '#00CED1',
- darkviolet: '#9400D3',
- deeppink: '#FF1493',
- deepskyblue: '#00BFFF',
- dimgray: '#696969',
- dimgrey: '#696969',
- dodgerblue: '#1E90FF',
- firebrick: '#B22222',
- floralwhite: '#FFFAF0',
- forestgreen: '#228B22',
- gainsboro: '#DCDCDC',
- ghostwhite: '#F8F8FF',
- gold: '#FFD700',
- goldenrod: '#DAA520',
- grey: '#808080',
- greenyellow: '#ADFF2F',
- honeydew: '#F0FFF0',
- hotpink: '#FF69B4',
- indianred: '#CD5C5C',
- indigo: '#4B0082',
- ivory: '#FFFFF0',
- khaki: '#F0E68C',
- lavender: '#E6E6FA',
- lavenderblush: '#FFF0F5',
- lawngreen: '#7CFC00',
- lemonchiffon: '#FFFACD',
- lightblue: '#ADD8E6',
- lightcoral: '#F08080',
- lightcyan: '#E0FFFF',
- lightgoldenrodyellow: '#FAFAD2',
- lightgreen: '#90EE90',
- lightgrey: '#D3D3D3',
- lightpink: '#FFB6C1',
- lightsalmon: '#FFA07A',
- lightseagreen: '#20B2AA',
- lightskyblue: '#87CEFA',
- lightslategray: '#778899',
- lightslategrey: '#778899',
- lightsteelblue: '#B0C4DE',
- lightyellow: '#FFFFE0',
- limegreen: '#32CD32',
- linen: '#FAF0E6',
- magenta: '#FF00FF',
- mediumaquamarine: '#66CDAA',
- mediumblue: '#0000CD',
- mediumorchid: '#BA55D3',
- mediumpurple: '#9370DB',
- mediumseagreen: '#3CB371',
- mediumslateblue: '#7B68EE',
- mediumspringgreen: '#00FA9A',
- mediumturquoise: '#48D1CC',
- mediumvioletred: '#C71585',
- midnightblue: '#191970',
- mintcream: '#F5FFFA',
- mistyrose: '#FFE4E1',
- moccasin: '#FFE4B5',
- navajowhite: '#FFDEAD',
- oldlace: '#FDF5E6',
- olivedrab: '#6B8E23',
- orange: '#FFA500',
- orangered: '#FF4500',
- orchid: '#DA70D6',
- palegoldenrod: '#EEE8AA',
- palegreen: '#98FB98',
- paleturquoise: '#AFEEEE',
- palevioletred: '#DB7093',
- papayawhip: '#FFEFD5',
- peachpuff: '#FFDAB9',
- peru: '#CD853F',
- pink: '#FFC0CB',
- plum: '#DDA0DD',
- powderblue: '#B0E0E6',
- rosybrown: '#BC8F8F',
- royalblue: '#4169E1',
- saddlebrown: '#8B4513',
- salmon: '#FA8072',
- sandybrown: '#F4A460',
- seagreen: '#2E8B57',
- seashell: '#FFF5EE',
- sienna: '#A0522D',
- skyblue: '#87CEEB',
- slateblue: '#6A5ACD',
- slategray: '#708090',
- slategrey: '#708090',
- snow: '#FFFAFA',
- springgreen: '#00FF7F',
- steelblue: '#4682B4',
- tan: '#D2B48C',
- thistle: '#D8BFD8',
- tomato: '#FF6347',
- turquoise: '#40E0D0',
- violet: '#EE82EE',
- wheat: '#F5DEB3',
- whitesmoke: '#F5F5F5',
- yellowgreen: '#9ACD32'
- };
-
-
- function getRgbHslContent(styleString) {
- var start = styleString.indexOf('(', 3);
- var end = styleString.indexOf(')', start + 1);
- var parts = styleString.substring(start + 1, end).split(',');
- // add alpha if needed
- if (parts.length != 4 || styleString.charAt(3) != 'a') {
- parts[3] = 1;
- }
- return parts;
- }
-
- function percent(s) {
- return parseFloat(s) / 100;
- }
-
- function clamp(v, min, max) {
- return Math.min(max, Math.max(min, v));
- }
-
- function hslToRgb(parts){
- var r, g, b, h, s, l;
- h = parseFloat(parts[0]) / 360 % 360;
- if (h < 0)
- h++;
- s = clamp(percent(parts[1]), 0, 1);
- l = clamp(percent(parts[2]), 0, 1);
- if (s == 0) {
- r = g = b = l; // achromatic
- } else {
- var q = l < 0.5 ? l * (1 + s) : l + s - l * s;
- var p = 2 * l - q;
- r = hueToRgb(p, q, h + 1 / 3);
- g = hueToRgb(p, q, h);
- b = hueToRgb(p, q, h - 1 / 3);
- }
-
- return '#' + decToHex[Math.floor(r * 255)] +
- decToHex[Math.floor(g * 255)] +
- decToHex[Math.floor(b * 255)];
- }
-
- function hueToRgb(m1, m2, h) {
- if (h < 0)
- h++;
- if (h > 1)
- h--;
-
- if (6 * h < 1)
- return m1 + (m2 - m1) * 6 * h;
- else if (2 * h < 1)
- return m2;
- else if (3 * h < 2)
- return m1 + (m2 - m1) * (2 / 3 - h) * 6;
- else
- return m1;
- }
-
- var processStyleCache = {};
-
- function processStyle(styleString) {
- if (styleString in processStyleCache) {
- return processStyleCache[styleString];
- }
-
- var str, alpha = 1;
-
- styleString = String(styleString);
- if (styleString.charAt(0) == '#') {
- str = styleString;
- } else if (/^rgb/.test(styleString)) {
- var parts = getRgbHslContent(styleString);
- var str = '#', n;
- for (var i = 0; i < 3; i++) {
- if (parts[i].indexOf('%') != -1) {
- n = Math.floor(percent(parts[i]) * 255);
- } else {
- n = +parts[i];
- }
- str += decToHex[clamp(n, 0, 255)];
- }
- alpha = +parts[3];
- } else if (/^hsl/.test(styleString)) {
- var parts = getRgbHslContent(styleString);
- str = hslToRgb(parts);
- alpha = parts[3];
- } else {
- str = colorData[styleString] || styleString;
- }
- return processStyleCache[styleString] = {color: str, alpha: alpha};
- }
-
- var DEFAULT_STYLE = {
- style: 'normal',
- variant: 'normal',
- weight: 'normal',
- size: 10,
- family: 'sans-serif'
- };
-
- // Internal text style cache
- var fontStyleCache = {};
-
- function processFontStyle(styleString) {
- if (fontStyleCache[styleString]) {
- return fontStyleCache[styleString];
- }
-
- var el = document.createElement('div');
- var style = el.style;
- try {
- style.font = styleString;
- } catch (ex) {
- // Ignore failures to set to invalid font.
- }
-
- return fontStyleCache[styleString] = {
- style: style.fontStyle || DEFAULT_STYLE.style,
- variant: style.fontVariant || DEFAULT_STYLE.variant,
- weight: style.fontWeight || DEFAULT_STYLE.weight,
- size: style.fontSize || DEFAULT_STYLE.size,
- family: style.fontFamily || DEFAULT_STYLE.family
- };
- }
-
- function getComputedStyle(style, element) {
- var computedStyle = {};
-
- for (var p in style) {
- computedStyle[p] = style[p];
- }
-
- // Compute the size
- var canvasFontSize = parseFloat(element.currentStyle.fontSize),
- fontSize = parseFloat(style.size);
-
- if (typeof style.size == 'number') {
- computedStyle.size = style.size;
- } else if (style.size.indexOf('px') != -1) {
- computedStyle.size = fontSize;
- } else if (style.size.indexOf('em') != -1) {
- computedStyle.size = canvasFontSize * fontSize;
- } else if(style.size.indexOf('%') != -1) {
- computedStyle.size = (canvasFontSize / 100) * fontSize;
- } else if (style.size.indexOf('pt') != -1) {
- computedStyle.size = fontSize / .75;
- } else {
- computedStyle.size = canvasFontSize;
- }
-
- // Different scaling between normal text and VML text. This was found using
- // trial and error to get the same size as non VML text.
- computedStyle.size *= 0.981;
-
- // Fix for VML handling of bare font family names. Add a '' around font family names.
- computedStyle.family = "'" + computedStyle.family.replace(/(\'|\")/g,'').replace(/\s*,\s*/g, "', '") + "'";
-
- return computedStyle;
- }
-
- function buildStyle(style) {
- return style.style + ' ' + style.variant + ' ' + style.weight + ' ' +
- style.size + 'px ' + style.family;
- }
-
- var lineCapMap = {
- 'butt': 'flat',
- 'round': 'round'
- };
-
- function processLineCap(lineCap) {
- return lineCapMap[lineCap] || 'square';
- }
-
- /**
- * This class implements CanvasRenderingContext2D interface as described by
- * the WHATWG.
- * @param {HTMLElement} canvasElement The element that the 2D context should
- * be associated with
- */
- function CanvasRenderingContext2D_(canvasElement) {
- this.m_ = createMatrixIdentity();
-
- this.mStack_ = [];
- this.aStack_ = [];
- this.currentPath_ = [];
-
- // Canvas context properties
- this.strokeStyle = '#000';
- this.fillStyle = '#000';
-
- this.lineWidth = 1;
- this.lineJoin = 'miter';
- this.lineCap = 'butt';
- this.miterLimit = Z * 1;
- this.globalAlpha = 1;
- this.font = '10px sans-serif';
- this.textAlign = 'left';
- this.textBaseline = 'alphabetic';
- this.canvas = canvasElement;
-
- var cssText = 'width:' + canvasElement.clientWidth + 'px;height:' +
- canvasElement.clientHeight + 'px;overflow:hidden;position:absolute';
- var el = canvasElement.ownerDocument.createElement('div');
- el.style.cssText = cssText;
- canvasElement.appendChild(el);
-
- var overlayEl = el.cloneNode(false);
- // Use a non transparent background.
- overlayEl.style.backgroundColor = 'red';
- overlayEl.style.filter = 'alpha(opacity=0)';
- canvasElement.appendChild(overlayEl);
-
- this.element_ = el;
- this.arcScaleX_ = 1;
- this.arcScaleY_ = 1;
- this.lineScale_ = 1;
- }
-
- var contextPrototype = CanvasRenderingContext2D_.prototype;
- contextPrototype.clearRect = function() {
- if (this.textMeasureEl_) {
- this.textMeasureEl_.removeNode(true);
- this.textMeasureEl_ = null;
- }
- this.element_.innerHTML = '';
- };
-
- contextPrototype.beginPath = function() {
- // TODO: Branch current matrix so that save/restore has no effect
- // as per safari docs.
- this.currentPath_ = [];
- };
-
- contextPrototype.moveTo = function(aX, aY) {
- var p = getCoords(this, aX, aY);
- this.currentPath_.push({type: 'moveTo', x: p.x, y: p.y});
- this.currentX_ = p.x;
- this.currentY_ = p.y;
- };
-
- contextPrototype.lineTo = function(aX, aY) {
- var p = getCoords(this, aX, aY);
- this.currentPath_.push({type: 'lineTo', x: p.x, y: p.y});
-
- this.currentX_ = p.x;
- this.currentY_ = p.y;
- };
-
- contextPrototype.bezierCurveTo = function(aCP1x, aCP1y,
- aCP2x, aCP2y,
- aX, aY) {
- var p = getCoords(this, aX, aY);
- var cp1 = getCoords(this, aCP1x, aCP1y);
- var cp2 = getCoords(this, aCP2x, aCP2y);
- bezierCurveTo(this, cp1, cp2, p);
- };
-
- // Helper function that takes the already fixed cordinates.
- function bezierCurveTo(self, cp1, cp2, p) {
- self.currentPath_.push({
- type: 'bezierCurveTo',
- cp1x: cp1.x,
- cp1y: cp1.y,
- cp2x: cp2.x,
- cp2y: cp2.y,
- x: p.x,
- y: p.y
- });
- self.currentX_ = p.x;
- self.currentY_ = p.y;
- }
-
- contextPrototype.quadraticCurveTo = function(aCPx, aCPy, aX, aY) {
- // the following is lifted almost directly from
- // http://developer.mozilla.org/en/docs/Canvas_tutorial:Drawing_shapes
-
- var cp = getCoords(this, aCPx, aCPy);
- var p = getCoords(this, aX, aY);
-
- var cp1 = {
- x: this.currentX_ + 2.0 / 3.0 * (cp.x - this.currentX_),
- y: this.currentY_ + 2.0 / 3.0 * (cp.y - this.currentY_)
- };
- var cp2 = {
- x: cp1.x + (p.x - this.currentX_) / 3.0,
- y: cp1.y + (p.y - this.currentY_) / 3.0
- };
-
- bezierCurveTo(this, cp1, cp2, p);
- };
-
- contextPrototype.arc = function(aX, aY, aRadius,
- aStartAngle, aEndAngle, aClockwise) {
- aRadius *= Z;
- var arcType = aClockwise ? 'at' : 'wa';
-
- var xStart = aX + mc(aStartAngle) * aRadius - Z2;
- var yStart = aY + ms(aStartAngle) * aRadius - Z2;
-
- var xEnd = aX + mc(aEndAngle) * aRadius - Z2;
- var yEnd = aY + ms(aEndAngle) * aRadius - Z2;
-
- // IE won't render arches drawn counter clockwise if xStart == xEnd.
- if (xStart == xEnd && !aClockwise) {
- xStart += 0.125; // Offset xStart by 1/80 of a pixel. Use something
- // that can be represented in binary
- }
-
- var p = getCoords(this, aX, aY);
- var pStart = getCoords(this, xStart, yStart);
- var pEnd = getCoords(this, xEnd, yEnd);
-
- this.currentPath_.push({type: arcType,
- x: p.x,
- y: p.y,
- radius: aRadius,
- xStart: pStart.x,
- yStart: pStart.y,
- xEnd: pEnd.x,
- yEnd: pEnd.y});
-
- };
-
- contextPrototype.rect = function(aX, aY, aWidth, aHeight) {
- this.moveTo(aX, aY);
- this.lineTo(aX + aWidth, aY);
- this.lineTo(aX + aWidth, aY + aHeight);
- this.lineTo(aX, aY + aHeight);
- this.closePath();
- };
-
- contextPrototype.strokeRect = function(aX, aY, aWidth, aHeight) {
- var oldPath = this.currentPath_;
- this.beginPath();
-
- this.moveTo(aX, aY);
- this.lineTo(aX + aWidth, aY);
- this.lineTo(aX + aWidth, aY + aHeight);
- this.lineTo(aX, aY + aHeight);
- this.closePath();
- this.stroke();
-
- this.currentPath_ = oldPath;
- };
-
- contextPrototype.fillRect = function(aX, aY, aWidth, aHeight) {
- var oldPath = this.currentPath_;
- this.beginPath();
-
- this.moveTo(aX, aY);
- this.lineTo(aX + aWidth, aY);
- this.lineTo(aX + aWidth, aY + aHeight);
- this.lineTo(aX, aY + aHeight);
- this.closePath();
- this.fill();
-
- this.currentPath_ = oldPath;
- };
-
- contextPrototype.createLinearGradient = function(aX0, aY0, aX1, aY1) {
- var gradient = new CanvasGradient_('gradient');
- gradient.x0_ = aX0;
- gradient.y0_ = aY0;
- gradient.x1_ = aX1;
- gradient.y1_ = aY1;
- return gradient;
- };
-
- contextPrototype.createRadialGradient = function(aX0, aY0, aR0,
- aX1, aY1, aR1) {
- var gradient = new CanvasGradient_('gradientradial');
- gradient.x0_ = aX0;
- gradient.y0_ = aY0;
- gradient.r0_ = aR0;
- gradient.x1_ = aX1;
- gradient.y1_ = aY1;
- gradient.r1_ = aR1;
- return gradient;
- };
-
- contextPrototype.drawImage = function(image, var_args) {
- var dx, dy, dw, dh, sx, sy, sw, sh;
-
- // to find the original width we overide the width and height
- var oldRuntimeWidth = image.runtimeStyle.width;
- var oldRuntimeHeight = image.runtimeStyle.height;
- image.runtimeStyle.width = 'auto';
- image.runtimeStyle.height = 'auto';
-
- // get the original size
- var w = image.width;
- var h = image.height;
-
- // and remove overides
- image.runtimeStyle.width = oldRuntimeWidth;
- image.runtimeStyle.height = oldRuntimeHeight;
-
- if (arguments.length == 3) {
- dx = arguments[1];
- dy = arguments[2];
- sx = sy = 0;
- sw = dw = w;
- sh = dh = h;
- } else if (arguments.length == 5) {
- dx = arguments[1];
- dy = arguments[2];
- dw = arguments[3];
- dh = arguments[4];
- sx = sy = 0;
- sw = w;
- sh = h;
- } else if (arguments.length == 9) {
- sx = arguments[1];
- sy = arguments[2];
- sw = arguments[3];
- sh = arguments[4];
- dx = arguments[5];
- dy = arguments[6];
- dw = arguments[7];
- dh = arguments[8];
- } else {
- throw Error('Invalid number of arguments');
- }
-
- var d = getCoords(this, dx, dy);
-
- var w2 = sw / 2;
- var h2 = sh / 2;
-
- var vmlStr = [];
-
- var W = 10;
- var H = 10;
-
- // For some reason that I've now forgotten, using divs didn't work
- vmlStr.push(' ' ,
- ' ',
- ' ');
-
- this.element_.insertAdjacentHTML('BeforeEnd', vmlStr.join(''));
- };
-
- contextPrototype.stroke = function(aFill) {
- var lineStr = [];
- var lineOpen = false;
-
- var W = 10;
- var H = 10;
-
- lineStr.push('');
-
- if (!aFill) {
- appendStroke(this, lineStr);
- } else {
- appendFill(this, lineStr, min, max);
- }
-
- lineStr.push(' ');
-
- this.element_.insertAdjacentHTML('beforeEnd', lineStr.join(''));
- };
-
- function appendStroke(ctx, lineStr) {
- var a = processStyle(ctx.strokeStyle);
- var color = a.color;
- var opacity = a.alpha * ctx.globalAlpha;
- var lineWidth = ctx.lineScale_ * ctx.lineWidth;
-
- // VML cannot correctly render a line if the width is less than 1px.
- // In that case, we dilute the color to make the line look thinner.
- if (lineWidth < 1) {
- opacity *= lineWidth;
- }
-
- lineStr.push(
- ' '
- );
- }
-
- function appendFill(ctx, lineStr, min, max) {
- var fillStyle = ctx.fillStyle;
- var arcScaleX = ctx.arcScaleX_;
- var arcScaleY = ctx.arcScaleY_;
- var width = max.x - min.x;
- var height = max.y - min.y;
- if (fillStyle instanceof CanvasGradient_) {
- // TODO: Gradients transformed with the transformation matrix.
- var angle = 0;
- var focus = {x: 0, y: 0};
-
- // additional offset
- var shift = 0;
- // scale factor for offset
- var expansion = 1;
-
- if (fillStyle.type_ == 'gradient') {
- var x0 = fillStyle.x0_ / arcScaleX;
- var y0 = fillStyle.y0_ / arcScaleY;
- var x1 = fillStyle.x1_ / arcScaleX;
- var y1 = fillStyle.y1_ / arcScaleY;
- var p0 = getCoords(ctx, x0, y0);
- var p1 = getCoords(ctx, x1, y1);
- var dx = p1.x - p0.x;
- var dy = p1.y - p0.y;
- angle = Math.atan2(dx, dy) * 180 / Math.PI;
-
- // The angle should be a non-negative number.
- if (angle < 0) {
- angle += 360;
- }
-
- // Very small angles produce an unexpected result because they are
- // converted to a scientific notation string.
- if (angle < 1e-6) {
- angle = 0;
- }
- } else {
- var p0 = getCoords(ctx, fillStyle.x0_, fillStyle.y0_);
- focus = {
- x: (p0.x - min.x) / width,
- y: (p0.y - min.y) / height
- };
-
- width /= arcScaleX * Z;
- height /= arcScaleY * Z;
- var dimension = m.max(width, height);
- shift = 2 * fillStyle.r0_ / dimension;
- expansion = 2 * fillStyle.r1_ / dimension - shift;
- }
-
- // We need to sort the color stops in ascending order by offset,
- // otherwise IE won't interpret it correctly.
- var stops = fillStyle.colors_;
- stops.sort(function(cs1, cs2) {
- return cs1.offset - cs2.offset;
- });
-
- var length = stops.length;
- var color1 = stops[0].color;
- var color2 = stops[length - 1].color;
- var opacity1 = stops[0].alpha * ctx.globalAlpha;
- var opacity2 = stops[length - 1].alpha * ctx.globalAlpha;
-
- var colors = [];
- for (var i = 0; i < length; i++) {
- var stop = stops[i];
- colors.push(stop.offset * expansion + shift + ' ' + stop.color);
- }
-
- // When colors attribute is used, the meanings of opacity and o:opacity2
- // are reversed.
- lineStr.push(' ');
- } else if (fillStyle instanceof CanvasPattern_) {
- if (width && height) {
- var deltaLeft = -min.x;
- var deltaTop = -min.y;
- lineStr.push(' ');
- }
- } else {
- var a = processStyle(ctx.fillStyle);
- var color = a.color;
- var opacity = a.alpha * ctx.globalAlpha;
- lineStr.push(' ');
- }
- }
-
- contextPrototype.fill = function() {
- this.stroke(true);
- };
-
- contextPrototype.closePath = function() {
- this.currentPath_.push({type: 'close'});
- };
-
- function getCoords(ctx, aX, aY) {
- var m = ctx.m_;
- return {
- x: Z * (aX * m[0][0] + aY * m[1][0] + m[2][0]) - Z2,
- y: Z * (aX * m[0][1] + aY * m[1][1] + m[2][1]) - Z2
- };
- };
-
- contextPrototype.save = function() {
- var o = {};
- copyState(this, o);
- this.aStack_.push(o);
- this.mStack_.push(this.m_);
- this.m_ = matrixMultiply(createMatrixIdentity(), this.m_);
- };
-
- contextPrototype.restore = function() {
- if (this.aStack_.length) {
- copyState(this.aStack_.pop(), this);
- this.m_ = this.mStack_.pop();
- }
- };
-
- function matrixIsFinite(m) {
- return isFinite(m[0][0]) && isFinite(m[0][1]) &&
- isFinite(m[1][0]) && isFinite(m[1][1]) &&
- isFinite(m[2][0]) && isFinite(m[2][1]);
- }
-
- function setM(ctx, m, updateLineScale) {
- if (!matrixIsFinite(m)) {
- return;
- }
- ctx.m_ = m;
-
- if (updateLineScale) {
- // Get the line scale.
- // Determinant of this.m_ means how much the area is enlarged by the
- // transformation. So its square root can be used as a scale factor
- // for width.
- var det = m[0][0] * m[1][1] - m[0][1] * m[1][0];
- ctx.lineScale_ = sqrt(abs(det));
- }
- }
-
- contextPrototype.translate = function(aX, aY) {
- var m1 = [
- [1, 0, 0],
- [0, 1, 0],
- [aX, aY, 1]
- ];
-
- setM(this, matrixMultiply(m1, this.m_), false);
- };
-
- contextPrototype.rotate = function(aRot) {
- var c = mc(aRot);
- var s = ms(aRot);
-
- var m1 = [
- [c, s, 0],
- [-s, c, 0],
- [0, 0, 1]
- ];
-
- setM(this, matrixMultiply(m1, this.m_), false);
- };
-
- contextPrototype.scale = function(aX, aY) {
- this.arcScaleX_ *= aX;
- this.arcScaleY_ *= aY;
- var m1 = [
- [aX, 0, 0],
- [0, aY, 0],
- [0, 0, 1]
- ];
-
- setM(this, matrixMultiply(m1, this.m_), true);
- };
-
- contextPrototype.transform = function(m11, m12, m21, m22, dx, dy) {
- var m1 = [
- [m11, m12, 0],
- [m21, m22, 0],
- [dx, dy, 1]
- ];
-
- setM(this, matrixMultiply(m1, this.m_), true);
- };
-
- contextPrototype.setTransform = function(m11, m12, m21, m22, dx, dy) {
- var m = [
- [m11, m12, 0],
- [m21, m22, 0],
- [dx, dy, 1]
- ];
-
- setM(this, m, true);
- };
-
- /**
- * The text drawing function.
- * The maxWidth argument isn't taken in account, since no browser supports
- * it yet.
- */
- contextPrototype.drawText_ = function(text, x, y, maxWidth, stroke) {
- var m = this.m_,
- delta = 1000,
- left = 0,
- right = delta,
- offset = {x: 0, y: 0},
- lineStr = [];
-
- var fontStyle = getComputedStyle(processFontStyle(this.font), this.element_);
-
- var fontStyleString = buildStyle(fontStyle);
-
- var elementStyle = this.element_.currentStyle;
- var textAlign = this.textAlign.toLowerCase();
- switch (textAlign) {
- case 'left':
- case 'center':
- case 'right':
- break;
- case 'end':
- textAlign = elementStyle.direction == 'ltr' ? 'right' : 'left';
- break;
- case 'start':
- textAlign = elementStyle.direction == 'rtl' ? 'right' : 'left';
- break;
- default:
- textAlign = 'left';
- }
-
- // 1.75 is an arbitrary number, as there is no info about the text baseline
- switch (this.textBaseline) {
- case 'hanging':
- case 'top':
- offset.y = fontStyle.size / 1.75;
- break;
- case 'middle':
- break;
- default:
- case null:
- case 'alphabetic':
- case 'ideographic':
- case 'bottom':
- offset.y = -fontStyle.size / 2.25;
- break;
- }
-
- switch(textAlign) {
- case 'right':
- left = delta;
- right = 0.05;
- break;
- case 'center':
- left = right = delta / 2;
- break;
- }
-
- var d = getCoords(this, x + offset.x, y + offset.y);
-
- lineStr.push('');
-
- if (stroke) {
- appendStroke(this, lineStr);
- } else {
- // TODO: Fix the min and max params.
- appendFill(this, lineStr, {x: -left, y: 0},
- {x: right, y: fontStyle.size});
- }
-
- var skewM = m[0][0].toFixed(3) + ',' + m[1][0].toFixed(3) + ',' +
- m[0][1].toFixed(3) + ',' + m[1][1].toFixed(3) + ',0,0';
-
- var skewOffset = mr(d.x / Z + 1 - m[0][0]) + ',' + mr(d.y / Z - 2 * m[1][0]);
-
-
- lineStr.push(' ',
- ' ',
- ' ');
-
- this.element_.insertAdjacentHTML('beforeEnd', lineStr.join(''));
- };
-
- contextPrototype.fillText = function(text, x, y, maxWidth) {
- this.drawText_(text, x, y, maxWidth, false);
- };
-
- contextPrototype.strokeText = function(text, x, y, maxWidth) {
- this.drawText_(text, x, y, maxWidth, true);
- };
-
- contextPrototype.measureText = function(text) {
- if (!this.textMeasureEl_) {
- var s = ' ';
- this.element_.insertAdjacentHTML('beforeEnd', s);
- this.textMeasureEl_ = this.element_.lastChild;
- }
- var doc = this.element_.ownerDocument;
- this.textMeasureEl_.innerHTML = '';
- this.textMeasureEl_.style.font = this.font;
- // Don't use innerHTML or innerText because they allow markup/whitespace.
- this.textMeasureEl_.appendChild(doc.createTextNode(text));
- return {width: this.textMeasureEl_.offsetWidth};
- };
-
- /******** STUBS ********/
- contextPrototype.clip = function() {
- // TODO: Implement
- };
-
- contextPrototype.arcTo = function() {
- // TODO: Implement
- };
-
- contextPrototype.createPattern = function(image, repetition) {
- return new CanvasPattern_(image, repetition);
- };
-
- // Gradient / Pattern Stubs
- function CanvasGradient_(aType) {
- this.type_ = aType;
- this.x0_ = 0;
- this.y0_ = 0;
- this.r0_ = 0;
- this.x1_ = 0;
- this.y1_ = 0;
- this.r1_ = 0;
- this.colors_ = [];
- }
-
- CanvasGradient_.prototype.addColorStop = function(aOffset, aColor) {
- aColor = processStyle(aColor);
- this.colors_.push({offset: aOffset,
- color: aColor.color,
- alpha: aColor.alpha});
- };
-
- function CanvasPattern_(image, repetition) {
- assertImageIsValid(image);
- switch (repetition) {
- case 'repeat':
- case null:
- case '':
- this.repetition_ = 'repeat';
- break;
- case 'repeat-x':
- case 'repeat-y':
- case 'no-repeat':
- this.repetition_ = repetition;
- break;
- default:
- throwException('SYNTAX_ERR');
- }
-
- this.src_ = image.src;
- this.width_ = image.width;
- this.height_ = image.height;
- }
-
- function throwException(s) {
- throw new DOMException_(s);
- }
-
- function assertImageIsValid(img) {
- if (!img || img.nodeType != 1 || img.tagName != 'IMG') {
- throwException('TYPE_MISMATCH_ERR');
- }
- if (img.readyState != 'complete') {
- throwException('INVALID_STATE_ERR');
- }
- }
-
- function DOMException_(s) {
- this.code = this[s];
- this.message = s +': DOM Exception ' + this.code;
- }
- var p = DOMException_.prototype = new Error;
- p.INDEX_SIZE_ERR = 1;
- p.DOMSTRING_SIZE_ERR = 2;
- p.HIERARCHY_REQUEST_ERR = 3;
- p.WRONG_DOCUMENT_ERR = 4;
- p.INVALID_CHARACTER_ERR = 5;
- p.NO_DATA_ALLOWED_ERR = 6;
- p.NO_MODIFICATION_ALLOWED_ERR = 7;
- p.NOT_FOUND_ERR = 8;
- p.NOT_SUPPORTED_ERR = 9;
- p.INUSE_ATTRIBUTE_ERR = 10;
- p.INVALID_STATE_ERR = 11;
- p.SYNTAX_ERR = 12;
- p.INVALID_MODIFICATION_ERR = 13;
- p.NAMESPACE_ERR = 14;
- p.INVALID_ACCESS_ERR = 15;
- p.VALIDATION_ERR = 16;
- p.TYPE_MISMATCH_ERR = 17;
-
- // set up externs
- G_vmlCanvasManager = G_vmlCanvasManager_;
- CanvasRenderingContext2D = CanvasRenderingContext2D_;
- CanvasGradient = CanvasGradient_;
- CanvasPattern = CanvasPattern_;
- DOMException = DOMException_;
- G_vmlCanvasManager._version = 888;
-})();
-
-} // if
diff --git a/libreplan-webapp/src/main/webapp/jqplot/jqPlotCssStyling.txt b/libreplan-webapp/src/main/webapp/jqplot/jqPlotCssStyling.txt
deleted file mode 100644
index 041035d2e..000000000
--- a/libreplan-webapp/src/main/webapp/jqplot/jqPlotCssStyling.txt
+++ /dev/null
@@ -1,53 +0,0 @@
-Title: jqPlot CSS Customization
-
-Much of the styling of jqPlot is done by css. The jqPlot css file is, unremarkably,
-jquery.jqplot.css and resides in the same directory as jqPlot itself.
-
-There exist some styling related javascript properties on the plot objects themselves
-(like fontStyle, fontSize, etc.). These can be set with the options object at plot creation.
-Generally, setting these options is *NOT* the preferred way to customize the look of the
-plot. Use the css file instead. *These options are deprecated and may disappear*. The
-exceptions are certain background and color options which control attributes of something
-renderered on a canvas. This would be line color, grid background, etc. These must
-be set by the options object. For a list of available options, see .
-
-Objects in the plot that can be customized by css are given a css class like ".jqplot-*".
-For example, the plot title will have a ".jqplot-title" class, the axes ".jqplot-axis", etc.
-
-Currently assigned classes in jqPlot
-are as follows:
-
-.jqplot-target - Styles for the plot target div. These will be cascaded down
-to all plot elements according to css rules.
-
-.jqplot-axis - Styles for all axes
-
-.jqplot-xaxis - Styles applied to the primary x axis only.
-
-.jqplot-yaxis - Styles applied to the primary y axis only.
-
-.jqplot-x2axis, .jqplot-x3axis, ... - Styles applied to the 2nd, 3rd, etc. x axis only.
-
-.jqplot-y2axis, .jqplot-y3axis, ... - Styles applied to the 2nd, 3rd, etc.y axis only.
-
-.jqplot-axis-tick - Styles applied to all axis ticks
-
-.jqplot-xaxis-tick - Styles applied to primary x axis ticks only.
-
-.jqplot-x2axis-tick - Styles applied to secondary x axis ticks only.
-
-.jqplot-yaxis-tick - Styles applied to primary y axis ticks only.
-
-.jqplot-y2axis-tick - Styles applied to secondary y axis ticks only.
-
-table.jqplot-table-legend - Styles applied to the legend box table.
-
-.jqplot-title - Styles applied to the title.
-
-.jqplot-cursor-tooltip - Styles applied to the cursor tooltip
-
-.jqplot-highlighter-tooltip - Styles applied to the highlighter tooltip.
-
-div.jqplot-table-legend-swatch - the div element used for the colored swatch on the legend.
-
-Note that axes will be assigned 2 classes like: class=".jqplot-axis .jqplot-xaxis".
\ No newline at end of file
diff --git a/libreplan-webapp/src/main/webapp/jqplot/jqPlotOptions.txt b/libreplan-webapp/src/main/webapp/jqplot/jqPlotOptions.txt
deleted file mode 100644
index d2d1e68cc..000000000
--- a/libreplan-webapp/src/main/webapp/jqplot/jqPlotOptions.txt
+++ /dev/null
@@ -1,276 +0,0 @@
-Title: jqPlot Options
-
-**This document is out of date. While the options described here should still be
-relavent and valid, it has not been updated for many new options. Sorry for
-this inconvenience.**
-
-This document describes the options available to jqPlot. These are set with the
-third argument to the $.jqplot('target', data, options) function. Options are
-using the following convention:
-
-{{{
-property: default, // notes
-}}}
-
-This document is not complete! Not all options are shown! Also, Options marked
-with ** in the notes are post 0.7.1 additions. They will be available in the next
-release. Further information about the options can be found in the online API
-documentation. For details on how the options relate to the API documentation,
-see the in the optionsTutorial.txt file.
-
-{{{
-options =
-{
- seriesColors: [ "#4bb2c5", "#c5b47f", "#EAA228", "#579575", "#839557", "#958c12",
- "#953579", "#4b5de4", "#d8b83f", "#ff5800", "#0085cc"], // colors that will
- // be assigned to the series. If there are more series than colors, colors
- // will wrap around and start at the beginning again.
-
- stackSeries: false, // if true, will create a stack plot.
- // Currently supported by line and bar graphs.
-
- title: '', // Title for the plot. Can also be specified as an object like:
-
- title: {
- text: '', // title for the plot,
- show: true,
- },
-
- axesDefaults: {
- show: false, // wether or not to renderer the axis. Determined automatically.
- min: null, // minimum numerical value of the axis. Determined automatically.
- max: null, // maximum numverical value of the axis. Determined automatically.
- pad: 1.2, // a factor multiplied by the data range on the axis to give the
- // axis range so that data points don't fall on the edges of the axis.
- ticks: [], // a 1D [val1, val2, ...], or 2D [[val, label], [val, label], ...]
- // array of ticks to use. Computed automatically.
- numberTicks: undefined,
- renderer: $.jqplot.LinearAxisRenderer, // renderer to use to draw the axis,
- rendererOptions: {}, // options to pass to the renderer. LinearAxisRenderer
- // has no options,
- tickOptions: {
- mark: 'outside', // Where to put the tick mark on the axis
- // 'outside', 'inside' or 'cross',
- showMark: true,
- showGridline: true, // wether to draw a gridline (across the whole grid) at this tick,
- markSize: 4, // length the tick will extend beyond the grid in pixels. For
- // 'cross', length will be added above and below the grid boundary,
- show: true, // wether to show the tick (mark and label),
- showLabel: true, // wether to show the text label at the tick,
- formatString: '', // format string to use with the axis tick formatter
- }
- showTicks: true, // wether or not to show the tick labels,
- showTickMarks: true, // wether or not to show the tick marks
- },
-
- axes: {
- xaxis: {
- // same options as axesDefaults
- },
- yaxis: {
- // same options as axesDefaults
- },
- x2axis: {
- // same options as axesDefaults
- },
- y2axis: {
- // same options as axesDefaults
- }
- },
-
- seriesDefaults: {
- show: true, // wether to render the series.
- xaxis: 'xaxis', // either 'xaxis' or 'x2axis'.
- yaxis: 'yaxis', // either 'yaxis' or 'y2axis'.
- label: '', // label to use in the legend for this line.
- color: '', // CSS color spec to use for the line. Determined automatically.
- lineWidth: 2.5, // Width of the line in pixels.
- shadow: true, // show shadow or not.
- shadowAngle: 45, // angle (degrees) of the shadow, clockwise from x axis.
- shadowOffset: 1.25, // offset from the line of the shadow.
- shadowDepth: 3, // Number of strokes to make when drawing shadow. Each
- // stroke offset by shadowOffset from the last.
- shadowAlpha: 0.1, // Opacity of the shadow.
- showLine: true, // whether to render the line segments or not.
- showMarker: true, // render the data point markers or not.
- fill: false, // fill under the line,
- fillAndStroke: false, // **stroke a line at top of fill area.
- fillColor: undefined, // **custom fill color for filled lines (default is line color).
- fillAlpha: undefined, // **custom alpha to apply to fillColor.
- renderer: $.jqplot.LineRenderer], // renderer used to draw the series.
- rendererOptions: {}, // options passed to the renderer. LineRenderer has no options.
- markerRenderer: $.jqplot.MarkerRenderer, // renderer to use to draw the data
- // point markers.
- markerOptions: {
- show: true, // wether to show data point markers.
- style: 'filledCircle', // circle, diamond, square, filledCircle.
- // filledDiamond or filledSquare.
- lineWidth: 2, // width of the stroke drawing the marker.
- size: 9, // size (diameter, edge length, etc.) of the marker.
- color: '#666666' // color of marker, set to color of line by default.
- shadow: true, // wether to draw shadow on marker or not.
- shadowAngle: 45, // angle of the shadow. Clockwise from x axis.
- shadowOffset: 1, // offset from the line of the shadow,
- shadowDepth: 3, // Number of strokes to make when drawing shadow. Each stroke
- // offset by shadowOffset from the last.
- shadowAlpha: 0.07 // Opacity of the shadow
- }
- },
-
- series:[
- {Each series has same options as seriesDefaults},
- {You can override each series individually here}
- ],
-
- legend: {
- show: false,
- location: 'ne', // compass direction, nw, n, ne, e, se, s, sw, w.
- xoffset: 12, // pixel offset of the legend box from the x (or x2) axis.
- yoffset: 12, // pixel offset of the legend box from the y (or y2) axis.
- },
-
- grid: {
- drawGridLines: true, // wether to draw lines across the grid or not.
- gridLineColor: '#cccccc' // **Color of the grid lines.
- background: '#fffdf6', // CSS color spec for background color of grid.
- borderColor: '#999999', // CSS color spec for border around grid.
- borderWidth: 2.0, // pixel width of border around grid.
- shadow: true, // draw a shadow for grid.
- shadowAngle: 45, // angle of the shadow. Clockwise from x axis.
- shadowOffset: 1.5, // offset from the line of the shadow.
- shadowWidth: 3, // width of the stroke for the shadow.
- shadowDepth: 3, // Number of strokes to make when drawing shadow.
- // Each stroke offset by shadowOffset from the last.
- shadowAlpha: 0.07 // Opacity of the shadow
- renderer: $.jqplot.CanvasGridRenderer, // renderer to use to draw the grid.
- rendererOptions: {} // options to pass to the renderer. Note, the default
- // CanvasGridRenderer takes no additional options.
- },
-
- // Plugin and renderer options.
-
- // BarRenderer.
- // With BarRenderer, you can specify additional options in the rendererOptions object
- // on the series or on the seriesDefaults object. Note, some options are respecified
- // (like shadowDepth) to override lineRenderer defaults from which BarRenderer inherits.
-
- seriesDefaults: {
- rendererOptions: {
- barPadding: 8, // number of pixels between adjacent bars in the same
- // group (same category or bin).
- barMargin: 10, // number of pixels between adjacent groups of bars.
- barDirection: 'vertical', // vertical or horizontal.
- barWidth: null, // width of the bars. null to calculate automatically.
- shadowOffset: 2, // offset from the bar edge to stroke the shadow.
- shadowDepth: 5, // nuber of strokes to make for the shadow.
- shadowAlpha: 0.8, // transparency of the shadow.
- }
- },
-
- // Cursor
- // Options are passed to the cursor plugin through the "cursor" object at the top
- // level of the options object.
-
- cursor: {
- style: 'crosshair', // A CSS spec for the cursor type to change the
- // cursor to when over plot.
- show: true,
- showTooltip: true, // show a tooltip showing cursor position.
- followMouse: false, // wether tooltip should follow the mouse or be stationary.
- tooltipLocation: 'se', // location of the tooltip either relative to the mouse
- // (followMouse=true) or relative to the plot. One of
- // the compass directions, n, ne, e, se, etc.
- tooltipOffset: 6, // pixel offset of the tooltip from the mouse or the axes.
- showTooltipGridPosition: false, // show the grid pixel coordinates of the mouse
- // in the tooltip.
- showTooltipUnitPosition: true, // show the coordinates in data units of the mouse
- // in the tooltip.
- tooltipFormatString: '%.4P', // sprintf style format string for tooltip values.
- useAxesFormatters: true, // wether to use the same formatter and formatStrings
- // as used by the axes, or to use the formatString
- // specified on the cursor with sprintf.
- tooltipAxesGroups: [], // show only specified axes groups in tooltip. Would specify like:
- // [['xaxis', 'yaxis'], ['xaxis', 'y2axis']]. By default, all axes
- // combinations with for the series in the plot are shown.
-
- },
-
- // Dragable
- // Dragable options are specified with the "dragable" object at the top level
- // of the options object.
-
- dragable: {
- color: undefined, // custom color to use for the dragged point and dragged line
- // section. default will use a transparent variant of the line color.
- constrainTo: 'none', // Constrain dragging motion to an axis: 'x', 'y', or 'none'.
- },
-
- // Highlighter
- // Highlighter options are specified with the "highlighter" object at the top level
- // of the options object.
-
- highlighter: {
- lineWidthAdjust: 2.5, // pixels to add to the size line stroking the data point marker
- // when showing highlight. Only affects non filled data point markers.
- sizeAdjust: 5, // pixels to add to the size of filled markers when drawing highlight.
- showTooltip: true, // show a tooltip with data point values.
- tooltipLocation: 'nw', // location of tooltip: n, ne, e, se, s, sw, w, nw.
- fadeTooltip: true, // use fade effect to show/hide tooltip.
- tooltipFadeSpeed: "fast"// slow, def, fast, or a number of milliseconds.
- tooltipOffset: 2, // pixel offset of tooltip from the highlight.
- tooltipAxes: 'both', // which axis values to display in the tooltip, x, y or both.
- tooltipSeparator: ', ' // separator between values in the tooltip.
- useAxesFormatters: true // use the same format string and formatters as used in the axes to
- // display values in the tooltip.
- tooltipFormatString: '%.5P' // sprintf format string for the tooltip. only used if
- // useAxesFormatters is false. Will use sprintf formatter with
- // this string, not the axes formatters.
- },
-
- // LogAxisRenderer
- // LogAxisRenderer add 2 options to the axes object. These options are specified directly on
- // the axes or axesDefaults object.
-
- axesDefaults: {
- base: 10, // the logarithmic base.
- tickDistribution: 'even', // 'even' or 'power'. 'even' will produce with even visiual (pixel)
- // spacing on the axis. 'power' will produce ticks spaced by
- // increasing powers of the log base.
- },
-
- // PieRenderer
- // PieRenderer accepts options from the rendererOptions object of the series or seriesDefaults object.
-
- seriesDefaults: {
- rendererOptions: {
- diameter: undefined, // diameter of pie, auto computed by default.
- padding: 20, // padding between pie and neighboring legend or plot margin.
- sliceMargin: 0, // gap between slices.
- fill: true, // render solid (filled) slices.
- shadowOffset: 2, // offset of the shadow from the chart.
- shadowDepth: 5, // Number of strokes to make when drawing shadow. Each stroke
- // offset by shadowOffset from the last.
- shadowAlpha: 0.07 // Opacity of the shadow
- }
- },
-
- // Trendline
- // Trendline takes options on the trendline object of the series or seriesDefaults object.
-
- seriesDefaults: {
- trendline: {
- show: true, // show the trend line
- color: '#666666', // CSS color spec for the trend line.
- label: '', // label for the trend line.
- type: 'linear', // 'linear', 'exponential' or 'exp'
- shadow: true, // show the trend line shadow.
- lineWidth: 1.5, // width of the trend line.
- shadowAngle: 45, // angle of the shadow. Clockwise from x axis.
- shadowOffset: 1.5, // offset from the line of the shadow.
- shadowDepth: 3, // Number of strokes to make when drawing shadow.
- // Each stroke offset by shadowOffset from the last.
- shadowAlpha: 0.07 // Opacity of the shadow
- }
- }
-}
-}}}
\ No newline at end of file
diff --git a/libreplan-webapp/src/main/webapp/jqplot/jquery.jqplot.css b/libreplan-webapp/src/main/webapp/jqplot/jquery.jqplot.css
deleted file mode 100644
index d30bafb1f..000000000
--- a/libreplan-webapp/src/main/webapp/jqplot/jquery.jqplot.css
+++ /dev/null
@@ -1,259 +0,0 @@
-/*rules for the plot target div. These will be cascaded down to all plot elements according to css rules*/
-.jqplot-target {
- position: relative;
- color: #666666;
- font-family: "Trebuchet MS", Arial, Helvetica, sans-serif;
- font-size: 1em;
-/* height: 300px;
- width: 400px;*/
-}
-
-/*rules applied to all axes*/
-.jqplot-axis {
- font-size: 0.75em;
-}
-
-.jqplot-xaxis {
- margin-top: 10px;
-}
-
-.jqplot-x2axis {
- margin-bottom: 10px;
-}
-
-.jqplot-yaxis {
- margin-right: 10px;
-}
-
-.jqplot-y2axis, .jqplot-y3axis, .jqplot-y4axis, .jqplot-y5axis, .jqplot-y6axis, .jqplot-y7axis, .jqplot-y8axis, .jqplot-y9axis, .jqplot-yMidAxis {
- margin-left: 10px;
- margin-right: 10px;
-}
-
-/*rules applied to all axis tick divs*/
-.jqplot-axis-tick, .jqplot-xaxis-tick, .jqplot-yaxis-tick, .jqplot-x2axis-tick, .jqplot-y2axis-tick, .jqplot-y3axis-tick, .jqplot-y4axis-tick, .jqplot-y5axis-tick, .jqplot-y6axis-tick, .jqplot-y7axis-tick, .jqplot-y8axis-tick, .jqplot-y9axis-tick, .jqplot-yMidAxis-tick {
- position: absolute;
- white-space: pre;
-}
-
-
-.jqplot-xaxis-tick {
- top: 0px;
- /* initial position untill tick is drawn in proper place */
- left: 15px;
-/* padding-top: 10px;*/
- vertical-align: top;
-}
-
-.jqplot-x2axis-tick {
- bottom: 0px;
- /* initial position untill tick is drawn in proper place */
- left: 15px;
-/* padding-bottom: 10px;*/
- vertical-align: bottom;
-}
-
-.jqplot-yaxis-tick {
- right: 0px;
- /* initial position untill tick is drawn in proper place */
- top: 15px;
-/* padding-right: 10px;*/
- text-align: right;
-}
-
-.jqplot-yaxis-tick.jqplot-breakTick {
- right: -20px;
- margin-right: 0px;
- padding:1px 5px 1px 5px;
-/* background-color: white;*/
- z-index: 2;
- font-size: 1.5em;
-}
-
-.jqplot-y2axis-tick, .jqplot-y3axis-tick, .jqplot-y4axis-tick, .jqplot-y5axis-tick, .jqplot-y6axis-tick, .jqplot-y7axis-tick, .jqplot-y8axis-tick, .jqplot-y9axis-tick {
- left: 0px;
- /* initial position untill tick is drawn in proper place */
- top: 15px;
-/* padding-left: 10px;*/
-/* padding-right: 15px;*/
- text-align: left;
-}
-
-.jqplot-yMidAxis-tick {
- text-align: center;
- white-space: nowrap;
-}
-
-.jqplot-xaxis-label {
- margin-top: 10px;
- font-size: 11pt;
- position: absolute;
-}
-
-.jqplot-x2axis-label {
- margin-bottom: 10px;
- font-size: 11pt;
- position: absolute;
-}
-
-.jqplot-yaxis-label {
- margin-right: 10px;
-/* text-align: center;*/
- font-size: 11pt;
- position: absolute;
-}
-
-.jqplot-yMidAxis-label {
- font-size: 11pt;
- position: absolute;
-}
-
-.jqplot-y2axis-label, .jqplot-y3axis-label, .jqplot-y4axis-label, .jqplot-y5axis-label, .jqplot-y6axis-label, .jqplot-y7axis-label, .jqplot-y8axis-label, .jqplot-y9axis-label {
-/* text-align: center;*/
- font-size: 11pt;
- margin-left: 10px;
- position: absolute;
-}
-
-.jqplot-meterGauge-tick {
- font-size: 0.75em;
- color: #999999;
-}
-
-.jqplot-meterGauge-label {
- font-size: 1em;
- color: #999999;
-}
-
-table.jqplot-table-legend {
- margin-top: 12px;
- margin-bottom: 12px;
- margin-left: 12px;
- margin-right: 12px;
-}
-
-table.jqplot-table-legend, table.jqplot-cursor-legend {
- background-color: rgba(255,255,255,0.6);
- border: 1px solid #cccccc;
- position: absolute;
- font-size: 0.75em;
-}
-
-td.jqplot-table-legend {
- vertical-align:middle;
-}
-
-/*
-These rules could be used instead of assigning
-element styles and relying on js object properties.
-*/
-
-/*
-td.jqplot-table-legend-swatch {
- padding-top: 0.5em;
- text-align: center;
-}
-
-tr.jqplot-table-legend:first td.jqplot-table-legend-swatch {
- padding-top: 0px;
-}
-*/
-
-td.jqplot-seriesToggle:hover, td.jqplot-seriesToggle:active {
- cursor: pointer;
-}
-
-.jqplot-table-legend .jqplot-series-hidden {
- text-decoration: line-through;
-}
-
-div.jqplot-table-legend-swatch-outline {
- border: 1px solid #cccccc;
- padding:1px;
-}
-
-div.jqplot-table-legend-swatch {
- width:0px;
- height:0px;
- border-top-width: 5px;
- border-bottom-width: 5px;
- border-left-width: 6px;
- border-right-width: 6px;
- border-top-style: solid;
- border-bottom-style: solid;
- border-left-style: solid;
- border-right-style: solid;
-}
-
-.jqplot-title {
- top: 0px;
- left: 0px;
- padding-bottom: 0.5em;
- font-size: 1.2em;
-}
-
-table.jqplot-cursor-tooltip {
- border: 1px solid #cccccc;
- font-size: 0.75em;
-}
-
-
-.jqplot-cursor-tooltip {
- border: 1px solid #cccccc;
- font-size: 0.75em;
- white-space: nowrap;
- background: rgba(208,208,208,0.5);
- padding: 1px;
-}
-
-.jqplot-highlighter-tooltip, .jqplot-canvasOverlay-tooltip {
- border: 1px solid #cccccc;
- font-size: 0.75em;
- white-space: nowrap;
- background: rgba(208,208,208,0.5);
- padding: 1px;
-}
-
-.jqplot-point-label {
- font-size: 0.75em;
- z-index: 2;
-}
-
-td.jqplot-cursor-legend-swatch {
- vertical-align: middle;
- text-align: center;
-}
-
-div.jqplot-cursor-legend-swatch {
- width: 1.2em;
- height: 0.7em;
-}
-
-.jqplot-error {
-/* Styles added to the plot target container when there is an error go here.*/
- text-align: center;
-}
-
-.jqplot-error-message {
-/* Styling of the custom error message div goes here.*/
- position: relative;
- top: 46%;
- display: inline-block;
-}
-
-div.jqplot-bubble-label {
- font-size: 0.8em;
-/* background: rgba(90%, 90%, 90%, 0.15);*/
- padding-left: 2px;
- padding-right: 2px;
- color: rgb(20%, 20%, 20%);
-}
-
-div.jqplot-bubble-label.jqplot-bubble-label-highlight {
- background: rgba(90%, 90%, 90%, 0.7);
-}
-
-div.jqplot-noData-container {
- text-align: center;
- background-color: rgba(96%, 96%, 96%, 0.3);
-}
diff --git a/libreplan-webapp/src/main/webapp/jqplot/jquery.jqplot.js b/libreplan-webapp/src/main/webapp/jqplot/jquery.jqplot.js
deleted file mode 100644
index 4c8347e2b..000000000
--- a/libreplan-webapp/src/main/webapp/jqplot/jquery.jqplot.js
+++ /dev/null
@@ -1,10900 +0,0 @@
-/**
- * Title: jqPlot Charts
- *
- * Pure JavaScript plotting plugin for jQuery.
- *
- * About: Version
- *
- * 1.0.0b2_r1012
- *
- * About: Copyright & License
- *
- * Copyright (c) 2009-2011 Chris Leonello
- * jqPlot is currently available for use in all personal or commercial projects
- * under both the MIT and GPL version 2.0 licenses. This means that you can
- * choose the license that best suits your project and use it accordingly.
- *
- * See and contained within this distribution for further information.
- *
- * The author would appreciate an email letting him know of any substantial
- * use of jqPlot. You can reach the author at: chris at jqplot dot com
- * or see http://www.jqplot.com/info.php. This is, of course, not required.
- *
- * If you are feeling kind and generous, consider supporting the project by
- * making a donation at: http://www.jqplot.com/donate.php.
- *
- * sprintf functions contained in jqplot.sprintf.js by Ash Searle:
- *
- * version 2007.04.27
- * author Ash Searle
- * http://hexmen.com/blog/2007/03/printf-sprintf/
- * http://hexmen.com/js/sprintf.js
- * The author (Ash Searle) has placed this code in the public domain:
- * "This code is unrestricted: you are free to use it however you like."
- *
- *
- * About: Introduction
- *
- * jqPlot requires jQuery (1.4+ required for certain features). jQuery 1.4.2 is included in the distribution.
- * To use jqPlot include jQuery, the jqPlot jQuery plugin, the jqPlot css file and optionally
- * the excanvas script for IE support in your web page:
- *
- * >
- * >
- * >
- * >
- *
- * jqPlot can be customized by overriding the defaults of any of the objects which make
- * up the plot. The general usage of jqplot is:
- *
- * > chart = $.jqplot('targetElemId', [dataArray,...], {optionsObject});
- *
- * The options available to jqplot are detailed in in the jqPlotOptions.txt file.
- *
- * An actual call to $.jqplot() may look like the
- * examples below:
- *
- * > chart = $.jqplot('chartdiv', [[[1, 2],[3,5.12],[5,13.1],[7,33.6],[9,85.9],[11,219.9]]]);
- *
- * or
- *
- * > dataArray = [34,12,43,55,77];
- * > chart = $.jqplot('targetElemId', [dataArray, ...], {title:'My Plot', axes:{yaxis:{min:20, max:100}}});
- *
- * For more inforrmation, see .
- *
- * About: Usage
- *
- * See
- *
- * About: Available Options
- *
- * See for a list of options available thorugh the options object (not complete yet!)
- *
- * About: Options Usage
- *
- * See
- *
- * About: Changes
- *
- * See
- *
- */
-
-(function($) {
- // make sure undefined is undefined
- var undefined;
-
- $.fn.emptyForce = function() {
- for ( var i = 0, elem; (elem = $(this)[i]) != null; i++ ) {
- // Remove element nodes and prevent memory leaks
- if ( elem.nodeType === 1 ) {
- jQuery.cleanData( elem.getElementsByTagName("*") );
- }
-
- // Remove any remaining nodes
- if ($.jqplot_use_excanvas) {
- elem.outerHTML = "";
- }
- else {
- while ( elem.firstChild ) {
- elem.removeChild( elem.firstChild );
- }
- }
-
- elem = null;
- }
-
- return $(this);
- };
-
- $.fn.removeChildForce = function(parent) {
- while ( parent.firstChild ) {
- this.removeChildForce( parent.firstChild );
- parent.removeChild( parent.firstChild );
- }
- };
-
-
- /**
- * Namespace: $.jqplot
- * jQuery function called by the user to create a plot.
- *
- * Parameters:
- * target - ID of target element to render the plot into.
- * data - an array of data series.
- * options - user defined options object. See the individual classes for available options.
- *
- * Properties:
- * config - object to hold configuration information for jqPlot plot object.
- *
- * attributes:
- * enablePlugins - False to disable plugins by default. Plugins must then be explicitly
- * enabled in the individual plot options. Default: false.
- * This property sets the "show" property of certain plugins to true or false.
- * Only plugins that can be immediately active upon loading are affected. This includes
- * non-renderer plugins like cursor, dragable, highlighter, and trendline.
- * defaultHeight - Default height for plots where no css height specification exists. This
- * is a jqplot wide default.
- * defaultWidth - Default height for plots where no css height specification exists. This
- * is a jqplot wide default.
- */
-
- $.jqplot = function(target, data, options) {
- var _data, _options;
-
- if (options == null) {
- if (jQuery.isArray(data)) {
- _data = data;
- _options = null;
- }
-
- else if (typeof(data) === 'object') {
- _data = null;
- _options = data;
- }
- }
- else {
- _data = data;
- _options = options;
- }
- var plot = new jqPlot();
- // remove any error class that may be stuck on target.
- $('#'+target).removeClass('jqplot-error');
-
- if ($.jqplot.config.catchErrors) {
- try {
- plot.init(target, _data, _options);
- plot.draw();
- plot.themeEngine.init.call(plot);
- return plot;
- }
- catch(e) {
- var msg = $.jqplot.config.errorMessage || e.message;
- $('#'+target).append(''+msg+'
');
- $('#'+target).addClass('jqplot-error');
- document.getElementById(target).style.background = $.jqplot.config.errorBackground;
- document.getElementById(target).style.border = $.jqplot.config.errorBorder;
- document.getElementById(target).style.fontFamily = $.jqplot.config.errorFontFamily;
- document.getElementById(target).style.fontSize = $.jqplot.config.errorFontSize;
- document.getElementById(target).style.fontStyle = $.jqplot.config.errorFontStyle;
- document.getElementById(target).style.fontWeight = $.jqplot.config.errorFontWeight;
- }
- }
- else {
- plot.init(target, _data, _options);
- plot.draw();
- plot.themeEngine.init.call(plot);
- return plot;
- }
- };
-
- $.jqplot.version = "1.0.0b2_r1012";
-
- // canvas manager to reuse canvases on the plot.
- // Should help solve problem of canvases not being freed and
- // problem of waiting forever for firefox to decide to free memory.
- $.jqplot.CanvasManager = function() {
- // canvases are managed globally so that they can be reused
- // across plots after they have been freed
- if (typeof $.jqplot.CanvasManager.canvases == 'undefined') {
- $.jqplot.CanvasManager.canvases = [];
- $.jqplot.CanvasManager.free = [];
- }
-
- var myCanvases = [];
-
- this.getCanvas = function() {
- var canvas;
- var makeNew = true;
-
- if (!$.jqplot.use_excanvas) {
- for (var i = 0, l = $.jqplot.CanvasManager.canvases.length; i < l; i++) {
- if ($.jqplot.CanvasManager.free[i] === true) {
- makeNew = false;
- canvas = $.jqplot.CanvasManager.canvases[i];
- // $(canvas).removeClass('jqplot-canvasManager-free').addClass('jqplot-canvasManager-inuse');
- $.jqplot.CanvasManager.free[i] = false;
- myCanvases.push(i);
- break;
- }
- }
- }
-
- if (makeNew) {
- canvas = document.createElement('canvas');
- myCanvases.push($.jqplot.CanvasManager.canvases.length);
- $.jqplot.CanvasManager.canvases.push(canvas);
- $.jqplot.CanvasManager.free.push(false);
- }
-
- return canvas;
- };
-
- // this method has to be used after settings the dimesions
- // on the element returned by getCanvas()
- this.initCanvas = function(canvas) {
- if ($.jqplot.use_excanvas) {
- return window.G_vmlCanvasManager.initElement(canvas);
- }
- return canvas;
- };
-
- this.freeAllCanvases = function() {
- for (var i = 0, l=myCanvases.length; i < l; i++) {
- this.freeCanvas(myCanvases[i]);
- }
- myCanvases = [];
- };
-
- this.freeCanvas = function(idx) {
- if ($.jqplot.use_excanvas && window.G_vmlCanvasManager.uninitElement !== undefined) {
- // excanvas can't be reused, but properly unset
- window.G_vmlCanvasManager.uninitElement($.jqplot.CanvasManager.canvases[idx]);
- $.jqplot.CanvasManager.canvases[idx] = null;
- }
- else {
- var canvas = $.jqplot.CanvasManager.canvases[idx];
- canvas.getContext('2d').clearRect(0, 0, canvas.width, canvas.height);
- $(canvas).unbind().removeAttr('class').removeAttr('style');
- // Style attributes seemed to be still hanging around. wierd. Some ticks
- // still retained a left: 0px attribute after reusing a canvas.
- $(canvas).css({left: '', top: '', position: ''});
- // setting size to 0 may save memory of unused canvases?
- canvas.width = 0;
- canvas.height = 0;
- $.jqplot.CanvasManager.free[idx] = true;
- }
- };
-
- };
-
-
- // Convienence function that won't hang IE or FF without FireBug.
- $.jqplot.log = function() {
- if (window.console) {
- window.console.log.apply(window.console, arguments);
- }
- };
-
- $.jqplot.config = {
- addDomReference: false,
- enablePlugins:false,
- defaultHeight:300,
- defaultWidth:400,
- UTCAdjust:false,
- timezoneOffset: new Date(new Date().getTimezoneOffset() * 60000),
- errorMessage: '',
- errorBackground: '',
- errorBorder: '',
- errorFontFamily: '',
- errorFontSize: '',
- errorFontStyle: '',
- errorFontWeight: '',
- catchErrors: false,
- defaultTickFormatString: "%.1f",
- defaultColors: [ "#4bb2c5", "#EAA228", "#c5b47f", "#579575", "#839557", "#958c12", "#953579", "#4b5de4", "#d8b83f", "#ff5800", "#0085cc", "#c747a3", "#cddf54", "#FBD178", "#26B4E3", "#bd70c7"],
- defaultNegativeColors: [ "#498991", "#C08840", "#9F9274", "#546D61", "#646C4A", "#6F6621", "#6E3F5F", "#4F64B0", "#A89050", "#C45923", "#187399", "#945381", "#959E5C", "#C7AF7B", "#478396", "#907294"],
- dashLength: 4,
- gapLength: 4,
- dotGapLength: 2.5,
- srcLocation: 'jqplot/src/',
- pluginLocation: 'jqplot/src/plugins/'
- };
-
-
- $.jqplot.arrayMax = function( array ){
- return Math.max.apply( Math, array );
- };
-
- $.jqplot.arrayMin = function( array ){
- return Math.min.apply( Math, array );
- };
-
- $.jqplot.enablePlugins = $.jqplot.config.enablePlugins;
-
- // canvas related tests taken from modernizer:
- // Copyright (c) 2009 - 2010 Faruk Ates.
- // http://www.modernizr.com
-
- $.jqplot.support_canvas = function() {
- if (typeof $.jqplot.support_canvas.result == 'undefined') {
- $.jqplot.support_canvas.result = !!document.createElement('canvas').getContext;
- }
- return $.jqplot.support_canvas.result;
- };
-
- $.jqplot.support_canvas_text = function() {
- if (typeof $.jqplot.support_canvas_text.result == 'undefined') {
- if (window.G_vmlCanvasManager !== undefined && window.G_vmlCanvasManager._version > 887) {
- $.jqplot.support_canvas_text.result = true;
- }
- else {
- $.jqplot.support_canvas_text.result = !!(document.createElement('canvas').getContext && typeof document.createElement('canvas').getContext('2d').fillText == 'function');
- }
-
- }
- return $.jqplot.support_canvas_text.result;
- };
-
- $.jqplot.use_excanvas = ($.browser.msie && !$.jqplot.support_canvas()) ? true : false;
-
- /**
- *
- * Hooks: jqPlot Pugin Hooks
- *
- * $.jqplot.preInitHooks - called before initialization.
- * $.jqplot.postInitHooks - called after initialization.
- * $.jqplot.preParseOptionsHooks - called before user options are parsed.
- * $.jqplot.postParseOptionsHooks - called after user options are parsed.
- * $.jqplot.preDrawHooks - called before plot draw.
- * $.jqplot.postDrawHooks - called after plot draw.
- * $.jqplot.preDrawSeriesHooks - called before each series is drawn.
- * $.jqplot.postDrawSeriesHooks - called after each series is drawn.
- * $.jqplot.preDrawLegendHooks - called before the legend is drawn.
- * $.jqplot.addLegendRowHooks - called at the end of legend draw, so plugins
- * can add rows to the legend table.
- * $.jqplot.preSeriesInitHooks - called before series is initialized.
- * $.jqplot.postSeriesInitHooks - called after series is initialized.
- * $.jqplot.preParseSeriesOptionsHooks - called before series related options
- * are parsed.
- * $.jqplot.postParseSeriesOptionsHooks - called after series related options
- * are parsed.
- * $.jqplot.eventListenerHooks - called at the end of plot drawing, binds
- * listeners to the event canvas which lays on top of the grid area.
- * $.jqplot.preDrawSeriesShadowHooks - called before series shadows are drawn.
- * $.jqplot.postDrawSeriesShadowHooks - called after series shadows are drawn.
- *
- */
-
- $.jqplot.preInitHooks = [];
- $.jqplot.postInitHooks = [];
- $.jqplot.preParseOptionsHooks = [];
- $.jqplot.postParseOptionsHooks = [];
- $.jqplot.preDrawHooks = [];
- $.jqplot.postDrawHooks = [];
- $.jqplot.preDrawSeriesHooks = [];
- $.jqplot.postDrawSeriesHooks = [];
- $.jqplot.preDrawLegendHooks = [];
- $.jqplot.addLegendRowHooks = [];
- $.jqplot.preSeriesInitHooks = [];
- $.jqplot.postSeriesInitHooks = [];
- $.jqplot.preParseSeriesOptionsHooks = [];
- $.jqplot.postParseSeriesOptionsHooks = [];
- $.jqplot.eventListenerHooks = [];
- $.jqplot.preDrawSeriesShadowHooks = [];
- $.jqplot.postDrawSeriesShadowHooks = [];
-
- // A superclass holding some common properties and methods.
- $.jqplot.ElemContainer = function() {
- this._elem;
- this._plotWidth;
- this._plotHeight;
- this._plotDimensions = {height:null, width:null};
- };
-
- $.jqplot.ElemContainer.prototype.createElement = function(el, offsets, clss, cssopts, attrib) {
- this._offsets = offsets;
- var klass = clss || 'jqplot';
- var elem = document.createElement(el);
- this._elem = $(elem);
- this._elem.addClass(klass);
- this._elem.css(cssopts);
- this._elem.attr(attrib);
- // avoid memory leak;
- elem = null;
- return this._elem;
- };
-
- $.jqplot.ElemContainer.prototype.getWidth = function() {
- if (this._elem) {
- return this._elem.outerWidth(true);
- }
- else {
- return null;
- }
- };
-
- $.jqplot.ElemContainer.prototype.getHeight = function() {
- if (this._elem) {
- return this._elem.outerHeight(true);
- }
- else {
- return null;
- }
- };
-
- $.jqplot.ElemContainer.prototype.getPosition = function() {
- if (this._elem) {
- return this._elem.position();
- }
- else {
- return {top:null, left:null, bottom:null, right:null};
- }
- };
-
- $.jqplot.ElemContainer.prototype.getTop = function() {
- return this.getPosition().top;
- };
-
- $.jqplot.ElemContainer.prototype.getLeft = function() {
- return this.getPosition().left;
- };
-
- $.jqplot.ElemContainer.prototype.getBottom = function() {
- return this._elem.css('bottom');
- };
-
- $.jqplot.ElemContainer.prototype.getRight = function() {
- return this._elem.css('right');
- };
-
-
- /**
- * Class: Axis
- * An individual axis object. Cannot be instantiated directly, but created
- * by the Plot oject. Axis properties can be set or overriden by the
- * options passed in from the user.
- *
- */
- function Axis(name) {
- $.jqplot.ElemContainer.call(this);
- // Group: Properties
- //
- // Axes options are specified within an axes object at the top level of the
- // plot options like so:
- // > {
- // > axes: {
- // > xaxis: {min: 5},
- // > yaxis: {min: 2, max: 8, numberTicks:4},
- // > x2axis: {pad: 1.5},
- // > y2axis: {ticks:[22, 44, 66, 88]}
- // > }
- // > }
- // There are 2 x axes, 'xaxis' and 'x2axis', and
- // 9 yaxes, 'yaxis', 'y2axis'. 'y3axis', ... Any or all of which may be specified.
- this.name = name;
- this._series = [];
- // prop: show
- // Wether to display the axis on the graph.
- this.show = false;
- // prop: tickRenderer
- // A class of a rendering engine for creating the ticks labels displayed on the plot,
- // See <$.jqplot.AxisTickRenderer>.
- this.tickRenderer = $.jqplot.AxisTickRenderer;
- // prop: tickOptions
- // Options that will be passed to the tickRenderer, see <$.jqplot.AxisTickRenderer> options.
- this.tickOptions = {};
- // prop: labelRenderer
- // A class of a rendering engine for creating an axis label.
- this.labelRenderer = $.jqplot.AxisLabelRenderer;
- // prop: labelOptions
- // Options passed to the label renderer.
- this.labelOptions = {};
- // prop: label
- // Label for the axis
- this.label = null;
- // prop: showLabel
- // true to show the axis label.
- this.showLabel = true;
- // prop: min
- // minimum value of the axis (in data units, not pixels).
- this.min = null;
- // prop: max
- // maximum value of the axis (in data units, not pixels).
- this.max = null;
- // prop: autoscale
- // DEPRECATED
- // the default scaling algorithm produces superior results.
- this.autoscale = false;
- // prop: pad
- // Padding to extend the range above and below the data bounds.
- // The data range is multiplied by this factor to determine minimum and maximum axis bounds.
- // A value of 0 will be interpreted to mean no padding, and pad will be set to 1.0.
- this.pad = 1.2;
- // prop: padMax
- // Padding to extend the range above data bounds.
- // The top of the data range is multiplied by this factor to determine maximum axis bounds.
- // A value of 0 will be interpreted to mean no padding, and padMax will be set to 1.0.
- this.padMax = null;
- // prop: padMin
- // Padding to extend the range below data bounds.
- // The bottom of the data range is multiplied by this factor to determine minimum axis bounds.
- // A value of 0 will be interpreted to mean no padding, and padMin will be set to 1.0.
- this.padMin = null;
- // prop: ticks
- // 1D [val, val, ...] or 2D [[val, label], [val, label], ...] array of ticks for the axis.
- // If no label is specified, the value is formatted into an appropriate label.
- this.ticks = [];
- // prop: numberTicks
- // Desired number of ticks. Default is to compute automatically.
- this.numberTicks;
- // prop: tickInterval
- // number of units between ticks. Mutually exclusive with numberTicks.
- this.tickInterval;
- // prop: renderer
- // A class of a rendering engine that handles tick generation,
- // scaling input data to pixel grid units and drawing the axis element.
- this.renderer = $.jqplot.LinearAxisRenderer;
- // prop: rendererOptions
- // renderer specific options. See <$.jqplot.LinearAxisRenderer> for options.
- this.rendererOptions = {};
- // prop: showTicks
- // Wether to show the ticks (both marks and labels) or not.
- // Will not override showMark and showLabel options if specified on the ticks themselves.
- this.showTicks = true;
- // prop: showTickMarks
- // Wether to show the tick marks (line crossing grid) or not.
- // Overridden by showTicks and showMark option of tick itself.
- this.showTickMarks = true;
- // prop: showMinorTicks
- // Wether or not to show minor ticks. This is renderer dependent.
- this.showMinorTicks = true;
- // prop: drawMajorGridlines
- // True to draw gridlines for major axis ticks.
- this.drawMajorGridlines = true;
- // prop: drawMinorGridlines
- // True to draw gridlines for minor ticks.
- this.drawMinorGridlines = false;
- // prop: drawMajorTickMarks
- // True to draw tick marks for major axis ticks.
- this.drawMajorTickMarks = true;
- // prop: drawMinorTickMarks
- // True to draw tick marks for minor ticks. This is renderer dependent.
- this.drawMinorTickMarks = true;
- // prop: useSeriesColor
- // Use the color of the first series associated with this axis for the
- // tick marks and line bordering this axis.
- this.useSeriesColor = false;
- // prop: borderWidth
- // width of line stroked at the border of the axis. Defaults
- // to the width of the grid boarder.
- this.borderWidth = null;
- // prop: borderColor
- // color of the border adjacent to the axis. Defaults to grid border color.
- this.borderColor = null;
- // minimum and maximum values on the axis.
- this._dataBounds = {min:null, max:null};
- // statistics (min, max, mean) as well as actual data intervals for each series attached to axis.
- // holds collection of {intervals:[], min:, max:, mean: } objects for each series on axis.
- this._intervalStats = [];
- // pixel position from the top left of the min value and max value on the axis.
- this._offsets = {min:null, max:null};
- this._ticks=[];
- this._label = null;
- // prop: syncTicks
- // true to try and synchronize tick spacing across multiple axes so that ticks and
- // grid lines line up. This has an impact on autoscaling algorithm, however.
- // In general, autoscaling an individual axis will work better if it does not
- // have to sync ticks.
- this.syncTicks = null;
- // prop: tickSpacing
- // Approximate pixel spacing between ticks on graph. Used during autoscaling.
- // This number will be an upper bound, actual spacing will be less.
- this.tickSpacing = 75;
- // Properties to hold the original values for min, max, ticks, tickInterval and numberTicks
- // so they can be restored if altered by plugins.
- this._min = null;
- this._max = null;
- this._tickInterval = null;
- this._numberTicks = null;
- this.__ticks = null;
- // hold original user options.
- this._options = {};
- }
-
- Axis.prototype = new $.jqplot.ElemContainer();
- Axis.prototype.constructor = Axis;
-
- Axis.prototype.init = function() {
- this.renderer = new this.renderer();
- // set the axis name
- this.tickOptions.axis = this.name;
- // if showMark or showLabel tick options not specified, use value of axis option.
- // showTicks overrides showTickMarks.
- if (this.tickOptions.showMark == null) {
- this.tickOptions.showMark = this.showTicks;
- }
- if (this.tickOptions.showMark == null) {
- this.tickOptions.showMark = this.showTickMarks;
- }
- if (this.tickOptions.showLabel == null) {
- this.tickOptions.showLabel = this.showTicks;
- }
-
- if (this.label == null || this.label == '') {
- this.showLabel = false;
- }
- else {
- this.labelOptions.label = this.label;
- }
- if (this.showLabel == false) {
- this.labelOptions.show = false;
- }
- // set the default padMax, padMin if not specified
- // special check, if no padding desired, padding
- // should be set to 1.0
- if (this.pad == 0) {
- this.pad = 1.0;
- }
- if (this.padMax == 0) {
- this.padMax = 1.0;
- }
- if (this.padMin == 0) {
- this.padMin = 1.0;
- }
- if (this.padMax == null) {
- this.padMax = (this.pad-1)/2 + 1;
- }
- if (this.padMin == null) {
- this.padMin = (this.pad-1)/2 + 1;
- }
- // now that padMin and padMax are correctly set, reset pad in case user has supplied
- // padMin and/or padMax
- this.pad = this.padMax + this.padMin - 1;
- if (this.min != null || this.max != null) {
- this.autoscale = false;
- }
- // if not set, sync ticks for y axes but not x by default.
- if (this.syncTicks == null && this.name.indexOf('y') > -1) {
- this.syncTicks = true;
- }
- else if (this.syncTicks == null){
- this.syncTicks = false;
- }
- this.renderer.init.call(this, this.rendererOptions);
-
- };
-
- Axis.prototype.draw = function(ctx, plot) {
- // Memory Leaks patch
- if (this.__ticks) {
- this.__ticks = null;
- }
-
- return this.renderer.draw.call(this, ctx, plot);
-
- };
-
- Axis.prototype.set = function() {
- this.renderer.set.call(this);
- };
-
- Axis.prototype.pack = function(pos, offsets) {
- if (this.show) {
- this.renderer.pack.call(this, pos, offsets);
- }
- // these properties should all be available now.
- if (this._min == null) {
- this._min = this.min;
- this._max = this.max;
- this._tickInterval = this.tickInterval;
- this._numberTicks = this.numberTicks;
- this.__ticks = this._ticks;
- }
- };
-
- // reset the axis back to original values if it has been scaled, zoomed, etc.
- Axis.prototype.reset = function() {
- this.renderer.reset.call(this);
- };
-
- Axis.prototype.resetScale = function(opts) {
- $.extend(true, this, {min: null, max: null, numberTicks: null, tickInterval: null, _ticks: [], ticks: []}, opts);
- this.resetDataBounds();
- };
-
- Axis.prototype.resetDataBounds = function() {
- // Go through all the series attached to this axis and find
- // the min/max bounds for this axis.
- var db = this._dataBounds;
- db.min = null;
- db.max = null;
- var l, s, d;
- // check for when to force min 0 on bar series plots.
- var doforce = (this.show) ? true : false;
- for (var i=0; i db.max) || db.max == null) {
- db.max = d[j][0];
- }
- }
- else {
- if ((d[j][minyidx] != null && d[j][minyidx] < db.min) || db.min == null) {
- db.min = d[j][minyidx];
- }
- if ((d[j][maxyidx] != null && d[j][maxyidx] > db.max) || db.max == null) {
- db.max = d[j][maxyidx];
- }
- }
- }
-
- // Hack to not pad out bottom of bar plots unless user has specified a padding.
- // every series will have a chance to set doforce to false. once it is set to
- // false, it cannot be reset to true.
- // If any series attached to axis is not a bar, wont force 0.
- if (doforce && s.renderer.constructor !== $.jqplot.BarRenderer) {
- doforce = false;
- }
-
- else if (doforce && this._options.hasOwnProperty('forceTickAt0') && this._options.forceTickAt0 == false) {
- doforce = false;
- }
-
- else if (doforce && s.renderer.constructor === $.jqplot.BarRenderer) {
- if (s.barDirection == 'vertical' && this.name != 'xaxis' && this.name != 'x2axis') {
- if (this._options.pad != null || this._options.padMin != null) {
- doforce = false;
- }
- }
-
- else if (s.barDirection == 'horizontal' && (this.name == 'xaxis' || this.name == 'x2axis')) {
- if (this._options.pad != null || this._options.padMin != null) {
- doforce = false;
- }
- }
-
- }
- }
- }
-
- if (doforce && this.renderer.constructor === $.jqplot.LinearAxisRenderer && db.min >= 0) {
- this.padMin = 1.0;
- this.forceTickAt0 = true;
- }
- };
-
- /**
- * Class: Legend
- * Legend object. Cannot be instantiated directly, but created
- * by the Plot oject. Legend properties can be set or overriden by the
- * options passed in from the user.
- */
- function Legend(options) {
- $.jqplot.ElemContainer.call(this);
- // Group: Properties
-
- // prop: show
- // Wether to display the legend on the graph.
- this.show = false;
- // prop: location
- // Placement of the legend. one of the compass directions: nw, n, ne, e, se, s, sw, w
- this.location = 'ne';
- // prop: labels
- // Array of labels to use. By default the renderer will look for labels on the series.
- // Labels specified in this array will override labels specified on the series.
- this.labels = [];
- // prop: showLabels
- // true to show the label text on the legend.
- this.showLabels = true;
- // prop: showSwatch
- // true to show the color swatches on the legend.
- this.showSwatches = true;
- // prop: placement
- // "insideGrid" places legend inside the grid area of the plot.
- // "outsideGrid" places the legend outside the grid but inside the plot container,
- // shrinking the grid to accomodate the legend.
- // "inside" synonym for "insideGrid",
- // "outside" places the legend ouside the grid area, but does not shrink the grid which
- // can cause the legend to overflow the plot container.
- this.placement = "insideGrid";
- // prop: xoffset
- // DEPRECATED. Set the margins on the legend using the marginTop, marginLeft, etc.
- // properties or via CSS margin styling of the .jqplot-table-legend class.
- this.xoffset = 0;
- // prop: yoffset
- // DEPRECATED. Set the margins on the legend using the marginTop, marginLeft, etc.
- // properties or via CSS margin styling of the .jqplot-table-legend class.
- this.yoffset = 0;
- // prop: border
- // css spec for the border around the legend box.
- this.border;
- // prop: background
- // css spec for the background of the legend box.
- this.background;
- // prop: textColor
- // css color spec for the legend text.
- this.textColor;
- // prop: fontFamily
- // css font-family spec for the legend text.
- this.fontFamily;
- // prop: fontSize
- // css font-size spec for the legend text.
- this.fontSize ;
- // prop: rowSpacing
- // css padding-top spec for the rows in the legend.
- this.rowSpacing = '0.5em';
- // renderer
- // A class that will create a DOM object for the legend,
- // see <$.jqplot.TableLegendRenderer>.
- this.renderer = $.jqplot.TableLegendRenderer;
- // prop: rendererOptions
- // renderer specific options passed to the renderer.
- this.rendererOptions = {};
- // prop: predraw
- // Wether to draw the legend before the series or not.
- // Used with series specific legend renderers for pie, donut, mekko charts, etc.
- this.preDraw = false;
- // prop: marginTop
- // CSS margin for the legend DOM element. This will set an element
- // CSS style for the margin which will override any style sheet setting.
- // The default will be taken from the stylesheet.
- this.marginTop = null;
- // prop: marginRight
- // CSS margin for the legend DOM element. This will set an element
- // CSS style for the margin which will override any style sheet setting.
- // The default will be taken from the stylesheet.
- this.marginRight = null;
- // prop: marginBottom
- // CSS margin for the legend DOM element. This will set an element
- // CSS style for the margin which will override any style sheet setting.
- // The default will be taken from the stylesheet.
- this.marginBottom = null;
- // prop: marginLeft
- // CSS margin for the legend DOM element. This will set an element
- // CSS style for the margin which will override any style sheet setting.
- // The default will be taken from the stylesheet.
- this.marginLeft = null;
- // prop: escapeHtml
- // True to escape special characters with their html entity equivalents
- // in legend text. "<" becomes < and so on, so html tags are not rendered.
- this.escapeHtml = false;
- this._series = [];
-
- $.extend(true, this, options);
- }
-
- Legend.prototype = new $.jqplot.ElemContainer();
- Legend.prototype.constructor = Legend;
-
- Legend.prototype.setOptions = function(options) {
- $.extend(true, this, options);
-
- // Try to emulate deprecated behaviour
- // if user has specified xoffset or yoffset, copy these to
- // the margin properties.
-
- if (this.placement == 'inside') {
- this.placement = 'insideGrid';
- }
-
- if (this.xoffset >0) {
- if (this.placement == 'insideGrid') {
- switch (this.location) {
- case 'nw':
- case 'w':
- case 'sw':
- if (this.marginLeft == null) {
- this.marginLeft = this.xoffset + 'px';
- }
- this.marginRight = '0px';
- break;
- case 'ne':
- case 'e':
- case 'se':
- default:
- if (this.marginRight == null) {
- this.marginRight = this.xoffset + 'px';
- }
- this.marginLeft = '0px';
- break;
- }
- }
- else if (this.placement == 'outside') {
- switch (this.location) {
- case 'nw':
- case 'w':
- case 'sw':
- if (this.marginRight == null) {
- this.marginRight = this.xoffset + 'px';
- }
- this.marginLeft = '0px';
- break;
- case 'ne':
- case 'e':
- case 'se':
- default:
- if (this.marginLeft == null) {
- this.marginLeft = this.xoffset + 'px';
- }
- this.marginRight = '0px';
- break;
- }
- }
- this.xoffset = 0;
- }
-
- if (this.yoffset >0) {
- if (this.placement == 'outside') {
- switch (this.location) {
- case 'sw':
- case 's':
- case 'se':
- if (this.marginTop == null) {
- this.marginTop = this.yoffset + 'px';
- }
- this.marginBottom = '0px';
- break;
- case 'ne':
- case 'n':
- case 'nw':
- default:
- if (this.marginBottom == null) {
- this.marginBottom = this.yoffset + 'px';
- }
- this.marginTop = '0px';
- break;
- }
- }
- else if (this.placement == 'insideGrid') {
- switch (this.location) {
- case 'sw':
- case 's':
- case 'se':
- if (this.marginBottom == null) {
- this.marginBottom = this.yoffset + 'px';
- }
- this.marginTop = '0px';
- break;
- case 'ne':
- case 'n':
- case 'nw':
- default:
- if (this.marginTop == null) {
- this.marginTop = this.yoffset + 'px';
- }
- this.marginBottom = '0px';
- break;
- }
- }
- this.yoffset = 0;
- }
-
- // TO-DO:
- // Handle case where offsets are < 0.
- //
- };
-
- Legend.prototype.init = function() {
- this.renderer = new this.renderer();
- this.renderer.init.call(this, this.rendererOptions);
- };
-
- Legend.prototype.draw = function(offsets) {
- for (var i=0; i<$.jqplot.preDrawLegendHooks.length; i++){
- $.jqplot.preDrawLegendHooks[i].call(this, offsets);
- }
- return this.renderer.draw.call(this, offsets);
- };
-
- Legend.prototype.pack = function(offsets) {
- this.renderer.pack.call(this, offsets);
- };
-
- /**
- * Class: Title
- * Plot Title object. Cannot be instantiated directly, but created
- * by the Plot oject. Title properties can be set or overriden by the
- * options passed in from the user.
- *
- * Parameters:
- * text - text of the title.
- */
- function Title(text) {
- $.jqplot.ElemContainer.call(this);
- // Group: Properties
-
- // prop: text
- // text of the title;
- this.text = text;
- // prop: show
- // wether or not to show the title
- this.show = true;
- // prop: fontFamily
- // css font-family spec for the text.
- this.fontFamily;
- // prop: fontSize
- // css font-size spec for the text.
- this.fontSize ;
- // prop: textAlign
- // css text-align spec for the text.
- this.textAlign;
- // prop: textColor
- // css color spec for the text.
- this.textColor;
- // prop: renderer
- // A class for creating a DOM element for the title,
- // see <$.jqplot.DivTitleRenderer>.
- this.renderer = $.jqplot.DivTitleRenderer;
- // prop: rendererOptions
- // renderer specific options passed to the renderer.
- this.rendererOptions = {};
- // prop: escapeHtml
- // True to escape special characters with their html entity equivalents
- // in title text. "<" becomes < and so on, so html tags are not rendered.
- this.escapeHtml = false;
- }
-
- Title.prototype = new $.jqplot.ElemContainer();
- Title.prototype.constructor = Title;
-
- Title.prototype.init = function() {
- this.renderer = new this.renderer();
- this.renderer.init.call(this, this.rendererOptions);
- };
-
- Title.prototype.draw = function(width) {
- return this.renderer.draw.call(this, width);
- };
-
- Title.prototype.pack = function() {
- this.renderer.pack.call(this);
- };
-
-
- /**
- * Class: Series
- * An individual data series object. Cannot be instantiated directly, but created
- * by the Plot oject. Series properties can be set or overriden by the
- * options passed in from the user.
- */
- function Series() {
- $.jqplot.ElemContainer.call(this);
- // Group: Properties
- // Properties will be assigned from a series array at the top level of the
- // options. If you had two series and wanted to change the color and line
- // width of the first and set the second to use the secondary y axis with
- // no shadow and supply custom labels for each:
- // > {
- // > series:[
- // > {color: '#ff4466', lineWidth: 5, label:'good line'},
- // > {yaxis: 'y2axis', shadow: false, label:'bad line'}
- // > ]
- // > }
-
- // prop: show
- // wether or not to draw the series.
- this.show = true;
- // prop: xaxis
- // which x axis to use with this series, either 'xaxis' or 'x2axis'.
- this.xaxis = 'xaxis';
- this._xaxis;
- // prop: yaxis
- // which y axis to use with this series, either 'yaxis' or 'y2axis'.
- this.yaxis = 'yaxis';
- this._yaxis;
- this.gridBorderWidth = 2.0;
- // prop: renderer
- // A class of a renderer which will draw the series,
- // see <$.jqplot.LineRenderer>.
- this.renderer = $.jqplot.LineRenderer;
- // prop: rendererOptions
- // Options to pass on to the renderer.
- this.rendererOptions = {};
- this.data = [];
- this.gridData = [];
- // prop: label
- // Line label to use in the legend.
- this.label = '';
- // prop: showLabel
- // true to show label for this series in the legend.
- this.showLabel = true;
- // prop: color
- // css color spec for the series
- this.color;
- // prop: negativeColor
- // css color spec used for filled (area) plots that are filled to zero and
- // the "useNegativeColors" option is true.
- this.negativeColor;
- // prop: lineWidth
- // width of the line in pixels. May have different meanings depending on renderer.
- this.lineWidth = 2.5;
- // prop: lineJoin
- // Canvas lineJoin style between segments of series.
- this.lineJoin = 'round';
- // prop: lineCap
- // Canvas lineCap style at ends of line.
- this.lineCap = 'round';
- // prop: linePattern
- // line pattern 'dashed', 'dotted', 'solid', some combination
- // of '-' and '.' characters such as '.-.' or a numerical array like
- // [draw, skip, draw, skip, ...] such as [1, 10] to draw a dotted line,
- // [1, 10, 20, 10] to draw a dot-dash line, and so on.
- this.linePattern = 'solid';
- this.shadow = true;
- // prop: shadowAngle
- // Shadow angle in degrees
- this.shadowAngle = 45;
- // prop: shadowOffset
- // Shadow offset from line in pixels
- this.shadowOffset = 1.25;
- // prop: shadowDepth
- // Number of times shadow is stroked, each stroke offset shadowOffset from the last.
- this.shadowDepth = 3;
- // prop: shadowAlpha
- // Alpha channel transparency of shadow. 0 = transparent.
- this.shadowAlpha = '0.1';
- // prop: breakOnNull
- // Wether line segments should be be broken at null value.
- // False will join point on either side of line.
- this.breakOnNull = false;
- // prop: markerRenderer
- // A class of a renderer which will draw marker (e.g. circle, square, ...) at the data points,
- // see <$.jqplot.MarkerRenderer>.
- this.markerRenderer = $.jqplot.MarkerRenderer;
- // prop: markerOptions
- // renderer specific options to pass to the markerRenderer,
- // see <$.jqplot.MarkerRenderer>.
- this.markerOptions = {};
- // prop: showLine
- // wether to actually draw the line or not. Series will still be renderered, even if no line is drawn.
- this.showLine = true;
- // prop: showMarker
- // wether or not to show the markers at the data points.
- this.showMarker = true;
- // prop: index
- // 0 based index of this series in the plot series array.
- this.index;
- // prop: fill
- // true or false, wether to fill under lines or in bars.
- // May not be implemented in all renderers.
- this.fill = false;
- // prop: fillColor
- // CSS color spec to use for fill under line. Defaults to line color.
- this.fillColor;
- // prop: fillAlpha
- // Alpha transparency to apply to the fill under the line.
- // Use this to adjust alpha separate from fill color.
- this.fillAlpha;
- // prop: fillAndStroke
- // If true will stroke the line (with color this.color) as well as fill under it.
- // Applies only when fill is true.
- this.fillAndStroke = false;
- // prop: disableStack
- // true to not stack this series with other series in the plot.
- // To render properly, non-stacked series must come after any stacked series
- // in the plot's data series array. So, the plot's data series array would look like:
- // > [stackedSeries1, stackedSeries2, ..., nonStackedSeries1, nonStackedSeries2, ...]
- // disableStack will put a gap in the stacking order of series, and subsequent
- // stacked series will not fill down through the non-stacked series and will
- // most likely not stack properly on top of the non-stacked series.
- this.disableStack = false;
- // _stack is set by the Plot if the plot is a stacked chart.
- // will stack lines or bars on top of one another to build a "mountain" style chart.
- // May not be implemented in all renderers.
- this._stack = false;
- // prop: neighborThreshold
- // how close or far (in pixels) the cursor must be from a point marker to detect the point.
- this.neighborThreshold = 4;
- // prop: fillToZero
- // true will force bar and filled series to fill toward zero on the fill Axis.
- this.fillToZero = false;
- // prop: fillToValue
- // fill a filled series to this value on the fill axis.
- // Works in conjunction with fillToZero, so that must be true.
- this.fillToValue = 0;
- // prop: fillAxis
- // Either 'x' or 'y'. Which axis to fill the line toward if fillToZero is true.
- // 'y' means fill up/down to 0 on the y axis for this series.
- this.fillAxis = 'y';
- // prop: useNegativeColors
- // true to color negative values differently in filled and bar charts.
- this.useNegativeColors = true;
- this._stackData = [];
- // _plotData accounts for stacking. If plots not stacked, _plotData and data are same. If
- // stacked, _plotData is accumulation of stacking data.
- this._plotData = [];
- // _plotValues hold the individual x and y values that will be plotted for this series.
- this._plotValues = {x:[], y:[]};
- // statistics about the intervals between data points. Used for auto scaling.
- this._intervals = {x:{}, y:{}};
- // data from the previous series, for stacked charts.
- this._prevPlotData = [];
- this._prevGridData = [];
- this._stackAxis = 'y';
- this._primaryAxis = '_xaxis';
- // give each series a canvas to draw on. This should allow for redrawing speedups.
- this.canvas = new $.jqplot.GenericCanvas();
- this.shadowCanvas = new $.jqplot.GenericCanvas();
- this.plugins = {};
- // sum of y values in this series.
- this._sumy = 0;
- this._sumx = 0;
- this._type = '';
- }
-
- Series.prototype = new $.jqplot.ElemContainer();
- Series.prototype.constructor = Series;
-
- Series.prototype.init = function(index, gridbw, plot) {
- // weed out any null values in the data.
- this.index = index;
- this.gridBorderWidth = gridbw;
- var d = this.data;
- var temp = [], i;
- for (i=0; i.
- this.renderer = $.jqplot.CanvasGridRenderer;
- // prop: rendererOptions
- // Options to pass on to the renderer,
- // see <$.jqplot.CanvasGridRenderer>.
- this.rendererOptions = {};
- this._offsets = {top:null, bottom:null, left:null, right:null};
- }
-
- Grid.prototype = new $.jqplot.ElemContainer();
- Grid.prototype.constructor = Grid;
-
- Grid.prototype.init = function() {
- this.renderer = new this.renderer();
- this.renderer.init.call(this, this.rendererOptions);
- };
-
- Grid.prototype.createElement = function(offsets,plot) {
- this._offsets = offsets;
- return this.renderer.createElement.call(this, plot);
- };
-
- Grid.prototype.draw = function() {
- this.renderer.draw.call(this);
- };
-
- $.jqplot.GenericCanvas = function() {
- $.jqplot.ElemContainer.call(this);
- this._ctx;
- };
-
- $.jqplot.GenericCanvas.prototype = new $.jqplot.ElemContainer();
- $.jqplot.GenericCanvas.prototype.constructor = $.jqplot.GenericCanvas;
-
- $.jqplot.GenericCanvas.prototype.createElement = function(offsets, clss, plotDimensions, plot) {
- this._offsets = offsets;
- var klass = 'jqplot';
- if (clss != undefined) {
- klass = clss;
- }
- var elem;
-
- elem = plot.canvasManager.getCanvas();
-
- // if new plotDimensions supplied, use them.
- if (plotDimensions != null) {
- this._plotDimensions = plotDimensions;
- }
-
- elem.width = this._plotDimensions.width - this._offsets.left - this._offsets.right;
- elem.height = this._plotDimensions.height - this._offsets.top - this._offsets.bottom;
- this._elem = $(elem);
- this._elem.css({ position: 'absolute', left: this._offsets.left, top: this._offsets.top });
-
- this._elem.addClass(klass);
-
- elem = plot.canvasManager.initCanvas(elem);
-
- elem = null;
- return this._elem;
- };
-
- $.jqplot.GenericCanvas.prototype.setContext = function() {
- this._ctx = this._elem.get(0).getContext("2d");
- return this._ctx;
- };
-
- // Memory Leaks patch
- $.jqplot.GenericCanvas.prototype.resetCanvas = function() {
- if (this._elem) {
- if ($.jqplot.use_excanvas && window.G_vmlCanvasManager.uninitElement !== undefined) {
- window.G_vmlCanvasManager.uninitElement(this._elem.get(0));
- }
-
- //this._elem.remove();
- this._elem.emptyForce();
- }
-
- this._ctx = null;
- };
-
- $.jqplot.HooksManager = function () {
- this.hooks =[];
- this.args = [];
- };
-
- $.jqplot.HooksManager.prototype.addOnce = function(fn, args) {
- args = args || [];
- var havehook = false;
- for (var i=0, l=this.hooks.length; i {
- // > axesDefaults:{min:0},
- // > series:[{color:'#6633dd'}],
- // > title: 'A Plot'
- // > }
- //
-
- // prop: animate
- // True to animate the series on initial plot draw (renderer dependent).
- // Actual animation functionality must be supported in the renderer.
- this.animate = false;
- // prop: animateReplot
- // True to animate series after a call to the replot() method.
- // Use with caution! Replots can happen very frequently under
- // certain circumstances (e.g. resizing, dragging points) and
- // animation in these situations can cause problems.
- this.animateReplot = false;
- // prop: axes
- // up to 4 axes are supported, each with it's own options,
- // See for axis specific options.
- this.axes = {xaxis: new Axis('xaxis'), yaxis: new Axis('yaxis'), x2axis: new Axis('x2axis'), y2axis: new Axis('y2axis'), y3axis: new Axis('y3axis'), y4axis: new Axis('y4axis'), y5axis: new Axis('y5axis'), y6axis: new Axis('y6axis'), y7axis: new Axis('y7axis'), y8axis: new Axis('y8axis'), y9axis: new Axis('y9axis'), yMidAxis: new Axis('yMidAxis')};
- this.baseCanvas = new $.jqplot.GenericCanvas();
- // true to intercept right click events and fire a 'jqplotRightClick' event.
- // this will also block the context menu.
- this.captureRightClick = false;
- // prop: data
- // user's data. Data should *NOT* be specified in the options object,
- // but be passed in as the second argument to the $.jqplot() function.
- // The data property is described here soley for reference.
- // The data should be in the form of an array of 2D or 1D arrays like
- // > [ [[x1, y1], [x2, y2],...], [y1, y2, ...] ].
- this.data = [];
- // prop: dataRenderer
- // A callable which can be used to preprocess data passed into the plot.
- // Will be called with 2 arguments, the plot data and a reference to the plot.
- this.dataRenderer;
- // prop: dataRendererOptions
- // Options that will be passed to the dataRenderer.
- // Can be of any type.
- this.dataRendererOptions;
- this.defaults = {
- // prop: axesDefaults
- // default options that will be applied to all axes.
- // see for axes options.
- axesDefaults: {},
- axes: {xaxis:{}, yaxis:{}, x2axis:{}, y2axis:{}, y3axis:{}, y4axis:{}, y5axis:{}, y6axis:{}, y7axis:{}, y8axis:{}, y9axis:{}, yMidAxis:{}},
- // prop: seriesDefaults
- // default options that will be applied to all series.
- // see for series options.
- seriesDefaults: {},
- series:[]
- };
- // prop: defaultAxisStart
- // 1-D data series are internally converted into 2-D [x,y] data point arrays
- // by jqPlot. This is the default starting value for the missing x or y value.
- // The added data will be a monotonically increasing series (e.g. [1, 2, 3, ...])
- // starting at this value.
- this.defaultAxisStart = 1;
- // this.doCustomEventBinding = true;
- // prop: drawIfHidden
- // True to execute the draw method even if the plot target is hidden.
- // Generally, this should be false. Most plot elements will not be sized/
- // positioned correclty if renderered into a hidden container. To render into
- // a hidden container, call the replot method when the container is shown.
- this.drawIfHidden = false;
- this.eventCanvas = new $.jqplot.GenericCanvas();
- // prop: fillBetween
- // Fill between 2 line series in a plot.
- // Options object:
- // {
- // series1: first index (0 based) of series in fill
- // series2: second index (0 based) of series in fill
- // color: color of fill [default fillColor of series1]
- // baseSeries: fill will be drawn below this series (0 based index)
- // fill: false to turn off fill [default true].
- // }
- this.fillBetween = {
- series1: null,
- series2: null,
- color: null,
- baseSeries: 0,
- fill: true
- };
- // prop; fontFamily
- // css spec for the font-family attribute. Default for the entire plot.
- this.fontFamily;
- // prop: fontSize
- // css spec for the font-size attribute. Default for the entire plot.
- this.fontSize;
- // prop: grid
- // See for grid specific options.
- this.grid = new Grid();
- // prop: legend
- // see <$.jqplot.TableLegendRenderer>
- this.legend = new Legend();
- // prop: noDataIndicator
- // Options to set up a mock plot with a data loading indicator if no data is specified.
- this.negativeSeriesColors = $.jqplot.config.defaultNegativeColors;
- this.noDataIndicator = {
- show: false,
- indicator: 'Loading Data...',
- axes: {
- xaxis: {
- min: 0,
- max: 10,
- tickInterval: 2,
- show: true
- },
- yaxis: {
- min: 0,
- max: 12,
- tickInterval: 3,
- show: true
- }
- }
- };
- // container to hold all of the merged options. Convienence for plugins.
- this.options = {};
- this.previousSeriesStack = [];
- // Namespece to hold plugins. Generally non-renderer plugins add themselves to here.
- this.plugins = {};
- // prop: series
- // Array of series object options.
- // see for series specific options.
- this.series = [];
- // array of series indicies. Keep track of order
- // which series canvases are displayed, lowest
- // to highest, back to front.
- this.seriesStack = [];
- // prop: seriesColors
- // Ann array of CSS color specifications that will be applied, in order,
- // to the series in the plot. Colors will wrap around so, if their
- // are more series than colors, colors will be reused starting at the
- // beginning. For pie charts, this specifies the colors of the slices.
- this.seriesColors = $.jqplot.config.defaultColors;
- // prop: sortData
- // false to not sort the data passed in by the user.
- // Many bar, stakced and other graphs as well as many plugins depend on
- // having sorted data.
- this.sortData = true;
- // prop: stackSeries
- // true or false, creates a stack or "mountain" plot.
- // Not all series renderers may implement this option.
- this.stackSeries = false;
- // a shortcut for axis syncTicks options. Not implemented yet.
- this.syncXTicks = true;
- // a shortcut for axis syncTicks options. Not implemented yet.
- this.syncYTicks = true;
- // the jquery object for the dom target.
- this.target = null;
- // The id of the dom element to render the plot into
- this.targetId = null;
- // prop textColor
- // css spec for the css color attribute. Default for the entire plot.
- this.textColor;
- // prop: title
- // Title object. See for specific options. As a shortcut, you
- // can specify the title option as just a string like: title: 'My Plot'
- // and this will create a new title object with the specified text.
- this.title = new Title();
- // Count how many times the draw method has been called while the plot is visible.
- // Mostly used to test if plot has never been dran (=0), has been successfully drawn
- // into a visible container once (=1) or draw more than once into a visible container.
- // Can use this in tests to see if plot has been visibly drawn at least one time.
- // After plot has been visibly drawn once, it generally doesn't need redrawn if its
- // container is hidden and shown.
- this._drawCount = 0;
- // sum of y values for all series in plot.
- // used in mekko chart.
- this._sumy = 0;
- this._sumx = 0;
- // array to hold the cumulative stacked series data.
- // used to ajust the individual series data, which won't have access to other
- // series data.
- this._stackData = [];
- // array that holds the data to be plotted. This will be the series data
- // merged with the the appropriate data from _stackData according to the stackAxis.
- this._plotData = [];
- this._width = null;
- this._height = null;
- this._plotDimensions = {height:null, width:null};
- this._gridPadding = {top:null, right:null, bottom:null, left:null};
- this._defaultGridPadding = {top:10, right:10, bottom:23, left:10};
-
- this._addDomReference = $.jqplot.config.addDomReference;
-
- this.preInitHooks = new $.jqplot.HooksManager();
- this.postInitHooks = new $.jqplot.HooksManager();
- this.preParseOptionsHooks = new $.jqplot.HooksManager();
- this.postParseOptionsHooks = new $.jqplot.HooksManager();
- this.preDrawHooks = new $.jqplot.HooksManager();
- this.postDrawHooks = new $.jqplot.HooksManager();
- this.preDrawSeriesHooks = new $.jqplot.HooksManager();
- this.postDrawSeriesHooks = new $.jqplot.HooksManager();
- this.preDrawLegendHooks = new $.jqplot.HooksManager();
- this.addLegendRowHooks = new $.jqplot.HooksManager();
- this.preSeriesInitHooks = new $.jqplot.HooksManager();
- this.postSeriesInitHooks = new $.jqplot.HooksManager();
- this.preParseSeriesOptionsHooks = new $.jqplot.HooksManager();
- this.postParseSeriesOptionsHooks = new $.jqplot.HooksManager();
- this.eventListenerHooks = new $.jqplot.EventListenerManager();
- this.preDrawSeriesShadowHooks = new $.jqplot.HooksManager();
- this.postDrawSeriesShadowHooks = new $.jqplot.HooksManager();
-
- this.colorGenerator = new $.jqplot.ColorGenerator();
- this.negativeColorGenerator = new $.jqplot.ColorGenerator();
-
- this.canvasManager = new $.jqplot.CanvasManager();
-
- this.themeEngine = new $.jqplot.ThemeEngine();
-
- var seriesColorsIndex = 0;
-
- // Group: methods
- //
- // method: init
- // sets the plot target, checks data and applies user
- // options to plot.
- this.init = function(target, data, options) {
- options = options || {};
- for (var i=0; i<$.jqplot.preInitHooks.length; i++) {
- $.jqplot.preInitHooks[i].call(this, target, data, options);
- }
-
- for (var i=0; i');
- this.target.append(temp);
- temp.height(eh);
- temp.width(ew);
- temp.css('top', this.eventCanvas._offsets.top);
- temp.css('left', this.eventCanvas._offsets.left);
-
- var temp2 = $('
');
- temp.append(temp2);
- temp2.html(this.noDataIndicator.indicator);
- var th = temp2.height();
- var tw = temp2.width();
- temp2.height(th);
- temp2.width(tw);
- temp2.css('top', (eh - th)/2 + 'px');
- });
-
- }
- }
-
- this.data = data;
-
- this.parseOptions(options);
-
- if (this.textColor) {
- this.target.css('color', this.textColor);
- }
- if (this.fontFamily) {
- this.target.css('font-family', this.fontFamily);
- }
- if (this.fontSize) {
- this.target.css('font-size', this.fontSize);
- }
-
- this.title.init();
- this.legend.init();
- this._sumy = 0;
- this._sumx = 0;
- for (var i=0; i0) {
- series._prevPlotData = this.series[index-1]._plotData;
- }
- series._sumy = 0;
- series._sumx = 0;
- for (i=series.data.length-1; i>-1; i--) {
- series._sumy += series.data[i][1];
- series._sumx += series.data[i][0];
- }
- };
-
- // function to safely return colors from the color array and wrap around at the end.
- this.getNextSeriesColor = (function(t) {
- var idx = 0;
- var sc = t.seriesColors;
-
- return function () {
- if (idx < sc.length) {
- return sc[idx++];
- }
- else {
- idx = 0;
- return sc[idx++];
- }
- };
- })(this);
-
- this.parseOptions = function(options){
- for (var i=0; i= 0 && widthAdj >= 0) {
- gridPadding.top += heightAdj;
- gridPadding.bottom += heightAdj;
- gridPadding.left += widthAdj;
- gridPadding.right += widthAdj;
- }
- }
- var arr = ['top', 'bottom', 'left', 'right'];
- for (var n in arr) {
- if (this._gridPadding[arr[n]] == null && gridPadding[arr[n]] > 0) {
- this._gridPadding[arr[n]] = gridPadding[arr[n]];
- }
- else if (this._gridPadding[arr[n]] == null) {
- this._gridPadding[arr[n]] = this._defaultGridPadding[arr[n]];
- }
- }
-
- var legendPadding = (this.legend.placement == 'outsideGrid') ? {top:this.title.getHeight(), left: 0, right: 0, bottom: 0} : this._gridPadding;
-
- ax.xaxis.pack({position:'absolute', bottom:this._gridPadding.bottom - ax.xaxis.getHeight(), left:0, width:this._width}, {min:this._gridPadding.left, max:this._width - this._gridPadding.right});
- ax.yaxis.pack({position:'absolute', top:0, left:this._gridPadding.left - ax.yaxis.getWidth(), height:this._height}, {min:this._height - this._gridPadding.bottom, max: this._gridPadding.top});
- ax.x2axis.pack({position:'absolute', top:this._gridPadding.top - ax.x2axis.getHeight(), left:0, width:this._width}, {min:this._gridPadding.left, max:this._width - this._gridPadding.right});
- for (i=8; i>0; i--) {
- ax[ra[i-1]].pack({position:'absolute', top:0, right:this._gridPadding.right - rapad[i-1]}, {min:this._height - this._gridPadding.bottom, max: this._gridPadding.top});
- }
- var ltemp = (this._width - this._gridPadding.left - this._gridPadding.right)/2.0 + this._gridPadding.left - ax.yMidAxis.getWidth()/2.0;
- ax.yMidAxis.pack({position:'absolute', top:0, left:ltemp, zIndex:9, textAlign: 'center'}, {min:this._height - this._gridPadding.bottom, max: this._gridPadding.top});
-
- this.target.append(this.grid.createElement(this._gridPadding, this));
- this.grid.draw();
-
- var series = this.series;
- var seriesLength = series.length;
- // put the shadow canvases behind the series canvases so shadows don't overlap on stacked bars.
- for (i=0, l=seriesLength; i sid1) ? sid2 : sid1;
-
- var series1 = this.series[id1];
- var series2 = this.series[id2];
-
- if (series2.renderer.smooth) {
- var tempgd = series2.renderer._smoothedData.slice(0).reverse();
- }
- else {
- var tempgd = series2.gridData.slice(0).reverse();
- }
-
- if (series1.renderer.smooth) {
- var gd = series1.renderer._smoothedData.concat(tempgd);
- }
- else {
- var gd = series1.gridData.concat(tempgd);
- }
-
- var color = (fb.color !== null) ? fb.color : this.series[sid1].fillColor;
- var baseSeries = (fb.baseSeries !== null) ? fb.baseSeries : id1;
-
- // now apply a fill to the shape on the lower series shadow canvas,
- // so it is behind both series.
- var sr = this.series[baseSeries].renderer.shapeRenderer;
- var opts = {fillStyle: color, fill: true, closePath: true};
- sr.draw(series1.shadowCanvas._ctx, gd, opts);
- };
-
- this.bindCustomEvents = function() {
- this.eventCanvas._elem.bind('click', {plot:this}, this.onClick);
- this.eventCanvas._elem.bind('dblclick', {plot:this}, this.onDblClick);
- this.eventCanvas._elem.bind('mousedown', {plot:this}, this.onMouseDown);
- this.eventCanvas._elem.bind('mousemove', {plot:this}, this.onMouseMove);
- this.eventCanvas._elem.bind('mouseenter', {plot:this}, this.onMouseEnter);
- this.eventCanvas._elem.bind('mouseleave', {plot:this}, this.onMouseLeave);
- if (this.captureRightClick) {
- this.eventCanvas._elem.bind('mouseup', {plot:this}, this.onRightClick);
- this.eventCanvas._elem.get(0).oncontextmenu = function() {
- return false;
- };
- }
- else {
- this.eventCanvas._elem.bind('mouseup', {plot:this}, this.onMouseUp);
- }
- };
-
- function getEventPosition(ev) {
- var plot = ev.data.plot;
- var go = plot.eventCanvas._elem.offset();
- var gridPos = {x:ev.pageX - go.left, y:ev.pageY - go.top};
- var dataPos = {xaxis:null, yaxis:null, x2axis:null, y2axis:null, y3axis:null, y4axis:null, y5axis:null, y6axis:null, y7axis:null, y8axis:null, y9axis:null, yMidAxis:null};
- var an = ['xaxis', 'yaxis', 'x2axis', 'y2axis', 'y3axis', 'y4axis', 'y5axis', 'y6axis', 'y7axis', 'y8axis', 'y9axis', 'yMidAxis'];
- var ax = plot.axes;
- var n, axis;
- for (n=11; n>0; n--) {
- axis = an[n-1];
- if (ax[axis].show) {
- dataPos[axis] = ax[axis].series_p2u(gridPos[axis.charAt(0)]);
- }
- }
-
- return {offsets:go, gridPos:gridPos, dataPos:dataPos};
- }
-
-
- // function to check if event location is over a area area
- function checkIntersection(gridpos, plot) {
- var series = plot.series;
- var i, j, k, s, r, x, y, theta, sm, sa, minang, maxang;
- var d0, d, p, pp, points, bw;
- var threshold, t;
- for (k=plot.seriesStack.length-1; k>=0; k--) {
- i = plot.seriesStack[k];
- s = series[i];
- switch (s.renderer.constructor) {
- case $.jqplot.BarRenderer:
- case $.jqplot.PyramidRenderer:
- x = gridpos.x;
- y = gridpos.y;
- for (j=0; jpoints[0][0] && xpoints[2][1] && y 0 && -y >= 0) {
- theta = 2*Math.PI - Math.atan(-y/x);
- }
- else if (x > 0 && -y < 0) {
- theta = -Math.atan(-y/x);
- }
- else if (x < 0) {
- theta = Math.PI - Math.atan(-y/x);
- }
- else if (x == 0 && -y > 0) {
- theta = 3*Math.PI/2;
- }
- else if (x == 0 && -y < 0) {
- theta = Math.PI/2;
- }
- else if (x == 0 && y == 0) {
- theta = 0;
- }
- if (sa) {
- theta -= sa;
- if (theta < 0) {
- theta += 2*Math.PI;
- }
- else if (theta > 2*Math.PI) {
- theta -= 2*Math.PI;
- }
- }
-
- sm = s.sliceMargin/180*Math.PI;
- if (r < s._radius && r > s._innerRadius) {
- for (j=0; j0) ? s.gridData[j-1][1]+sm : sm;
- maxang = s.gridData[j][1];
- if (theta > minang && theta < maxang) {
- return {seriesIndex:s.index, pointIndex:j, gridData:s.gridData[j], data:s.data[j]};
- }
- }
- }
- break;
-
- case $.jqplot.PieRenderer:
- sa = s.startAngle/180*Math.PI;
- x = gridpos.x - s._center[0];
- y = gridpos.y - s._center[1];
- r = Math.sqrt(Math.pow(x, 2) + Math.pow(y, 2));
- if (x > 0 && -y >= 0) {
- theta = 2*Math.PI - Math.atan(-y/x);
- }
- else if (x > 0 && -y < 0) {
- theta = -Math.atan(-y/x);
- }
- else if (x < 0) {
- theta = Math.PI - Math.atan(-y/x);
- }
- else if (x == 0 && -y > 0) {
- theta = 3*Math.PI/2;
- }
- else if (x == 0 && -y < 0) {
- theta = Math.PI/2;
- }
- else if (x == 0 && y == 0) {
- theta = 0;
- }
- if (sa) {
- theta -= sa;
- if (theta < 0) {
- theta += 2*Math.PI;
- }
- else if (theta > 2*Math.PI) {
- theta -= 2*Math.PI;
- }
- }
-
- sm = s.sliceMargin/180*Math.PI;
- if (r < s._radius) {
- for (j=0; j0) ? s.gridData[j-1][1]+sm : sm;
- maxang = s.gridData[j][1];
- if (theta > minang && theta < maxang) {
- return {seriesIndex:s.index, pointIndex:j, gridData:s.gridData[j], data:s.data[j]};
- }
- }
- }
- break;
-
- case $.jqplot.BubbleRenderer:
- x = gridpos.x;
- y = gridpos.y;
- var ret = null;
-
- if (s.show) {
- for (var j=0; j= cv[0][1] && y <= cv[3][1] && x >= lex[0] && x <= rex[0]) {
- return {seriesIndex:s.index, pointIndex:j, gridData:null, data:s.data[j]};
- }
- }
- break;
-
- case $.jqplot.LineRenderer:
- x = gridpos.x;
- y = gridpos.y;
- r = s.renderer;
- if (s.show) {
- if ((s.fill || (s.renderer.bands.show && s.renderer.bands.fill)) && (!plot.plugins.highlighter || !plot.plugins.highlighter.show)) {
- // first check if it is in bounding box
- var inside = false;
- if (x>s._boundingBox[0][0] && xs._boundingBox[1][1] && y= y || vertex2[1] < y && vertex1[1] >= y) {
- if (vertex1[0] + (y - vertex1[1]) / (vertex2[1] - vertex1[1]) * (vertex2[0] - vertex1[0]) < x) {
- inside = !inside;
- }
- }
-
- j = ii;
- }
- }
- if (inside) {
- return {seriesIndex:i, pointIndex:null, gridData:s.gridData, data:s.data, points:s._areaPoints};
- }
- break;
-
- }
-
- else {
- t = s.markerRenderer.size/2+s.neighborThreshold;
- threshold = (t > 0) ? t : 0;
- for (var j=0; j= p[0]-r._bodyWidth/2 && x <= p[0]+r._bodyWidth/2 && y >= yp(s.data[j][2]) && y <= yp(s.data[j][3])) {
- return {seriesIndex: i, pointIndex:j, gridData:p, data:s.data[j]};
- }
- }
- // if an open hi low close chart
- else if (!r.hlc){
- var yp = s._yaxis.series_u2p;
- if (x >= p[0]-r._tickLength && x <= p[0]+r._tickLength && y >= yp(s.data[j][2]) && y <= yp(s.data[j][3])) {
- return {seriesIndex: i, pointIndex:j, gridData:p, data:s.data[j]};
- }
- }
- // a hi low close chart
- else {
- var yp = s._yaxis.series_u2p;
- if (x >= p[0]-r._tickLength && x <= p[0]+r._tickLength && y >= yp(s.data[j][1]) && y <= yp(s.data[j][2])) {
- return {seriesIndex: i, pointIndex:j, gridData:p, data:s.data[j]};
- }
- }
-
- }
- else if (p[0] != null && p[1] != null){
- d = Math.sqrt( (x-p[0]) * (x-p[0]) + (y-p[1]) * (y-p[1]) );
- if (d <= threshold && (d <= d0 || d0 == null)) {
- d0 = d;
- return {seriesIndex: i, pointIndex:j, gridData:p, data:s.data[j]};
- }
- }
- }
- }
- }
- break;
-
- default:
- x = gridpos.x;
- y = gridpos.y;
- r = s.renderer;
- if (s.show) {
- t = s.markerRenderer.size/2+s.neighborThreshold;
- threshold = (t > 0) ? t : 0;
- for (var j=0; j= p[0]-r._bodyWidth/2 && x <= p[0]+r._bodyWidth/2 && y >= yp(s.data[j][2]) && y <= yp(s.data[j][3])) {
- return {seriesIndex: i, pointIndex:j, gridData:p, data:s.data[j]};
- }
- }
- // if an open hi low close chart
- else if (!r.hlc){
- var yp = s._yaxis.series_u2p;
- if (x >= p[0]-r._tickLength && x <= p[0]+r._tickLength && y >= yp(s.data[j][2]) && y <= yp(s.data[j][3])) {
- return {seriesIndex: i, pointIndex:j, gridData:p, data:s.data[j]};
- }
- }
- // a hi low close chart
- else {
- var yp = s._yaxis.series_u2p;
- if (x >= p[0]-r._tickLength && x <= p[0]+r._tickLength && y >= yp(s.data[j][1]) && y <= yp(s.data[j][2])) {
- return {seriesIndex: i, pointIndex:j, gridData:p, data:s.data[j]};
- }
- }
-
- }
- else {
- d = Math.sqrt( (x-p[0]) * (x-p[0]) + (y-p[1]) * (y-p[1]) );
- if (d <= threshold && (d <= d0 || d0 == null)) {
- d0 = d;
- return {seriesIndex: i, pointIndex:j, gridData:p, data:s.data[j]};
- }
- }
- }
- }
- break;
- }
- }
-
- return null;
- }
-
-
-
- this.onClick = function(ev) {
- // Event passed in is normalized and will have data attribute.
- // Event passed out is unnormalized.
- var positions = getEventPosition(ev);
- var p = ev.data.plot;
- var neighbor = checkIntersection(positions.gridPos, p);
- var evt = jQuery.Event('jqplotClick');
- evt.pageX = ev.pageX;
- evt.pageY = ev.pageY;
- $(this).trigger(evt, [positions.gridPos, positions.dataPos, neighbor, p]);
- };
-
- this.onDblClick = function(ev) {
- // Event passed in is normalized and will have data attribute.
- // Event passed out is unnormalized.
- var positions = getEventPosition(ev);
- var p = ev.data.plot;
- var neighbor = checkIntersection(positions.gridPos, p);
- var evt = jQuery.Event('jqplotDblClick');
- evt.pageX = ev.pageX;
- evt.pageY = ev.pageY;
- $(this).trigger(evt, [positions.gridPos, positions.dataPos, neighbor, p]);
- };
-
- this.onMouseDown = function(ev) {
- var positions = getEventPosition(ev);
- var p = ev.data.plot;
- var neighbor = checkIntersection(positions.gridPos, p);
- var evt = jQuery.Event('jqplotMouseDown');
- evt.pageX = ev.pageX;
- evt.pageY = ev.pageY;
- $(this).trigger(evt, [positions.gridPos, positions.dataPos, neighbor, p]);
- };
-
- this.onMouseUp = function(ev) {
- var positions = getEventPosition(ev);
- var evt = jQuery.Event('jqplotMouseUp');
- evt.pageX = ev.pageX;
- evt.pageY = ev.pageY;
- $(this).trigger(evt, [positions.gridPos, positions.dataPos, null, ev.data.plot]);
- };
-
- this.onRightClick = function(ev) {
- var positions = getEventPosition(ev);
- var p = ev.data.plot;
- var neighbor = checkIntersection(positions.gridPos, p);
- if (p.captureRightClick) {
- if (ev.which == 3) {
- var evt = jQuery.Event('jqplotRightClick');
- evt.pageX = ev.pageX;
- evt.pageY = ev.pageY;
- $(this).trigger(evt, [positions.gridPos, positions.dataPos, neighbor, p]);
- }
- else {
- var evt = jQuery.Event('jqplotMouseUp');
- evt.pageX = ev.pageX;
- evt.pageY = ev.pageY;
- $(this).trigger(evt, [positions.gridPos, positions.dataPos, neighbor, p]);
- }
- }
- };
-
- this.onMouseMove = function(ev) {
- var positions = getEventPosition(ev);
- var p = ev.data.plot;
- var neighbor = checkIntersection(positions.gridPos, p);
- var evt = jQuery.Event('jqplotMouseMove');
- evt.pageX = ev.pageX;
- evt.pageY = ev.pageY;
- $(this).trigger(evt, [positions.gridPos, positions.dataPos, neighbor, p]);
- };
-
- this.onMouseEnter = function(ev) {
- var positions = getEventPosition(ev);
- var p = ev.data.plot;
- var evt = jQuery.Event('jqplotMouseEnter');
- evt.pageX = ev.pageX;
- evt.pageY = ev.pageY;
- evt.relatedTarget = ev.relatedTarget;
- $(this).trigger(evt, [positions.gridPos, positions.dataPos, null, p]);
- };
-
- this.onMouseLeave = function(ev) {
- var positions = getEventPosition(ev);
- var p = ev.data.plot;
- var evt = jQuery.Event('jqplotMouseLeave');
- evt.pageX = ev.pageX;
- evt.pageY = ev.pageY;
- evt.relatedTarget = ev.relatedTarget;
- $(this).trigger(evt, [positions.gridPos, positions.dataPos, null, p]);
- };
-
- // method: drawSeries
- // Redraws all or just one series on the plot. No axis scaling
- // is performed and no other elements on the plot are redrawn.
- // options is an options object to pass on to the series renderers.
- // It can be an empty object {}. idx is the series index
- // to redraw if only one series is to be redrawn.
- this.drawSeries = function(options, idx){
- var i, series, ctx;
- // if only one argument passed in and it is a number, use it ad idx.
- idx = (typeof(options) === "number" && idx == null) ? options : idx;
- options = (typeof(options) === "object") ? options : {};
- // draw specified series
- if (idx != undefined) {
- series = this.series[idx];
- ctx = series.shadowCanvas._ctx;
- ctx.clearRect(0, 0, ctx.canvas.width, ctx.canvas.height);
- series.drawShadow(ctx, options, this);
- ctx = series.canvas._ctx;
- ctx.clearRect(0, 0, ctx.canvas.width, ctx.canvas.height);
- series.draw(ctx, options, this);
- if (series.renderer.constructor == $.jqplot.BezierCurveRenderer) {
- if (idx < this.series.length - 1) {
- this.drawSeries(idx+1);
- }
- }
- }
-
- else {
- // if call series drawShadow method first, in case all series shadows
- // should be drawn before any series. This will ensure, like for
- // stacked bar plots, that shadows don't overlap series.
- for (i=0; i 660) ? newrgb[j] * 0.85 : 0.73 * newrgb[j] + 90;
- newrgb[j] = parseInt(newrgb[j], 10);
- (newrgb[j] > 255) ? 255 : newrgb[j];
- }
- // newrgb[3] = (rgba[3] > 0.4) ? rgba[3] * 0.4 : rgba[3] * 1.5;
- // newrgb[3] = (rgba[3] > 0.5) ? 0.8 * rgba[3] - .1 : rgba[3] + 0.2;
- newrgb[3] = 0.3 + 0.35 * rgba[3];
- ret.push('rgba('+newrgb[0]+','+newrgb[1]+','+newrgb[2]+','+newrgb[3]+')');
- }
- }
- else {
- var rgba = $.jqplot.getColorComponents(colors);
- var newrgb = [rgba[0], rgba[1], rgba[2]];
- var sum = newrgb[0] + newrgb[1] + newrgb[2];
- for (var j=0; j<3; j++) {
- // when darkening, lowest color component can be is 60.
- // newrgb[j] = (sum > 570) ? newrgb[j] * 0.8 : newrgb[j] + 0.3 * (255 - newrgb[j]);
- // newrgb[j] = parseInt(newrgb[j], 10);
- newrgb[j] = (sum > 660) ? newrgb[j] * 0.85 : 0.73 * newrgb[j] + 90;
- newrgb[j] = parseInt(newrgb[j], 10);
- (newrgb[j] > 255) ? 255 : newrgb[j];
- }
- // newrgb[3] = (rgba[3] > 0.4) ? rgba[3] * 0.4 : rgba[3] * 1.5;
- // newrgb[3] = (rgba[3] > 0.5) ? 0.8 * rgba[3] - .1 : rgba[3] + 0.2;
- newrgb[3] = 0.3 + 0.35 * rgba[3];
- ret = 'rgba('+newrgb[0]+','+newrgb[1]+','+newrgb[2]+','+newrgb[3]+')';
- }
- return ret;
- };
-
- $.jqplot.ColorGenerator = function(colors) {
- colors = colors || $.jqplot.config.defaultColors;
- var idx = 0;
-
- this.next = function () {
- if (idx < colors.length) {
- return colors[idx++];
- }
- else {
- idx = 0;
- return colors[idx++];
- }
- };
-
- this.previous = function () {
- if (idx > 0) {
- return colors[idx--];
- }
- else {
- idx = colors.length-1;
- return colors[idx];
- }
- };
-
- // get a color by index without advancing pointer.
- this.get = function(i) {
- var idx = i - colors.length * Math.floor(i/colors.length);
- return colors[idx];
- };
-
- this.setColors = function(c) {
- colors = c;
- };
-
- this.reset = function() {
- idx = 0;
- };
-
- this.getIndex = function() {
- return idx;
- };
-
- this.setIndex = function(index) {
- idx = index;
- };
- };
-
- // convert a hex color string to rgb string.
- // h - 3 or 6 character hex string, with or without leading #
- // a - optional alpha
- $.jqplot.hex2rgb = function(h, a) {
- h = h.replace('#', '');
- if (h.length == 3) {
- h = h.charAt(0)+h.charAt(0)+h.charAt(1)+h.charAt(1)+h.charAt(2)+h.charAt(2);
- }
- var rgb;
- rgb = 'rgba('+parseInt(h.slice(0,2), 16)+', '+parseInt(h.slice(2,4), 16)+', '+parseInt(h.slice(4,6), 16);
- if (a) {
- rgb += ', '+a;
- }
- rgb += ')';
- return rgb;
- };
-
- // convert an rgb color spec to a hex spec. ignore any alpha specification.
- $.jqplot.rgb2hex = function(s) {
- var pat = /rgba?\( *([0-9]{1,3}\.?[0-9]*%?) *, *([0-9]{1,3}\.?[0-9]*%?) *, *([0-9]{1,3}\.?[0-9]*%?) *(?:, *[0-9.]*)?\)/;
- var m = s.match(pat);
- var h = '#';
- for (var i=1; i<4; i++) {
- var temp;
- if (m[i].search(/%/) != -1) {
- temp = parseInt(255*m[i]/100, 10).toString(16);
- if (temp.length == 1) {
- temp = '0'+temp;
- }
- }
- else {
- temp = parseInt(m[i], 10).toString(16);
- if (temp.length == 1) {
- temp = '0'+temp;
- }
- }
- h += temp;
- }
- return h;
- };
-
- // given a css color spec, return an rgb css color spec
- $.jqplot.normalize2rgb = function(s, a) {
- if (s.search(/^ *rgba?\(/) != -1) {
- return s;
- }
- else if (s.search(/^ *#?[0-9a-fA-F]?[0-9a-fA-F]/) != -1) {
- return $.jqplot.hex2rgb(s, a);
- }
- else {
- throw 'invalid color spec';
- }
- };
-
- // extract the r, g, b, a color components out of a css color spec.
- $.jqplot.getColorComponents = function(s) {
- // check to see if a color keyword.
- s = $.jqplot.colorKeywordMap[s] || s;
- var rgb = $.jqplot.normalize2rgb(s);
- var pat = /rgba?\( *([0-9]{1,3}\.?[0-9]*%?) *, *([0-9]{1,3}\.?[0-9]*%?) *, *([0-9]{1,3}\.?[0-9]*%?) *,? *([0-9.]* *)?\)/;
- var m = rgb.match(pat);
- var ret = [];
- for (var i=1; i<4; i++) {
- if (m[i].search(/%/) != -1) {
- ret[i-1] = parseInt(255*m[i]/100, 10);
- }
- else {
- ret[i-1] = parseInt(m[i], 10);
- }
- }
- ret[3] = parseFloat(m[4]) ? parseFloat(m[4]) : 1.0;
- return ret;
- };
-
- $.jqplot.colorKeywordMap = {
- aliceblue: 'rgb(240, 248, 255)',
- antiquewhite: 'rgb(250, 235, 215)',
- aqua: 'rgb( 0, 255, 255)',
- aquamarine: 'rgb(127, 255, 212)',
- azure: 'rgb(240, 255, 255)',
- beige: 'rgb(245, 245, 220)',
- bisque: 'rgb(255, 228, 196)',
- black: 'rgb( 0, 0, 0)',
- blanchedalmond: 'rgb(255, 235, 205)',
- blue: 'rgb( 0, 0, 255)',
- blueviolet: 'rgb(138, 43, 226)',
- brown: 'rgb(165, 42, 42)',
- burlywood: 'rgb(222, 184, 135)',
- cadetblue: 'rgb( 95, 158, 160)',
- chartreuse: 'rgb(127, 255, 0)',
- chocolate: 'rgb(210, 105, 30)',
- coral: 'rgb(255, 127, 80)',
- cornflowerblue: 'rgb(100, 149, 237)',
- cornsilk: 'rgb(255, 248, 220)',
- crimson: 'rgb(220, 20, 60)',
- cyan: 'rgb( 0, 255, 255)',
- darkblue: 'rgb( 0, 0, 139)',
- darkcyan: 'rgb( 0, 139, 139)',
- darkgoldenrod: 'rgb(184, 134, 11)',
- darkgray: 'rgb(169, 169, 169)',
- darkgreen: 'rgb( 0, 100, 0)',
- darkgrey: 'rgb(169, 169, 169)',
- darkkhaki: 'rgb(189, 183, 107)',
- darkmagenta: 'rgb(139, 0, 139)',
- darkolivegreen: 'rgb( 85, 107, 47)',
- darkorange: 'rgb(255, 140, 0)',
- darkorchid: 'rgb(153, 50, 204)',
- darkred: 'rgb(139, 0, 0)',
- darksalmon: 'rgb(233, 150, 122)',
- darkseagreen: 'rgb(143, 188, 143)',
- darkslateblue: 'rgb( 72, 61, 139)',
- darkslategray: 'rgb( 47, 79, 79)',
- darkslategrey: 'rgb( 47, 79, 79)',
- darkturquoise: 'rgb( 0, 206, 209)',
- darkviolet: 'rgb(148, 0, 211)',
- deeppink: 'rgb(255, 20, 147)',
- deepskyblue: 'rgb( 0, 191, 255)',
- dimgray: 'rgb(105, 105, 105)',
- dimgrey: 'rgb(105, 105, 105)',
- dodgerblue: 'rgb( 30, 144, 255)',
- firebrick: 'rgb(178, 34, 34)',
- floralwhite: 'rgb(255, 250, 240)',
- forestgreen: 'rgb( 34, 139, 34)',
- fuchsia: 'rgb(255, 0, 255)',
- gainsboro: 'rgb(220, 220, 220)',
- ghostwhite: 'rgb(248, 248, 255)',
- gold: 'rgb(255, 215, 0)',
- goldenrod: 'rgb(218, 165, 32)',
- gray: 'rgb(128, 128, 128)',
- grey: 'rgb(128, 128, 128)',
- green: 'rgb( 0, 128, 0)',
- greenyellow: 'rgb(173, 255, 47)',
- honeydew: 'rgb(240, 255, 240)',
- hotpink: 'rgb(255, 105, 180)',
- indianred: 'rgb(205, 92, 92)',
- indigo: 'rgb( 75, 0, 130)',
- ivory: 'rgb(255, 255, 240)',
- khaki: 'rgb(240, 230, 140)',
- lavender: 'rgb(230, 230, 250)',
- lavenderblush: 'rgb(255, 240, 245)',
- lawngreen: 'rgb(124, 252, 0)',
- lemonchiffon: 'rgb(255, 250, 205)',
- lightblue: 'rgb(173, 216, 230)',
- lightcoral: 'rgb(240, 128, 128)',
- lightcyan: 'rgb(224, 255, 255)',
- lightgoldenrodyellow: 'rgb(250, 250, 210)',
- lightgray: 'rgb(211, 211, 211)',
- lightgreen: 'rgb(144, 238, 144)',
- lightgrey: 'rgb(211, 211, 211)',
- lightpink: 'rgb(255, 182, 193)',
- lightsalmon: 'rgb(255, 160, 122)',
- lightseagreen: 'rgb( 32, 178, 170)',
- lightskyblue: 'rgb(135, 206, 250)',
- lightslategray: 'rgb(119, 136, 153)',
- lightslategrey: 'rgb(119, 136, 153)',
- lightsteelblue: 'rgb(176, 196, 222)',
- lightyellow: 'rgb(255, 255, 224)',
- lime: 'rgb( 0, 255, 0)',
- limegreen: 'rgb( 50, 205, 50)',
- linen: 'rgb(250, 240, 230)',
- magenta: 'rgb(255, 0, 255)',
- maroon: 'rgb(128, 0, 0)',
- mediumaquamarine: 'rgb(102, 205, 170)',
- mediumblue: 'rgb( 0, 0, 205)',
- mediumorchid: 'rgb(186, 85, 211)',
- mediumpurple: 'rgb(147, 112, 219)',
- mediumseagreen: 'rgb( 60, 179, 113)',
- mediumslateblue: 'rgb(123, 104, 238)',
- mediumspringgreen: 'rgb( 0, 250, 154)',
- mediumturquoise: 'rgb( 72, 209, 204)',
- mediumvioletred: 'rgb(199, 21, 133)',
- midnightblue: 'rgb( 25, 25, 112)',
- mintcream: 'rgb(245, 255, 250)',
- mistyrose: 'rgb(255, 228, 225)',
- moccasin: 'rgb(255, 228, 181)',
- navajowhite: 'rgb(255, 222, 173)',
- navy: 'rgb( 0, 0, 128)',
- oldlace: 'rgb(253, 245, 230)',
- olive: 'rgb(128, 128, 0)',
- olivedrab: 'rgb(107, 142, 35)',
- orange: 'rgb(255, 165, 0)',
- orangered: 'rgb(255, 69, 0)',
- orchid: 'rgb(218, 112, 214)',
- palegoldenrod: 'rgb(238, 232, 170)',
- palegreen: 'rgb(152, 251, 152)',
- paleturquoise: 'rgb(175, 238, 238)',
- palevioletred: 'rgb(219, 112, 147)',
- papayawhip: 'rgb(255, 239, 213)',
- peachpuff: 'rgb(255, 218, 185)',
- peru: 'rgb(205, 133, 63)',
- pink: 'rgb(255, 192, 203)',
- plum: 'rgb(221, 160, 221)',
- powderblue: 'rgb(176, 224, 230)',
- purple: 'rgb(128, 0, 128)',
- red: 'rgb(255, 0, 0)',
- rosybrown: 'rgb(188, 143, 143)',
- royalblue: 'rgb( 65, 105, 225)',
- saddlebrown: 'rgb(139, 69, 19)',
- salmon: 'rgb(250, 128, 114)',
- sandybrown: 'rgb(244, 164, 96)',
- seagreen: 'rgb( 46, 139, 87)',
- seashell: 'rgb(255, 245, 238)',
- sienna: 'rgb(160, 82, 45)',
- silver: 'rgb(192, 192, 192)',
- skyblue: 'rgb(135, 206, 235)',
- slateblue: 'rgb(106, 90, 205)',
- slategray: 'rgb(112, 128, 144)',
- slategrey: 'rgb(112, 128, 144)',
- snow: 'rgb(255, 250, 250)',
- springgreen: 'rgb( 0, 255, 127)',
- steelblue: 'rgb( 70, 130, 180)',
- tan: 'rgb(210, 180, 140)',
- teal: 'rgb( 0, 128, 128)',
- thistle: 'rgb(216, 191, 216)',
- tomato: 'rgb(255, 99, 71)',
- turquoise: 'rgb( 64, 224, 208)',
- violet: 'rgb(238, 130, 238)',
- wheat: 'rgb(245, 222, 179)',
- white: 'rgb(255, 255, 255)',
- whitesmoke: 'rgb(245, 245, 245)',
- yellow: 'rgb(255, 255, 0)',
- yellowgreen: 'rgb(154, 205, 50)'
- };
-
-
-
- // class: $.jqplot.AxisLabelRenderer
- // Renderer to place labels on the axes.
- $.jqplot.AxisLabelRenderer = function(options) {
- // Group: Properties
- $.jqplot.ElemContainer.call(this);
- // name of the axis associated with this tick
- this.axis;
- // prop: show
- // wether or not to show the tick (mark and label).
- this.show = true;
- // prop: label
- // The text or html for the label.
- this.label = '';
- this.fontFamily = null;
- this.fontSize = null;
- this.textColor = null;
- this._elem;
- // prop: escapeHTML
- // true to escape HTML entities in the label.
- this.escapeHTML = false;
-
- $.extend(true, this, options);
- };
-
- $.jqplot.AxisLabelRenderer.prototype = new $.jqplot.ElemContainer();
- $.jqplot.AxisLabelRenderer.prototype.constructor = $.jqplot.AxisLabelRenderer;
-
- $.jqplot.AxisLabelRenderer.prototype.init = function(options) {
- $.extend(true, this, options);
- };
-
- $.jqplot.AxisLabelRenderer.prototype.draw = function(ctx, plot) {
- // Memory Leaks patch
- if (this._elem) {
- this._elem.emptyForce();
- this._elem = null;
- }
-
- this._elem = $('
');
-
- if (Number(this.label)) {
- this._elem.css('white-space', 'nowrap');
- }
-
- if (!this.escapeHTML) {
- this._elem.html(this.label);
- }
- else {
- this._elem.text(this.label);
- }
- if (this.fontFamily) {
- this._elem.css('font-family', this.fontFamily);
- }
- if (this.fontSize) {
- this._elem.css('font-size', this.fontSize);
- }
- if (this.textColor) {
- this._elem.css('color', this.textColor);
- }
-
- return this._elem;
- };
-
- $.jqplot.AxisLabelRenderer.prototype.pack = function() {
- };
-
- // class: $.jqplot.AxisTickRenderer
- // A "tick" object showing the value of a tick/gridline on the plot.
- $.jqplot.AxisTickRenderer = function(options) {
- // Group: Properties
- $.jqplot.ElemContainer.call(this);
- // prop: mark
- // tick mark on the axis. One of 'inside', 'outside', 'cross', '' or null.
- this.mark = 'outside';
- // name of the axis associated with this tick
- this.axis;
- // prop: showMark
- // wether or not to show the mark on the axis.
- this.showMark = true;
- // prop: showGridline
- // wether or not to draw the gridline on the grid at this tick.
- this.showGridline = true;
- // prop: isMinorTick
- // if this is a minor tick.
- this.isMinorTick = false;
- // prop: size
- // Length of the tick beyond the grid in pixels.
- // DEPRECATED: This has been superceeded by markSize
- this.size = 4;
- // prop: markSize
- // Length of the tick marks in pixels. For 'cross' style, length
- // will be stoked above and below axis, so total length will be twice this.
- this.markSize = 6;
- // prop: show
- // wether or not to show the tick (mark and label).
- // Setting this to false requires more testing. It is recommended
- // to set showLabel and showMark to false instead.
- this.show = true;
- // prop: showLabel
- // wether or not to show the label.
- this.showLabel = true;
- this.label = null;
- this.value = null;
- this._styles = {};
- // prop: formatter
- // A class of a formatter for the tick text. sprintf by default.
- this.formatter = $.jqplot.DefaultTickFormatter;
- // prop: prefix
- // String to prepend to the tick label.
- // Prefix is prepended to the formatted tick label.
- this.prefix = '';
- // prop: formatString
- // string passed to the formatter.
- this.formatString = '';
- // prop: fontFamily
- // css spec for the font-family css attribute.
- this.fontFamily;
- // prop: fontSize
- // css spec for the font-size css attribute.
- this.fontSize;
- // prop: textColor
- // css spec for the color attribute.
- this.textColor;
- // prop: escapeHTML
- // true to escape HTML entities in the label.
- this.escapeHTML = false;
- this._elem;
- this._breakTick = false;
-
- $.extend(true, this, options);
- };
-
- $.jqplot.AxisTickRenderer.prototype.init = function(options) {
- $.extend(true, this, options);
- };
-
- $.jqplot.AxisTickRenderer.prototype = new $.jqplot.ElemContainer();
- $.jqplot.AxisTickRenderer.prototype.constructor = $.jqplot.AxisTickRenderer;
-
- $.jqplot.AxisTickRenderer.prototype.setTick = function(value, axisName, isMinor) {
- this.value = value;
- this.axis = axisName;
- if (isMinor) {
- this.isMinorTick = true;
- }
- return this;
- };
-
- $.jqplot.AxisTickRenderer.prototype.draw = function() {
- if (this.label === null) {
- this.label = this.prefix + this.formatter(this.formatString, this.value);
- }
- var style = {position: 'absolute'};
- if (Number(this.label)) {
- style['whitSpace'] = 'nowrap';
- }
-
- // Memory Leaks patch
- if (this._elem) {
- this._elem.emptyForce();
- this._elem = null;
- }
-
- this._elem = $(document.createElement('div'));
- this._elem.addClass("jqplot-"+this.axis+"-tick");
-
- if (!this.escapeHTML) {
- this._elem.html(this.label);
- }
- else {
- this._elem.text(this.label);
- }
-
- this._elem.css(style);
-
- for (var s in this._styles) {
- this._elem.css(s, this._styles[s]);
- }
- if (this.fontFamily) {
- this._elem.css('font-family', this.fontFamily);
- }
- if (this.fontSize) {
- this._elem.css('font-size', this.fontSize);
- }
- if (this.textColor) {
- this._elem.css('color', this.textColor);
- }
- if (this._breakTick) {
- this._elem.addClass('jqplot-breakTick');
- }
-
- return this._elem;
- };
-
- $.jqplot.DefaultTickFormatter = function (format, val) {
- if (typeof val == 'number') {
- if (!format) {
- format = $.jqplot.config.defaultTickFormatString;
- }
- return $.jqplot.sprintf(format, val);
- }
- else {
- return String(val);
- }
- };
-
- $.jqplot.AxisTickRenderer.prototype.pack = function() {
- };
-
- // Class: $.jqplot.CanvasGridRenderer
- // The default jqPlot grid renderer, creating a grid on a canvas element.
- // The renderer has no additional options beyond the class.
- $.jqplot.CanvasGridRenderer = function(){
- this.shadowRenderer = new $.jqplot.ShadowRenderer();
- };
-
- // called with context of Grid object
- $.jqplot.CanvasGridRenderer.prototype.init = function(options) {
- this._ctx;
- $.extend(true, this, options);
- // set the shadow renderer options
- var sopts = {lineJoin:'miter', lineCap:'round', fill:false, isarc:false, angle:this.shadowAngle, offset:this.shadowOffset, alpha:this.shadowAlpha, depth:this.shadowDepth, lineWidth:this.shadowWidth, closePath:false, strokeStyle:this.shadowColor};
- this.renderer.shadowRenderer.init(sopts);
- };
-
- // called with context of Grid.
- $.jqplot.CanvasGridRenderer.prototype.createElement = function(plot) {
- var elem;
- // Memory Leaks patch
- if (this._elem) {
- if ($.jqplot.use_excanvas && window.G_vmlCanvasManager.uninitElement !== undefined) {
- elem = this._elem.get(0);
- window.G_vmlCanvasManager.uninitElement(elem);
- elem = null;
- }
-
- this._elem.emptyForce();
- this._elem = null;
- }
-
- elem = plot.canvasManager.getCanvas();
-
- var w = this._plotDimensions.width;
- var h = this._plotDimensions.height;
- elem.width = w;
- elem.height = h;
- this._elem = $(elem);
- this._elem.addClass('jqplot-grid-canvas');
- this._elem.css({ position: 'absolute', left: 0, top: 0 });
-
- elem = plot.canvasManager.initCanvas(elem);
-
- this._top = this._offsets.top;
- this._bottom = h - this._offsets.bottom;
- this._left = this._offsets.left;
- this._right = w - this._offsets.right;
- this._width = this._right - this._left;
- this._height = this._bottom - this._top;
- // avoid memory leak
- elem = null;
- return this._elem;
- };
-
- $.jqplot.CanvasGridRenderer.prototype.draw = function() {
- this._ctx = this._elem.get(0).getContext("2d");
- var ctx = this._ctx;
- var axes = this._axes;
- // Add the grid onto the grid canvas. This is the bottom most layer.
- ctx.save();
- ctx.clearRect(0, 0, this._plotDimensions.width, this._plotDimensions.height);
- ctx.fillStyle = this.backgroundColor || this.background;
- ctx.fillRect(this._left, this._top, this._width, this._height);
-
- ctx.save();
- ctx.lineJoin = 'miter';
- ctx.lineCap = 'butt';
- ctx.lineWidth = this.gridLineWidth;
- ctx.strokeStyle = this.gridLineColor;
- var b, e, s, m;
- var ax = ['xaxis', 'yaxis', 'x2axis', 'y2axis'];
- for (var i=4; i>0; i--) {
- var name = ax[i-1];
- var axis = axes[name];
- var ticks = axis._ticks;
- var numticks = ticks.length;
- if (axis.show) {
- if (axis.drawBaseline) {
- var bopts = {};
- if (axis.baselineWidth !== null) {
- bopts.lineWidth = axis.baselineWidth;
- }
- if (axis.baselineColor !== null) {
- bopts.strokeStyle = axis.baselineColor;
- }
- switch (name) {
- case 'xaxis':
- drawLine (this._left, this._bottom, this._right, this._bottom, bopts);
- break;
- case 'yaxis':
- drawLine (this._left, this._bottom, this._left, this._top, bopts);
- break;
- case 'x2axis':
- drawLine (this._left, this._bottom, this._right, this._bottom, bopts);
- break;
- case 'y2axis':
- drawLine (this._right, this._bottom, this._right, this._top, bopts);
- break;
- }
- }
- for (var j=numticks; j>0; j--) {
- var t = ticks[j-1];
- if (t.show) {
- var pos = Math.round(axis.u2p(t.value)) + 0.5;
- switch (name) {
- case 'xaxis':
- // draw the grid line if we should
- if (t.showGridline && this.drawGridlines && ((!t.isMinorTick && axis.drawMajorGridlines) || (t.isMinorTick && axis.drawMinorGridlines)) ) {
- drawLine(pos, this._top, pos, this._bottom);
- }
- // draw the mark
- if (t.showMark && t.mark && ((!t.isMinorTick && axis.drawMajorTickMarks) || (t.isMinorTick && axis.drawMinorTickMarks)) ) {
- s = t.markSize;
- m = t.mark;
- var pos = Math.round(axis.u2p(t.value)) + 0.5;
- switch (m) {
- case 'outside':
- b = this._bottom;
- e = this._bottom+s;
- break;
- case 'inside':
- b = this._bottom-s;
- e = this._bottom;
- break;
- case 'cross':
- b = this._bottom-s;
- e = this._bottom+s;
- break;
- default:
- b = this._bottom;
- e = this._bottom+s;
- break;
- }
- // draw the shadow
- if (this.shadow) {
- this.renderer.shadowRenderer.draw(ctx, [[pos,b],[pos,e]], {lineCap:'butt', lineWidth:this.gridLineWidth, offset:this.gridLineWidth*0.75, depth:2, fill:false, closePath:false});
- }
- // draw the line
- drawLine(pos, b, pos, e);
- }
- break;
- case 'yaxis':
- // draw the grid line
- if (t.showGridline && this.drawGridlines && ((!t.isMinorTick && axis.drawMajorGridlines) || (t.isMinorTick && axis.drawMinorGridlines)) ) {
- drawLine(this._right, pos, this._left, pos);
- }
- // draw the mark
- if (t.showMark && t.mark && ((!t.isMinorTick && axis.drawMajorTickMarks) || (t.isMinorTick && axis.drawMinorTickMarks)) ) {
- s = t.markSize;
- m = t.mark;
- var pos = Math.round(axis.u2p(t.value)) + 0.5;
- switch (m) {
- case 'outside':
- b = this._left-s;
- e = this._left;
- break;
- case 'inside':
- b = this._left;
- e = this._left+s;
- break;
- case 'cross':
- b = this._left-s;
- e = this._left+s;
- break;
- default:
- b = this._left-s;
- e = this._left;
- break;
- }
- // draw the shadow
- if (this.shadow) {
- this.renderer.shadowRenderer.draw(ctx, [[b, pos], [e, pos]], {lineCap:'butt', lineWidth:this.gridLineWidth*1.5, offset:this.gridLineWidth*0.75, fill:false, closePath:false});
- }
- drawLine(b, pos, e, pos, {strokeStyle:axis.borderColor});
- }
- break;
- case 'x2axis':
- // draw the grid line
- if (t.showGridline && this.drawGridlines && ((!t.isMinorTick && axis.drawMajorGridlines) || (t.isMinorTick && axis.drawMinorGridlines)) ) {
- drawLine(pos, this._bottom, pos, this._top);
- }
- // draw the mark
- if (t.showMark && t.mark && ((!t.isMinorTick && axis.drawMajorTickMarks) || (t.isMinorTick && axis.drawMinorTickMarks)) ) {
- s = t.markSize;
- m = t.mark;
- var pos = Math.round(axis.u2p(t.value)) + 0.5;
- switch (m) {
- case 'outside':
- b = this._top-s;
- e = this._top;
- break;
- case 'inside':
- b = this._top;
- e = this._top+s;
- break;
- case 'cross':
- b = this._top-s;
- e = this._top+s;
- break;
- default:
- b = this._top-s;
- e = this._top;
- break;
- }
- // draw the shadow
- if (this.shadow) {
- this.renderer.shadowRenderer.draw(ctx, [[pos,b],[pos,e]], {lineCap:'butt', lineWidth:this.gridLineWidth, offset:this.gridLineWidth*0.75, depth:2, fill:false, closePath:false});
- }
- drawLine(pos, b, pos, e);
- }
- break;
- case 'y2axis':
- // draw the grid line
- if (t.showGridline && this.drawGridlines && ((!t.isMinorTick && axis.drawMajorGridlines) || (t.isMinorTick && axis.drawMinorGridlines)) ) {
- drawLine(this._left, pos, this._right, pos);
- }
- // draw the mark
- if (t.showMark && t.mark && ((!t.isMinorTick && axis.drawMajorTickMarks) || (t.isMinorTick && axis.drawMinorTickMarks)) ) {
- s = t.markSize;
- m = t.mark;
- var pos = Math.round(axis.u2p(t.value)) + 0.5;
- switch (m) {
- case 'outside':
- b = this._right;
- e = this._right+s;
- break;
- case 'inside':
- b = this._right-s;
- e = this._right;
- break;
- case 'cross':
- b = this._right-s;
- e = this._right+s;
- break;
- default:
- b = this._right;
- e = this._right+s;
- break;
- }
- // draw the shadow
- if (this.shadow) {
- this.renderer.shadowRenderer.draw(ctx, [[b, pos], [e, pos]], {lineCap:'butt', lineWidth:this.gridLineWidth*1.5, offset:this.gridLineWidth*0.75, fill:false, closePath:false});
- }
- drawLine(b, pos, e, pos, {strokeStyle:axis.borderColor});
- }
- break;
- default:
- break;
- }
- }
- }
- t = null;
- }
- axis = null;
- ticks = null;
- }
- // Now draw grid lines for additional y axes
- //////
- // TO DO: handle yMidAxis
- //////
- ax = ['y3axis', 'y4axis', 'y5axis', 'y6axis', 'y7axis', 'y8axis', 'y9axis', 'yMidAxis'];
- for (var i=7; i>0; i--) {
- var axis = axes[ax[i-1]];
- var ticks = axis._ticks;
- if (axis.show) {
- var tn = ticks[axis.numberTicks-1];
- var t0 = ticks[0];
- var left = axis.getLeft();
- var points = [[left, tn.getTop() + tn.getHeight()/2], [left, t0.getTop() + t0.getHeight()/2 + 1.0]];
- // draw the shadow
- if (this.shadow) {
- this.renderer.shadowRenderer.draw(ctx, points, {lineCap:'butt', fill:false, closePath:false});
- }
- // draw the line
- drawLine(points[0][0], points[0][1], points[1][0], points[1][1], {lineCap:'butt', strokeStyle:axis.borderColor, lineWidth:axis.borderWidth});
- // draw the tick marks
- for (var j=ticks.length; j>0; j--) {
- var t = ticks[j-1];
- s = t.markSize;
- m = t.mark;
- var pos = Math.round(axis.u2p(t.value)) + 0.5;
- if (t.showMark && t.mark) {
- switch (m) {
- case 'outside':
- b = left;
- e = left+s;
- break;
- case 'inside':
- b = left-s;
- e = left;
- break;
- case 'cross':
- b = left-s;
- e = left+s;
- break;
- default:
- b = left;
- e = left+s;
- break;
- }
- points = [[b,pos], [e,pos]];
- // draw the shadow
- if (this.shadow) {
- this.renderer.shadowRenderer.draw(ctx, points, {lineCap:'butt', lineWidth:this.gridLineWidth*1.5, offset:this.gridLineWidth*0.75, fill:false, closePath:false});
- }
- // draw the line
- drawLine(b, pos, e, pos, {strokeStyle:axis.borderColor});
- }
- t = null;
- }
- t0 = null;
- }
- axis = null;
- ticks = null;
- }
-
- ctx.restore();
-
- function drawLine(bx, by, ex, ey, opts) {
- ctx.save();
- opts = opts || {};
- if (opts.lineWidth == null || opts.lineWidth != 0){
- $.extend(true, ctx, opts);
- ctx.beginPath();
- ctx.moveTo(bx, by);
- ctx.lineTo(ex, ey);
- ctx.stroke();
- ctx.restore();
- }
- }
-
- if (this.shadow) {
- var points = [[this._left, this._bottom], [this._right, this._bottom], [this._right, this._top]];
- this.renderer.shadowRenderer.draw(ctx, points);
- }
- // Now draw border around grid. Use axis border definitions. start at
- // upper left and go clockwise.
- if (this.borderWidth != 0 && this.drawBorder) {
- drawLine (this._left, this._top, this._right, this._top, {lineCap:'round', strokeStyle:axes.x2axis.borderColor, lineWidth:axes.x2axis.borderWidth});
- drawLine (this._right, this._top, this._right, this._bottom, {lineCap:'round', strokeStyle:axes.y2axis.borderColor, lineWidth:axes.y2axis.borderWidth});
- drawLine (this._right, this._bottom, this._left, this._bottom, {lineCap:'round', strokeStyle:axes.xaxis.borderColor, lineWidth:axes.xaxis.borderWidth});
- drawLine (this._left, this._bottom, this._left, this._top, {lineCap:'round', strokeStyle:axes.yaxis.borderColor, lineWidth:axes.yaxis.borderWidth});
- }
- // ctx.lineWidth = this.borderWidth;
- // ctx.strokeStyle = this.borderColor;
- // ctx.strokeRect(this._left, this._top, this._width, this._height);
-
- ctx.restore();
- ctx = null;
- axes = null;
- };
-
- // Class: $.jqplot.DivTitleRenderer
- // The default title renderer for jqPlot. This class has no options beyond the class.
- $.jqplot.DivTitleRenderer = function() {
- };
-
- $.jqplot.DivTitleRenderer.prototype.init = function(options) {
- $.extend(true, this, options);
- };
-
- $.jqplot.DivTitleRenderer.prototype.draw = function() {
- // Memory Leaks patch
- if (this._elem) {
- this._elem.emptyForce();
- this._elem = null;
- }
-
- var r = this.renderer;
- var elem = document.createElement('div');
- this._elem = $(elem);
- this._elem.addClass('jqplot-title');
-
- if (!this.text) {
- this.show = false;
- this._elem.height(0);
- this._elem.width(0);
- }
- else if (this.text) {
- var color;
- if (this.color) {
- color = this.color;
- }
- else if (this.textColor) {
- color = this.textColor;
- }
-
- // don't trust that a stylesheet is present, set the position.
- var styles = {position:'absolute', top:'0px', left:'0px'};
-
- if (this._plotWidth) {
- styles['width'] = this._plotWidth+'px';
- }
- if (this.fontSize) {
- styles['fontSize'] = this.fontSize;
- }
- if (typeof this.textAlign === 'string') {
- styles['textAlign'] = this.textAlign;
- }
- else {
- styles['textAlign'] = 'center';
- }
- if (color) {
- styles['color'] = color;
- }
- if (this.paddingBottom) {
- styles['paddingBottom'] = this.paddingBottom;
- }
- if (this.fontFamily) {
- styles['fontFamily'] = this.fontFamily;
- }
-
- this._elem.css(styles);
- if (this.escapeHtml) {
- this._elem.text(this.text);
- }
- else {
- this._elem.html(this.text);
- }
-
-
- // styletext += (this._plotWidth) ? 'width:'+this._plotWidth+'px;' : '';
- // styletext += (this.fontSize) ? 'font-size:'+this.fontSize+';' : '';
- // styletext += (this.textAlign) ? 'text-align:'+this.textAlign+';' : 'text-align:center;';
- // styletext += (color) ? 'color:'+color+';' : '';
- // styletext += (this.paddingBottom) ? 'padding-bottom:'+this.paddingBottom+';' : '';
- // this._elem = $(''+this.text+'
');
- // if (this.fontFamily) {
- // this._elem.css('font-family', this.fontFamily);
- // }
- }
-
- elem = null;
-
- return this._elem;
- };
-
- $.jqplot.DivTitleRenderer.prototype.pack = function() {
- // nothing to do here
- };
-
-
- var dotlen = 0.1;
-
- $.jqplot.LinePattern = function (ctx, pattern) {
-
- var defaultLinePatterns = {
- dotted: [ dotlen, $.jqplot.config.dotGapLength ],
- dashed: [ $.jqplot.config.dashLength, $.jqplot.config.gapLength ],
- solid: null
- };
-
- if (typeof pattern === 'string') {
- if (pattern[0] === '.' || pattern[0] === '-') {
- var s = pattern;
- pattern = [];
- for (var i=0, imax=s.length; i 0) && (scale > 0)) {
- dx /= dist;
- dy /= dist;
- while (true) {
- var dp = scale * patternDistance;
- if (dp < dist) {
- px += dp * dx;
- py += dp * dy;
- if ((patternIndex & 1) == 0) {
- ctx.lineTo( px, py );
- }
- else {
- ctx.moveTo( px, py );
- }
- dist -= dp;
- patternIndex++;
- if (patternIndex >= pattern.length) {
- patternIndex = 0;
- }
- patternDistance = pattern[patternIndex];
- }
- else {
- px = x;
- py = y;
- if ((patternIndex & 1) == 0) {
- ctx.lineTo( px, py );
- }
- else {
- ctx.moveTo( px, py );
- }
- patternDistance -= dist / scale;
- break;
- }
- }
- }
- };
-
- var beginPath = function () {
- ctx.beginPath();
- };
-
- var closePath = function () {
- lineTo( pathx0, pathy0 );
- };
-
- return {
- moveTo: moveTo,
- lineTo: lineTo,
- beginPath: beginPath,
- closePath: closePath
- };
- };
-
- // Class: $.jqplot.LineRenderer
- // The default line renderer for jqPlot, this class has no options beyond the class.
- // Draws series as a line.
- $.jqplot.LineRenderer = function(){
- this.shapeRenderer = new $.jqplot.ShapeRenderer();
- this.shadowRenderer = new $.jqplot.ShadowRenderer();
- };
-
- // called with scope of series.
- $.jqplot.LineRenderer.prototype.init = function(options, plot) {
- // Group: Properties
- //
- options = options || {};
- this._type='line';
- this.renderer.animation = {
- show: false,
- direction: 'left',
- speed: 2500,
- _supported: true
- };
- // prop: smooth
- // True to draw a smoothed (interpolated) line through the data points
- // with automatically computed number of smoothing points.
- // Set to an integer number > 2 to specify number of smoothing points
- // to use between each data point.
- this.renderer.smooth = false; // true or a number > 2 for smoothing.
- this.renderer.tension = null; // null to auto compute or a number typically > 6. Fewer points requires higher tension.
- // prop: constrainSmoothing
- // True to use a more accurate smoothing algorithm that will
- // not overshoot any data points. False to allow overshoot but
- // produce a smoother looking line.
- this.renderer.constrainSmoothing = true;
- // this is smoothed data in grid coordinates, like gridData
- this.renderer._smoothedData = [];
- // this is smoothed data in plot units (plot coordinates), like plotData.
- this.renderer._smoothedPlotData = [];
- this.renderer._hiBandGridData = [];
- this.renderer._lowBandGridData = [];
- this.renderer._hiBandSmoothedData = [];
- this.renderer._lowBandSmoothedData = [];
-
- // prop: bandData
- // Data used to draw error bands or confidence intervals above/below a line.
- //
- // bandData can be input in 3 forms. jqPlot will figure out which is the
- // low band line and which is the high band line for all forms:
- //
- // A 2 dimensional array like [[yl1, yl2, ...], [yu1, yu2, ...]] where
- // [yl1, yl2, ...] are y values of the lower line and
- // [yu1, yu2, ...] are y values of the upper line.
- // In this case there must be the same number of y data points as data points
- // in the series and the bands will inherit the x values of the series.
- //
- // A 2 dimensional array like [[[xl1, yl1], [xl2, yl2], ...], [[xh1, yh1], [xh2, yh2], ...]]
- // where [xl1, yl1] are x,y data points for the lower line and
- // [xh1, yh1] are x,y data points for the high line.
- // x values do not have to correspond to the x values of the series and can
- // be of any arbitrary length.
- //
- // Can be of form [[yl1, yu1], [yl2, yu2], [yl3, yu3], ...] where
- // there must be 3 or more arrays and there must be the same number of arrays
- // as there are data points in the series. In this case,
- // [yl1, yu1] specifies the lower and upper y values for the 1st
- // data point and so on. The bands will inherit the x
- // values from the series.
- this.renderer.bandData = [];
-
- // Group: bands
- // Banding around line, e.g error bands or confidence intervals.
- this.renderer.bands = {
- // prop: show
- // true to show the bands. If bandData or interval is
- // supplied, show will be set to true by default.
- show: false,
- hiData: [],
- lowData: [],
- // prop: color
- // color of lines at top and bottom of bands [default: series color].
- color: this.color,
- // prop: showLines
- // True to show lines at top and bottom of bands [default: false].
- showLines: false,
- // prop: fill
- // True to fill area between bands [default: true].
- fill: true,
- // prop: fillColor
- // css color spec for filled area. [default: series color].
- fillColor: null,
- _min: null,
- _max: null,
- // prop: interval
- // User specified interval above and below line for bands [default: '3%''].
- // Can be a value like 3 or a string like '3%'
- // or an upper/lower array like [1, -2] or ['2%', '-1.5%']
- interval: '3%'
- };
-
-
- var lopts = {highlightMouseOver: options.highlightMouseOver, highlightMouseDown: options.highlightMouseDown, highlightColor: options.highlightColor};
-
- delete (options.highlightMouseOver);
- delete (options.highlightMouseDown);
- delete (options.highlightColor);
-
- $.extend(true, this.renderer, options);
-
- this.renderer.options = options;
-
- // if we are given some band data, and bands aren't explicity set to false in options, turn them on.
- if (this.renderer.bandData.length > 1 && (!options.bands || options.bands.show == null)) {
- this.renderer.bands.show = true;
- }
-
- // if we are given an interval, and bands aren't explicity set to false in options, turn them on.
- else if (options.bands && options.bands.show == null && options.bands.interval != null) {
- this.renderer.bands.show = true;
- }
-
- // if plot is filled, turn off bands.
- if (this.fill) {
- this.renderer.bands.show = false;
- }
-
- if (this.renderer.bands.show) {
- this.renderer.initBands.call(this, this.renderer.options, plot);
- }
-
-
- // smoothing is not compatible with stacked lines, disable
- if (this._stack) {
- this.renderer.smooth = false;
- }
-
- // set the shape renderer options
- var opts = {lineJoin:this.lineJoin, lineCap:this.lineCap, fill:this.fill, isarc:false, strokeStyle:this.color, fillStyle:this.fillColor, lineWidth:this.lineWidth, linePattern:this.linePattern, closePath:this.fill};
- this.renderer.shapeRenderer.init(opts);
-
- var shadow_offset = options.shadowOffset;
- // set the shadow renderer options
- if (shadow_offset == null) {
- // scale the shadowOffset to the width of the line.
- if (this.lineWidth > 2.5) {
- shadow_offset = 1.25 * (1 + (Math.atan((this.lineWidth/2.5))/0.785398163 - 1)*0.6);
- // var shadow_offset = this.shadowOffset;
- }
- // for skinny lines, don't make such a big shadow.
- else {
- shadow_offset = 1.25 * Math.atan((this.lineWidth/2.5))/0.785398163;
- }
- }
-
- var sopts = {lineJoin:this.lineJoin, lineCap:this.lineCap, fill:this.fill, isarc:false, angle:this.shadowAngle, offset:shadow_offset, alpha:this.shadowAlpha, depth:this.shadowDepth, lineWidth:this.lineWidth, linePattern:this.linePattern, closePath:this.fill};
- this.renderer.shadowRenderer.init(sopts);
- this._areaPoints = [];
- this._boundingBox = [[],[]];
-
- if (!this.isTrendline && this.fill || this.renderer.bands.show) {
- // Group: Properties
- //
- // prop: highlightMouseOver
- // True to highlight area on a filled plot when moused over.
- // This must be false to enable highlightMouseDown to highlight when clicking on an area on a filled plot.
- this.highlightMouseOver = true;
- // prop: highlightMouseDown
- // True to highlight when a mouse button is pressed over an area on a filled plot.
- // This will be disabled if highlightMouseOver is true.
- this.highlightMouseDown = false;
- // prop: highlightColor
- // color to use when highlighting an area on a filled plot.
- this.highlightColor = null;
- // if user has passed in highlightMouseDown option and not set highlightMouseOver, disable highlightMouseOver
- if (lopts.highlightMouseDown && lopts.highlightMouseOver == null) {
- lopts.highlightMouseOver = false;
- }
-
- $.extend(true, this, {highlightMouseOver: lopts.highlightMouseOver, highlightMouseDown: lopts.highlightMouseDown, highlightColor: lopts.highlightColor});
-
- if (!this.highlightColor) {
- var fc = (this.renderer.bands.show) ? this.renderer.bands.fillColor : this.fillColor;
- this.highlightColor = $.jqplot.computeHighlightColors(fc);
- }
- // turn off (disable) the highlighter plugin
- if (this.highlighter) {
- this.highlighter.show = false;
- }
- }
-
- if (!this.isTrendline && plot) {
- plot.plugins.lineRenderer = {};
- plot.postInitHooks.addOnce(postInit);
- plot.postDrawHooks.addOnce(postPlotDraw);
- plot.eventListenerHooks.addOnce('jqplotMouseMove', handleMove);
- plot.eventListenerHooks.addOnce('jqplotMouseDown', handleMouseDown);
- plot.eventListenerHooks.addOnce('jqplotMouseUp', handleMouseUp);
- plot.eventListenerHooks.addOnce('jqplotClick', handleClick);
- plot.eventListenerHooks.addOnce('jqplotRightClick', handleRightClick);
- }
-
- };
-
- $.jqplot.LineRenderer.prototype.initBands = function(options, plot) {
- // use bandData if no data specified in bands option
- //var bd = this.renderer.bandData;
- var bd = options.bandData || [];
- var bands = this.renderer.bands;
- bands.hiData = [];
- bands.lowData = [];
- var data = this.data;
- bands._max = null;
- bands._min = null;
- // If 2 arrays, and each array greater than 2 elements, assume it is hi and low data bands of y values.
- if (bd.length == 2) {
- // Do we have an array of x,y values?
- // like [[[1,1], [2,4], [3,3]], [[1,3], [2,6], [3,5]]]
- if ($.isArray(bd[0][0])) {
- // since an arbitrary array of points, spin through all of them to determine max and min lines.
-
- var p;
- var bdminidx = 0, bdmaxidx = 0;
- for (var i = 0, l = bd[0].length; i bands._max) || bands._max == null) {
- bands._max = p[1];
- }
- if ((p[1] != null && p[1] < bands._min) || bands._min == null) {
- bands._min = p[1];
- }
- }
- for (var i = 0, l = bd[1].length; i bands._max) || bands._max == null) {
- bands._max = p[1];
- bdmaxidx = 1;
- }
- if ((p[1] != null && p[1] < bands._min) || bands._min == null) {
- bands._min = p[1];
- bdminidx = 1;
- }
- }
-
- if (bdmaxidx === bdminidx) {
- bands.show = false;
- }
-
- bands.hiData = bd[bdmaxidx];
- bands.lowData = bd[bdminidx];
- }
- // else data is arrays of y values
- // like [[1,4,3], [3,6,5]]
- // must have same number of band data points as points in series
- else if (bd[0].length === data.length && bd[1].length === data.length) {
- var hi = (bd[0][0] > bd[1][0]) ? 0 : 1;
- var low = (hi) ? 0 : 1;
- for (var i=0, l=data.length; i < l; i++) {
- bands.hiData.push([data[i][0], bd[hi][i]]);
- bands.lowData.push([data[i][0], bd[low][i]]);
- }
- }
-
- // we don't have proper data array, don't show bands.
- else {
- bands.show = false;
- }
- }
-
- // if more than 2 arrays, have arrays of [ylow, yhi] values.
- // note, can't distinguish case of [[ylow, yhi], [ylow, yhi]] from [[ylow, ylow], [yhi, yhi]]
- // this is assumed to be of the latter form.
- else if (bd.length > 2 && !$.isArray(bd[0][0])) {
- var hi = (bd[0][0] > bd[0][1]) ? 0 : 1;
- var low = (hi) ? 0 : 1;
- for (var i=0, l=bd.length; i bands._max) || bands._max == null) {
- bands._max = hd[i][1];
- }
- }
- for (var i = 0, l = ld.length; i 0) {
- slope2 = Math.abs((gd[i][1] - gd[i-1][1]) / (gd[i][0] - gd[i-1][0]));
- }
- temp = slope2/scale + shift;
-
- a2 = stretch * tanh(temp) - stretch * tanh(shift) + min;
-
- a = (a1 + a2)/2.0;
-
- }
- else {
- a = tension;
- }
- for (t=0; t < steps; t++) {
- s = t / steps;
- h1 = (1 + 2*s)*Math.pow((1-s),2);
- h2 = s*Math.pow((1-s),2);
- h3 = Math.pow(s,2)*(3-2*s);
- h4 = Math.pow(s,2)*(s-1);
-
- if (gd[i-1]) {
- TiX = a * (gd[i+1][0] - gd[i-1][0]);
- TiY = a * (gd[i+1][1] - gd[i-1][1]);
- } else {
- TiX = a * (gd[i+1][0] - gd[i][0]);
- TiY = a * (gd[i+1][1] - gd[i][1]);
- }
- if (gd[i+2]) {
- Ti1X = a * (gd[i+2][0] - gd[i][0]);
- Ti1Y = a * (gd[i+2][1] - gd[i][1]);
- } else {
- Ti1X = a * (gd[i+1][0] - gd[i][0]);
- Ti1Y = a * (gd[i+1][1] - gd[i][1]);
- }
-
- pX = h1*gd[i][0] + h3*gd[i+1][0] + h2*TiX + h4*Ti1X;
- pY = h1*gd[i][1] + h3*gd[i+1][1] + h2*TiY + h4*Ti1Y;
- p = [pX, pY];
-
- _smoothedData.push(p);
- _smoothedPlotData.push([xp(pX), yp(pY)]);
- }
- }
- _smoothedData.push(gd[l]);
- _smoothedPlotData.push([xp(gd[l][0]), yp(gd[l][1])]);
-
- return [_smoothedData, _smoothedPlotData];
- }
-
- // setGridData
- // converts the user data values to grid coordinates and stores them
- // in the gridData array.
- // Called with scope of a series.
- $.jqplot.LineRenderer.prototype.setGridData = function(plot) {
- // recalculate the grid data
- var xp = this._xaxis.series_u2p;
- var yp = this._yaxis.series_u2p;
- var data = this._plotData;
- var pdata = this._prevPlotData;
- this.gridData = [];
- this._prevGridData = [];
- this.renderer._smoothedData = [];
- this.renderer._smoothedPlotData = [];
- this.renderer._hiBandGridData = [];
- this.renderer._lowBandGridData = [];
- this.renderer._hiBandSmoothedData = [];
- this.renderer._lowBandSmoothedData = [];
- var bands = this.renderer.bands;
- var hasNull = false;
- for (var i=0, l=this.data.length; i < l; i++) {
- // if not a line series or if no nulls in data, push the converted point onto the array.
- if (data[i][0] != null && data[i][1] != null) {
- this.gridData.push([xp.call(this._xaxis, data[i][0]), yp.call(this._yaxis, data[i][1])]);
- }
- // else if there is a null, preserve it.
- else if (data[i][0] == null) {
- hasNull = true;
- this.gridData.push([null, yp.call(this._yaxis, data[i][1])]);
- }
- else if (data[i][1] == null) {
- hasNull = true;
- this.gridData.push([xp.call(this._xaxis, data[i][0]), null]);
- }
- // if not a line series or if no nulls in data, push the converted point onto the array.
- if (pdata[i] != null && pdata[i][0] != null && pdata[i][1] != null) {
- this._prevGridData.push([xp.call(this._xaxis, pdata[i][0]), yp.call(this._yaxis, pdata[i][1])]);
- }
- // else if there is a null, preserve it.
- else if (pdata[i] != null && pdata[i][0] == null) {
- this._prevGridData.push([null, yp.call(this._yaxis, pdata[i][1])]);
- }
- else if (pdata[i] != null && pdata[i][0] != null && pdata[i][1] == null) {
- this._prevGridData.push([xp.call(this._xaxis, pdata[i][0]), null]);
- }
- }
-
- // don't do smoothing or bands on broken lines.
- if (hasNull) {
- this.renderer.smooth = false;
- if (this._type === 'line') {
- bands.show = false;
- }
- }
-
- if (this._type === 'line' && bands.show) {
- for (var i=0, l=bands.hiData.length; i 2) {
- var ret;
- if (this.renderer.constrainSmoothing) {
- ret = computeConstrainedSmoothedData.call(this, this.gridData);
- this.renderer._smoothedData = ret[0];
- this.renderer._smoothedPlotData = ret[1];
-
- if (bands.show) {
- ret = computeConstrainedSmoothedData.call(this, this.renderer._hiBandGridData);
- this.renderer._hiBandSmoothedData = ret[0];
- ret = computeConstrainedSmoothedData.call(this, this.renderer._lowBandGridData);
- this.renderer._lowBandSmoothedData = ret[0];
- }
-
- ret = null;
- }
- else {
- ret = computeHermiteSmoothedData.call(this, this.gridData);
- this.renderer._smoothedData = ret[0];
- this.renderer._smoothedPlotData = ret[1];
-
- if (bands.show) {
- ret = computeHermiteSmoothedData.call(this, this.renderer._hiBandGridData);
- this.renderer._hiBandSmoothedData = ret[0];
- ret = computeHermiteSmoothedData.call(this, this.renderer._lowBandGridData);
- this.renderer._lowBandSmoothedData = ret[0];
- }
-
- ret = null;
- }
- }
- };
-
- // makeGridData
- // converts any arbitrary data values to grid coordinates and
- // returns them. This method exists so that plugins can use a series'
- // linerenderer to generate grid data points without overwriting the
- // grid data associated with that series.
- // Called with scope of a series.
- $.jqplot.LineRenderer.prototype.makeGridData = function(data, plot) {
- // recalculate the grid data
- var xp = this._xaxis.series_u2p;
- var yp = this._yaxis.series_u2p;
- var gd = [];
- var pgd = [];
- this.renderer._smoothedData = [];
- this.renderer._smoothedPlotData = [];
- this.renderer._hiBandGridData = [];
- this.renderer._lowBandGridData = [];
- this.renderer._hiBandSmoothedData = [];
- this.renderer._lowBandSmoothedData = [];
- var bands = this.renderer.bands;
- var hasNull = false;
- for (var i=0; i 2) {
- var ret;
- if (this.renderer.constrainSmoothing) {
- ret = computeConstrainedSmoothedData.call(this, gd);
- this.renderer._smoothedData = ret[0];
- this.renderer._smoothedPlotData = ret[1];
-
- if (bands.show) {
- ret = computeConstrainedSmoothedData.call(this, this.renderer._hiBandGridData);
- this.renderer._hiBandSmoothedData = ret[0];
- ret = computeConstrainedSmoothedData.call(this, this.renderer._lowBandGridData);
- this.renderer._lowBandSmoothedData = ret[0];
- }
-
- ret = null;
- }
- else {
- ret = computeHermiteSmoothedData.call(this, gd);
- this.renderer._smoothedData = ret[0];
- this.renderer._smoothedPlotData = ret[1];
-
- if (bands.show) {
- ret = computeHermiteSmoothedData.call(this, this.renderer._hiBandGridData);
- this.renderer._hiBandSmoothedData = ret[0];
- ret = computeHermiteSmoothedData.call(this, this.renderer._lowBandGridData);
- this.renderer._lowBandSmoothedData = ret[0];
- }
-
- ret = null;
- }
- }
- return gd;
- };
-
-
- // called within scope of series.
- $.jqplot.LineRenderer.prototype.draw = function(ctx, gd, options, plot) {
- var i;
- // get a copy of the options, so we don't modify the original object.
- var opts = $.extend(true, {}, options);
- var shadow = (opts.shadow != undefined) ? opts.shadow : this.shadow;
- var showLine = (opts.showLine != undefined) ? opts.showLine : this.showLine;
- var fill = (opts.fill != undefined) ? opts.fill : this.fill;
- var fillAndStroke = (opts.fillAndStroke != undefined) ? opts.fillAndStroke : this.fillAndStroke;
- var xmin, ymin, xmax, ymax;
- ctx.save();
- if (gd.length) {
- if (showLine) {
- // if we fill, we'll have to add points to close the curve.
- if (fill) {
- if (this.fillToZero) {
- // have to break line up into shapes at axis crossings
- var negativeColor = this.negativeColor;
- if (! this.useNegativeColors) {
- negativeColor = opts.fillStyle;
- }
- var isnegative = false;
- var posfs = opts.fillStyle;
-
- // if stoking line as well as filling, get a copy of line data.
- if (fillAndStroke) {
- var fasgd = gd.slice(0);
- }
- // if not stacked, fill down to axis
- if (this.index == 0 || !this._stack) {
-
- var tempgd = [];
- var pd = (this.renderer.smooth) ? this.renderer._smoothedPlotData : this._plotData;
- this._areaPoints = [];
- var pyzero = this._yaxis.series_u2p(this.fillToValue);
- var pxzero = this._xaxis.series_u2p(this.fillToValue);
-
- opts.closePath = true;
-
- if (this.fillAxis == 'y') {
- tempgd.push([gd[0][0], pyzero]);
- this._areaPoints.push([gd[0][0], pyzero]);
-
- for (var i=0; i0; i--) {
- gd.push(prev[i-1]);
- // this._areaPoints.push(prev[i-1]);
- }
- if (shadow) {
- this.renderer.shadowRenderer.draw(ctx, gd, opts);
- }
- this._areaPoints = gd;
- this.renderer.shapeRenderer.draw(ctx, gd, opts);
- }
- }
- /////////////////////////
- // Not filled to zero
- ////////////////////////
- else {
- // if stoking line as well as filling, get a copy of line data.
- if (fillAndStroke) {
- var fasgd = gd.slice(0);
- }
- // if not stacked, fill down to axis
- if (this.index == 0 || !this._stack) {
- // var gridymin = this._yaxis.series_u2p(this._yaxis.min) - this.gridBorderWidth / 2;
- var gridymin = ctx.canvas.height;
- // IE doesn't return new length on unshift
- gd.unshift([gd[0][0], gridymin]);
- var len = gd.length;
- gd.push([gd[len - 1][0], gridymin]);
- }
- // if stacked, fill to line below
- else {
- var prev = this._prevGridData;
- for (var i=prev.length; i>0; i--) {
- gd.push(prev[i-1]);
- }
- }
- this._areaPoints = gd;
-
- if (shadow) {
- this.renderer.shadowRenderer.draw(ctx, gd, opts);
- }
-
- this.renderer.shapeRenderer.draw(ctx, gd, opts);
- }
- if (fillAndStroke) {
- var fasopts = $.extend(true, {}, opts, {fill:false, closePath:false});
- this.renderer.shapeRenderer.draw(ctx, fasgd, fasopts);
- //////////
- // TODO: figure out some way to do shadows nicely
- // if (shadow) {
- // this.renderer.shadowRenderer.draw(ctx, fasgd, fasopts);
- // }
- // now draw the markers
- if (this.markerRenderer.show) {
- if (this.renderer.smooth) {
- fasgd = this.gridData;
- }
- for (i=0; i p[0] || xmin == null) {
- xmin = p[0];
- }
- if (ymax < p[1] || ymax == null) {
- ymax = p[1];
- }
- if (xmax < p[0] || xmax == null) {
- xmax = p[0];
- }
- if (ymin > p[1] || ymin == null) {
- ymin = p[1];
- }
- }
-
- if (this.type === 'line' && this.renderer.bands.show) {
- ymax = this._yaxis.series_u2p(this.renderer.bands._min);
- ymin = this._yaxis.series_u2p(this.renderer.bands._max);
- }
-
- this._boundingBox = [[xmin, ymax], [xmax, ymin]];
-
- // now draw the markers
- if (this.markerRenderer.show && !fill) {
- if (this.renderer.smooth) {
- gd = this.gridData;
- }
- for (i=0; i dim) {
- dim = temp;
- }
- }
- }
- tick = null;
- t = null;
-
- if (lshow) {
- w = this._label._elem.outerWidth(true);
- h = this._label._elem.outerHeight(true);
- }
- if (this.name == 'xaxis') {
- dim = dim + h;
- this._elem.css({'height':dim+'px', left:'0px', bottom:'0px'});
- }
- else if (this.name == 'x2axis') {
- dim = dim + h;
- this._elem.css({'height':dim+'px', left:'0px', top:'0px'});
- }
- else if (this.name == 'yaxis') {
- dim = dim + w;
- this._elem.css({'width':dim+'px', left:'0px', top:'0px'});
- if (lshow && this._label.constructor == $.jqplot.AxisLabelRenderer) {
- this._label._elem.css('width', w+'px');
- }
- }
- else {
- dim = dim + w;
- this._elem.css({'width':dim+'px', right:'0px', top:'0px'});
- if (lshow && this._label.constructor == $.jqplot.AxisLabelRenderer) {
- this._label._elem.css('width', w+'px');
- }
- }
- }
- };
-
- // called with scope of axis
- $.jqplot.LinearAxisRenderer.prototype.createTicks = function(plot) {
- // we're are operating on an axis here
- var ticks = this._ticks;
- var userTicks = this.ticks;
- var name = this.name;
- // databounds were set on axis initialization.
- var db = this._dataBounds;
- var dim = (this.name.charAt(0) === 'x') ? this._plotDimensions.width : this._plotDimensions.height;
- var interval;
- var min, max;
- var pos1, pos2;
- var tt, i;
- // get a copy of user's settings for min/max.
- var userMin = this.min;
- var userMax = this.max;
- var userNT = this.numberTicks;
- var userTI = this.tickInterval;
-
- var threshold = 30;
- this._scalefact = (Math.max(dim, threshold+1) - threshold)/300.0;
-
- // if we already have ticks, use them.
- // ticks must be in order of increasing value.
-
- if (userTicks.length) {
- // ticks could be 1D or 2D array of [val, val, ,,,] or [[val, label], [val, label], ...] or mixed
- for (i=0; i this.breakPoints[0] && ut[0] <= this.breakPoints[1]) {
- t.show = false;
- t.showGridline = false;
- t.label = ut[1];
- }
- else {
- t.label = ut[1];
- }
- }
- else {
- t.label = ut[1];
- }
- t.setTick(ut[0], this.name);
- this._ticks.push(t);
- }
-
- else if ($.isPlainObject(ut)) {
- $.extend(true, t, ut);
- t.axis = this.name;
- this._ticks.push(t);
- }
-
- else {
- t.value = ut;
- if (this.breakPoints) {
- if (ut == this.breakPoints[0]) {
- t.label = this.breakTickLabel;
- t._breakTick = true;
- t.showGridline = false;
- t.showMark = false;
- }
- else if (ut > this.breakPoints[0] && ut <= this.breakPoints[1]) {
- t.show = false;
- t.showGridline = false;
- }
- }
- t.setTick(ut, this.name);
- this._ticks.push(t);
- }
- }
- this.numberTicks = userTicks.length;
- this.min = this._ticks[0].value;
- this.max = this._ticks[this.numberTicks-1].value;
- this.tickInterval = (this.max - this.min) / (this.numberTicks - 1);
- }
-
- // we don't have any ticks yet, let's make some!
- else {
- if (name == 'xaxis' || name == 'x2axis') {
- dim = this._plotDimensions.width;
- }
- else {
- dim = this._plotDimensions.height;
- }
-
- var _numberTicks = this.numberTicks;
-
- // if aligning this axis, use number of ticks from previous axis.
- // Do I need to reset somehow if alignTicks is changed and then graph is replotted??
- if (this.alignTicks) {
- if (this.name === 'x2axis' && plot.axes.xaxis.show) {
- _numberTicks = plot.axes.xaxis.numberTicks;
- }
- else if (this.name.charAt(0) === 'y' && this.name !== 'yaxis' && this.name !== 'yMidAxis' && plot.axes.yaxis.show) {
- _numberTicks = plot.axes.yaxis.numberTicks;
- }
- }
-
- min = ((this.min != null) ? this.min : db.min);
- max = ((this.max != null) ? this.max : db.max);
-
- var range = max - min;
- var rmin, rmax;
- var temp;
-
- if (this.tickOptions == null || !this.tickOptions.formatString) {
- this._overrideFormatString = true;
- }
-
- // Doing complete autoscaling
- if (this.min == null && this.max == null && this.tickInterval == null && !this.autoscale) {
- // Check if user must have tick at 0 or 100 and ensure they are in range.
- // The autoscaling algorithm will always place ticks at 0 and 100 if they are in range.
- if (this.forceTickAt0) {
- if (min > 0) {
- min = 0;
- }
- if (max < 0) {
- max = 0;
- }
- }
-
- if (this.forceTickAt100) {
- if (min > 100) {
- min = 100;
- }
- if (max < 100) {
- max = 100;
- }
- }
-
- // var threshold = 30;
- // var tdim = Math.max(dim, threshold+1);
- // this._scalefact = (tdim-threshold)/300.0;
- var ret = $.jqplot.LinearTickGenerator(min, max, this._scalefact, _numberTicks);
- // calculate a padded max and min, points should be less than these
- // so that they aren't too close to the edges of the plot.
- // User can adjust how much padding is allowed with pad, padMin and PadMax options.
- var tumin = min + range*(this.padMin - 1);
- var tumax = max - range*(this.padMax - 1);
-
- // if they're equal, we shouldn't have to do anything, right?
- // if (min <=tumin || max >= tumax) {
- if (min tumax) {
- tumin = min - range*(this.padMin - 1);
- tumax = max + range*(this.padMax - 1);
- ret = $.jqplot.LinearTickGenerator(tumin, tumax, this._scalefact, _numberTicks);
- }
-
- this.min = ret[0];
- this.max = ret[1];
- // if numberTicks specified, it should return the same.
- this.numberTicks = ret[2];
- this._autoFormatString = ret[3];
- this.tickInterval = ret[4];
- }
-
- // User has specified some axis scale related option, can use auto algorithm
- else {
-
- // if min and max are same, space them out a bit
- if (min == max) {
- var adj = 0.05;
- if (min > 0) {
- adj = Math.max(Math.log(min)/Math.LN10, 0.05);
- }
- min -= adj;
- max += adj;
- }
-
- // autoscale. Can't autoscale if min or max is supplied.
- // Will use numberTicks and tickInterval if supplied. Ticks
- // across multiple axes may not line up depending on how
- // bars are to be plotted.
- if (this.autoscale && this.min == null && this.max == null) {
- var rrange, ti, margin;
- var forceMinZero = false;
- var forceZeroLine = false;
- var intervals = {min:null, max:null, average:null, stddev:null};
- // if any series are bars, or if any are fill to zero, and if this
- // is the axis to fill toward, check to see if we can start axis at zero.
- for (var i=0; i vmax) {
- vmax = vals[j];
- }
- }
- var dp = (vmax - vmin) / vmax;
- // is this sries a bar?
- if (s.renderer.constructor == $.jqplot.BarRenderer) {
- // if no negative values and could also check range.
- if (vmin >= 0 && (s.fillToZero || dp > 0.1)) {
- forceMinZero = true;
- }
- else {
- forceMinZero = false;
- if (s.fill && s.fillToZero && vmin < 0 && vmax > 0) {
- forceZeroLine = true;
- }
- else {
- forceZeroLine = false;
- }
- }
- }
-
- // if not a bar and filling, use appropriate method.
- else if (s.fill) {
- if (vmin >= 0 && (s.fillToZero || dp > 0.1)) {
- forceMinZero = true;
- }
- else if (vmin < 0 && vmax > 0 && s.fillToZero) {
- forceMinZero = false;
- forceZeroLine = true;
- }
- else {
- forceMinZero = false;
- forceZeroLine = false;
- }
- }
-
- // if not a bar and not filling, only change existing state
- // if it doesn't make sense
- else if (vmin < 0) {
- forceMinZero = false;
- }
- }
- }
-
- // check if we need make axis min at 0.
- if (forceMinZero) {
- // compute number of ticks
- this.numberTicks = 2 + Math.ceil((dim-(this.tickSpacing-1))/this.tickSpacing);
- this.min = 0;
- userMin = 0;
- // what order is this range?
- // what tick interval does that give us?
- ti = max/(this.numberTicks-1);
- temp = Math.pow(10, Math.abs(Math.floor(Math.log(ti)/Math.LN10)));
- if (ti/temp == parseInt(ti/temp, 10)) {
- ti += temp;
- }
- this.tickInterval = Math.ceil(ti/temp) * temp;
- this.max = this.tickInterval * (this.numberTicks - 1);
- }
-
- // check if we need to make sure there is a tick at 0.
- else if (forceZeroLine) {
- // compute number of ticks
- this.numberTicks = 2 + Math.ceil((dim-(this.tickSpacing-1))/this.tickSpacing);
- var ntmin = Math.ceil(Math.abs(min)/range*(this.numberTicks-1));
- var ntmax = this.numberTicks - 1 - ntmin;
- ti = Math.max(Math.abs(min/ntmin), Math.abs(max/ntmax));
- temp = Math.pow(10, Math.abs(Math.floor(Math.log(ti)/Math.LN10)));
- this.tickInterval = Math.ceil(ti/temp) * temp;
- this.max = this.tickInterval * ntmax;
- this.min = -this.tickInterval * ntmin;
- }
-
- // if nothing else, do autoscaling which will try to line up ticks across axes.
- else {
- if (this.numberTicks == null){
- if (this.tickInterval) {
- this.numberTicks = 3 + Math.ceil(range / this.tickInterval);
- }
- else {
- this.numberTicks = 2 + Math.ceil((dim-(this.tickSpacing-1))/this.tickSpacing);
- }
- }
-
- if (this.tickInterval == null) {
- // get a tick interval
- ti = range/(this.numberTicks - 1);
-
- if (ti < 1) {
- temp = Math.pow(10, Math.abs(Math.floor(Math.log(ti)/Math.LN10)));
- }
- else {
- temp = 1;
- }
- this.tickInterval = Math.ceil(ti*temp*this.pad)/temp;
- }
- else {
- temp = 1 / this.tickInterval;
- }
-
- // try to compute a nicer, more even tick interval
- // temp = Math.pow(10, Math.floor(Math.log(ti)/Math.LN10));
- // this.tickInterval = Math.ceil(ti/temp) * temp;
- rrange = this.tickInterval * (this.numberTicks - 1);
- margin = (rrange - range)/2;
-
- if (this.min == null) {
- this.min = Math.floor(temp*(min-margin))/temp;
- }
- if (this.max == null) {
- this.max = this.min + rrange;
- }
- }
-
- // Compute a somewhat decent format string if it is needed.
- // get precision of interval and determine a format string.
- var sf = $.jqplot.getSignificantFigures(this.tickInterval);
-
- var fstr;
-
- // if we have only a whole number, use integer formatting
- if (sf.digitsLeft >= sf.significantDigits) {
- fstr = '%d';
- }
-
- else {
- var temp = Math.max(0, 5 - sf.digitsLeft);
- temp = Math.min(temp, sf.digitsRight);
- fstr = '%.'+ temp + 'f';
- }
-
- this._autoFormatString = fstr;
- }
-
- // Use the default algorithm which pads each axis to make the chart
- // centered nicely on the grid.
- else {
-
- rmin = (this.min != null) ? this.min : min - range*(this.padMin - 1);
- rmax = (this.max != null) ? this.max : max + range*(this.padMax - 1);
- range = rmax - rmin;
-
- if (this.numberTicks == null){
- // if tickInterval is specified by user, we will ignore computed maximum.
- // max will be equal or greater to fit even # of ticks.
- if (this.tickInterval != null) {
- this.numberTicks = Math.ceil((rmax - rmin)/this.tickInterval)+1;
- }
- else if (dim > 100) {
- this.numberTicks = parseInt(3+(dim-100)/75, 10);
- }
- else {
- this.numberTicks = 2;
- }
- }
-
- if (this.tickInterval == null) {
- this.tickInterval = range / (this.numberTicks-1);
- }
-
- if (this.max == null) {
- rmax = rmin + this.tickInterval*(this.numberTicks - 1);
- }
- if (this.min == null) {
- rmin = rmax - this.tickInterval*(this.numberTicks - 1);
- }
-
- // get precision of interval and determine a format string.
- var sf = $.jqplot.getSignificantFigures(this.tickInterval);
-
- var fstr;
-
- // if we have only a whole number, use integer formatting
- if (sf.digitsLeft >= sf.significantDigits) {
- fstr = '%d';
- }
-
- else {
- var temp = Math.max(0, 5 - sf.digitsLeft);
- temp = Math.min(temp, sf.digitsRight);
- fstr = '%.'+ temp + 'f';
- }
-
-
- this._autoFormatString = fstr;
-
- this.min = rmin;
- this.max = rmax;
- }
-
- if (this.renderer.constructor == $.jqplot.LinearAxisRenderer && this._autoFormatString == '') {
- // fix for misleading tick display with small range and low precision.
- range = this.max - this.min;
- // figure out precision
- var temptick = new this.tickRenderer(this.tickOptions);
- // use the tick formatString or, the default.
- var fs = temptick.formatString || $.jqplot.config.defaultTickFormatString;
- var fs = fs.match($.jqplot.sprintf.regex)[0];
- var precision = 0;
- if (fs) {
- if (fs.search(/[fFeEgGpP]/) > -1) {
- var m = fs.match(/\%\.(\d{0,})?[eEfFgGpP]/);
- if (m) {
- precision = parseInt(m[1], 10);
- }
- else {
- precision = 6;
- }
- }
- else if (fs.search(/[di]/) > -1) {
- precision = 0;
- }
- // fact will be <= 1;
- var fact = Math.pow(10, -precision);
- if (this.tickInterval < fact) {
- // need to correct underrange
- if (userNT == null && userTI == null) {
- this.tickInterval = fact;
- if (userMax == null && userMin == null) {
- // this.min = Math.floor((this._dataBounds.min - this.tickInterval)/fact) * fact;
- this.min = Math.floor(this._dataBounds.min/fact) * fact;
- if (this.min == this._dataBounds.min) {
- this.min = this._dataBounds.min - this.tickInterval;
- }
- // this.max = Math.ceil((this._dataBounds.max + this.tickInterval)/fact) * fact;
- this.max = Math.ceil(this._dataBounds.max/fact) * fact;
- if (this.max == this._dataBounds.max) {
- this.max = this._dataBounds.max + this.tickInterval;
- }
- var n = (this.max - this.min)/this.tickInterval;
- n = n.toFixed(11);
- n = Math.ceil(n);
- this.numberTicks = n + 1;
- }
- else if (userMax == null) {
- // add one tick for top of range.
- var n = (this._dataBounds.max - this.min) / this.tickInterval;
- n = n.toFixed(11);
- this.numberTicks = Math.ceil(n) + 2;
- this.max = this.min + this.tickInterval * (this.numberTicks-1);
- }
- else if (userMin == null) {
- // add one tick for bottom of range.
- var n = (this.max - this._dataBounds.min) / this.tickInterval;
- n = n.toFixed(11);
- this.numberTicks = Math.ceil(n) + 2;
- this.min = this.max - this.tickInterval * (this.numberTicks-1);
- }
- else {
- // calculate a number of ticks so max is within axis scale
- this.numberTicks = Math.ceil((userMax - userMin)/this.tickInterval) + 1;
- // if user's min and max don't fit evenly in ticks, adjust.
- // This takes care of cases such as user min set to 0, max set to 3.5 but tick
- // format string set to %d (integer ticks)
- this.min = Math.floor(userMin*Math.pow(10, precision))/Math.pow(10, precision);
- this.max = Math.ceil(userMax*Math.pow(10, precision))/Math.pow(10, precision);
- // this.max = this.min + this.tickInterval*(this.numberTicks-1);
- this.numberTicks = Math.ceil((this.max - this.min)/this.tickInterval) + 1;
- }
- }
- }
- }
- }
-
- }
-
- if (this._overrideFormatString && this._autoFormatString != '') {
- this.tickOptions = this.tickOptions || {};
- this.tickOptions.formatString = this._autoFormatString;
- }
-
- var t, to;
- for (var i=0; i plot.axes.yaxis.renderer.resetTickValues.call(plot.axes.yaxis, yarr);
- //
- $.jqplot.LinearAxisRenderer.prototype.resetTickValues = function(opts) {
- if ($.isArray(opts) && opts.length == this._ticks.length) {
- var t;
- for (var i=0; i this.breakPoints[0] && u < this.breakPoints[1]){
- u = this.breakPoints[0];
- }
- if (u <= this.breakPoints[0]) {
- return (u - min) * pixellength / unitlength + offmin;
- }
- else {
- return (u - this.breakPoints[1] + this.breakPoints[0] - min) * pixellength / unitlength + offmin;
- }
- };
-
- if (this.name.charAt(0) == 'x'){
- this.series_u2p = function(u){
- if (u > this.breakPoints[0] && u < this.breakPoints[1]){
- u = this.breakPoints[0];
- }
- if (u <= this.breakPoints[0]) {
- return (u - min) * pixellength / unitlength;
- }
- else {
- return (u - this.breakPoints[1] + this.breakPoints[0] - min) * pixellength / unitlength;
- }
- };
- this.series_p2u = function(p){
- return p * unitlength / pixellength + min;
- };
- }
-
- else {
- this.series_u2p = function(u){
- if (u > this.breakPoints[0] && u < this.breakPoints[1]){
- u = this.breakPoints[0];
- }
- if (u >= this.breakPoints[1]) {
- return (u - max) * pixellength / unitlength;
- }
- else {
- return (u + this.breakPoints[1] - this.breakPoints[0] - max) * pixellength / unitlength;
- }
- };
- this.series_p2u = function(p){
- return p * unitlength / pixellength + max;
- };
- }
- }
- else {
- this.p2u = function(p){
- return (p - offmin) * unitlength / pixellength + min;
- };
-
- this.u2p = function(u){
- return (u - min) * pixellength / unitlength + offmin;
- };
-
- if (this.name == 'xaxis' || this.name == 'x2axis'){
- this.series_u2p = function(u){
- return (u - min) * pixellength / unitlength;
- };
- this.series_p2u = function(p){
- return p * unitlength / pixellength + min;
- };
- }
-
- else {
- this.series_u2p = function(u){
- return (u - max) * pixellength / unitlength;
- };
- this.series_p2u = function(p){
- return p * unitlength / pixellength + max;
- };
- }
- }
-
- if (this.show) {
- if (this.name == 'xaxis' || this.name == 'x2axis') {
- for (var i=0; i 0) {
- shim = -t._textRenderer.height * Math.cos(-t._textRenderer.angle) / 2;
- }
- else {
- shim = -t.getHeight() + t._textRenderer.height * Math.cos(t._textRenderer.angle) / 2;
- }
- break;
- case 'middle':
- // if (t.angle > 0) {
- // shim = -t.getHeight()/2 + t._textRenderer.height * Math.sin(-t._textRenderer.angle) / 2;
- // }
- // else {
- // shim = -t.getHeight()/2 - t._textRenderer.height * Math.sin(t._textRenderer.angle) / 2;
- // }
- shim = -t.getHeight()/2;
- break;
- default:
- shim = -t.getHeight()/2;
- break;
- }
- }
- else {
- shim = -t.getHeight()/2;
- }
-
- var val = this.u2p(t.value) + shim + 'px';
- t._elem.css('top', val);
- t.pack();
- }
- }
- if (lshow) {
- var h = this._label._elem.outerHeight(true);
- this._label._elem.css('top', offmax - pixellength/2 - h/2 + 'px');
- if (this.name == 'yaxis') {
- this._label._elem.css('left', '0px');
- }
- else {
- this._label._elem.css('right', '0px');
- }
- this._label.pack();
- }
- }
- }
-
- ticks = null;
- };
-
-
- /**
- * The following code was generaously given to me a while back by Scott Prahl.
- * He did a good job at computing axes min, max and number of ticks for the
- * case where the user has not set any scale related parameters (tickInterval,
- * numberTicks, min or max). I had ignored this use case for a long time,
- * focusing on the more difficult case where user has set some option controlling
- * tick generation. Anyway, about time I got this into jqPlot.
- * Thanks Scott!!
- */
-
- /**
- * Copyright (c) 2010 Scott Prahl
- * The next three routines are currently available for use in all personal
- * or commercial projects under both the MIT and GPL version 2.0 licenses.
- * This means that you can choose the license that best suits your project
- * and use it accordingly.
- */
-
- // A good format string depends on the interval. If the interval is greater
- // than 1 then there is no need to show any decimal digits. If it is < 1.0, then
- // use the magnitude of the interval to determine the number of digits to show.
- function bestFormatString (interval)
- {
- var fstr;
- interval = Math.abs(interval);
- if (interval >= 10) {
- fstr = '%d';
- }
-
- else if (interval > 1) {
- if (interval === parseInt(interval, 10)) {
- fstr = '%d';
- }
- else {
- fstr = '%.1f';
- }
- }
-
- else {
- var expv = -Math.floor(Math.log(interval)/Math.LN10);
- fstr = '%.' + expv + 'f';
- }
-
- return fstr;
- }
-
- var _factors = [0.1, 0.2, 0.3, 0.4, 0.5, 0.8, 1, 2, 3, 4, 5];
-
- var _getLowerFactor = function(f) {
- var i = _factors.indexOf(f);
- if (i > 0) {
- return _factors[i-1];
- }
- else {
- return _factors[_factors.length - 1] / 100;
- }
- };
-
- var _getHigherFactor = function(f) {
- var i = _factors.indexOf(f);
- if (i < _factors.length-1) {
- return _factors[i+1];
- }
- else {
- return _factors[0] * 100;
- }
- };
-
- // Given a fixed minimum and maximum and a target number ot ticks
- // figure out the best interval and
- // return min, max, number ticks, format string and tick interval
- function bestConstrainedInterval(min, max, nttarget) {
- // run through possible number to ticks and see which interval is best
- var low = Math.floor(nttarget/2);
- var hi = Math.ceil(nttarget*1.5);
- var badness = Number.MAX_VALUE;
- var r = (max - min);
- var temp;
- var sd;
- var bestNT;
- var fsd;
- var fs;
- var gsf = $.jqplot.getSignificantFigures;
- var currentNT;
- var bestPrec;
-
- for (var i=0, l=hi-low+1; i 5) {
- interval = 10 * magnitude;
- }
- else if (residual > 2) {
- interval = 5 * magnitude;
- }
- else if (residual > 1) {
- interval = 2 * magnitude;
- }
- else {
- interval = magnitude;
- }
- }
- // for large ranges (whole integers), allow intervals like 3, 4 or powers of these.
- // this helps a lot with poor choices for number of ticks.
- else {
- if (residual > 5) {
- interval = 10 * magnitude;
- }
- else if (residual > 4) {
- interval = 5 * magnitude;
- }
- else if (residual > 3) {
- interval = 4 * magnitude;
- }
- else if (residual > 2) {
- interval = 3 * magnitude;
- }
- else if (residual > 1) {
- interval = 2 * magnitude;
- }
- else {
- interval = magnitude;
- }
- }
-
- return interval;
- }
-
- // This will return an interval of form 2 * 10^n, 5 * 10^n or 10 * 10^n
- // it is based soley on the range of data, number of ticks must be computed later.
- function bestLinearInterval(range, scalefact) {
- scalefact = scalefact || 1;
- var expv = Math.floor(Math.log(range)/Math.LN10);
- var magnitude = Math.pow(10, expv);
- // 0 < f < 10
- var f = range / magnitude;
- var fact;
- // for large plots, scalefact will decrease f and increase number of ticks.
- // for small plots, scalefact will increase f and decrease number of ticks.
- f = f/scalefact;
-
- // for large plots, smaller interval, more ticks.
- if (f<=0.38) {
- fact = 0.1;
- }
- else if (f<=1.6) {
- fact = 0.2;
- }
- else if (f<=4.0) {
- fact = 0.5;
- }
- else if (f<=8.0) {
- fact = 1.0;
- }
- // for very small plots, larger interval, less ticks in number ticks
- else if (f<=16.0) {
- fact = 2;
- }
- else {
- fact = 5;
- }
-
- return fact*magnitude;
- }
-
- function bestLinearComponents(range, scalefact) {
- var expv = Math.floor(Math.log(range)/Math.LN10);
- var magnitude = Math.pow(10, expv);
- // 0 < f < 10
- var f = range / magnitude;
- var interval;
- var fact;
- // for large plots, scalefact will decrease f and increase number of ticks.
- // for small plots, scalefact will increase f and decrease number of ticks.
- f = f/scalefact;
-
- // for large plots, smaller interval, more ticks.
- if (f<=0.38) {
- fact = 0.1;
- }
- else if (f<=1.6) {
- fact = 0.2;
- }
- else if (f<=4.0) {
- fact = 0.5;
- }
- else if (f<=8.0) {
- fact = 1.0;
- }
- // for very small plots, larger interval, less ticks in number ticks
- else if (f<=16.0) {
- fact = 2;
- }
- // else if (f<=20.0) {
- // fact = 3;
- // }
- // else if (f<=24.0) {
- // fact = 4;
- // }
- else {
- fact = 5;
- }
-
- interval = fact * magnitude;
-
- return [interval, fact, magnitude];
- }
-
- // Given the min and max for a dataset, return suitable endpoints
- // for the graphing, a good number for the number of ticks, and a
- // format string so that extraneous digits are not displayed.
- // returned is an array containing [min, max, nTicks, format]
- $.jqplot.LinearTickGenerator = function(axis_min, axis_max, scalefact, numberTicks) {
- // if endpoints are equal try to include zero otherwise include one
- if (axis_min === axis_max) {
- axis_max = (axis_max) ? 0 : 1;
- }
-
- scalefact = scalefact || 1.0;
-
- // make sure range is positive
- if (axis_max < axis_min) {
- var a = axis_max;
- axis_max = axis_min;
- axis_min = a;
- }
-
- var r = [];
- var ss = bestLinearInterval(axis_max - axis_min, scalefact);
-
- if (numberTicks == null) {
-
- // Figure out the axis min, max and number of ticks
- // the min and max will be some multiple of the tick interval,
- // 1*10^n, 2*10^n or 5*10^n. This gaurantees that, if the
- // axis min is negative, 0 will be a tick.
- r[0] = Math.floor(axis_min / ss) * ss; // min
- r[1] = Math.ceil(axis_max / ss) * ss; // max
- r[2] = Math.round((r[1]-r[0])/ss+1.0); // number of ticks
- r[3] = bestFormatString(ss); // format string
- r[4] = ss; // tick Interval
- }
-
- else {
- var tempr = [];
-
- // Figure out the axis min, max and number of ticks
- // the min and max will be some multiple of the tick interval,
- // 1*10^n, 2*10^n or 5*10^n. This gaurantees that, if the
- // axis min is negative, 0 will be a tick.
- tempr[0] = Math.floor(axis_min / ss) * ss; // min
- tempr[1] = Math.ceil(axis_max / ss) * ss; // max
- tempr[2] = Math.round((tempr[1]-tempr[0])/ss+1.0); // number of ticks
- tempr[3] = bestFormatString(ss); // format string
- tempr[4] = ss; // tick Interval
-
- // first, see if we happen to get the right number of ticks
- if (tempr[2] === numberTicks) {
- r = tempr;
- }
-
- else {
-
- var newti = bestInterval(tempr[1] - tempr[0], numberTicks);
-
- r[0] = tempr[0];
- r[2] = numberTicks;
- r[4] = newti;
- r[3] = bestFormatString(newti);
- r[1] = r[0] + (r[2] - 1) * r[4]; // max
- }
- }
-
- return r;
- };
-
- $.jqplot.LinearTickGenerator.bestLinearInterval = bestLinearInterval;
- $.jqplot.LinearTickGenerator.bestInterval = bestInterval;
- $.jqplot.LinearTickGenerator.bestLinearComponents = bestLinearComponents;
- $.jqplot.LinearTickGenerator.bestConstrainedInterval = bestConstrainedInterval;
-
-
- // class: $.jqplot.MarkerRenderer
- // The default jqPlot marker renderer, rendering the points on the line.
- $.jqplot.MarkerRenderer = function(options){
- // Group: Properties
-
- // prop: show
- // wether or not to show the marker.
- this.show = true;
- // prop: style
- // One of diamond, circle, square, x, plus, dash, filledDiamond, filledCircle, filledSquare
- this.style = 'filledCircle';
- // prop: lineWidth
- // size of the line for non-filled markers.
- this.lineWidth = 2;
- // prop: size
- // Size of the marker (diameter or circle, length of edge of square, etc.)
- this.size = 9.0;
- // prop: color
- // color of marker. Will be set to color of series by default on init.
- this.color = '#666666';
- // prop: shadow
- // wether or not to draw a shadow on the line
- this.shadow = true;
- // prop: shadowAngle
- // Shadow angle in degrees
- this.shadowAngle = 45;
- // prop: shadowOffset
- // Shadow offset from line in pixels
- this.shadowOffset = 1;
- // prop: shadowDepth
- // Number of times shadow is stroked, each stroke offset shadowOffset from the last.
- this.shadowDepth = 3;
- // prop: shadowAlpha
- // Alpha channel transparency of shadow. 0 = transparent.
- this.shadowAlpha = '0.07';
- // prop: shadowRenderer
- // Renderer that will draws the shadows on the marker.
- this.shadowRenderer = new $.jqplot.ShadowRenderer();
- // prop: shapeRenderer
- // Renderer that will draw the marker.
- this.shapeRenderer = new $.jqplot.ShapeRenderer();
-
- $.extend(true, this, options);
- };
-
- $.jqplot.MarkerRenderer.prototype.init = function(options) {
- $.extend(true, this, options);
- var sdopt = {angle:this.shadowAngle, offset:this.shadowOffset, alpha:this.shadowAlpha, lineWidth:this.lineWidth, depth:this.shadowDepth, closePath:true};
- if (this.style.indexOf('filled') != -1) {
- sdopt.fill = true;
- }
- if (this.style.indexOf('ircle') != -1) {
- sdopt.isarc = true;
- sdopt.closePath = false;
- }
- this.shadowRenderer.init(sdopt);
-
- var shopt = {fill:false, isarc:false, strokeStyle:this.color, fillStyle:this.color, lineWidth:this.lineWidth, closePath:true};
- if (this.style.indexOf('filled') != -1) {
- shopt.fill = true;
- }
- if (this.style.indexOf('ircle') != -1) {
- shopt.isarc = true;
- shopt.closePath = false;
- }
- this.shapeRenderer.init(shopt);
- };
-
- $.jqplot.MarkerRenderer.prototype.drawDiamond = function(x, y, ctx, fill, options) {
- var stretch = 1.2;
- var dx = this.size/2/stretch;
- var dy = this.size/2*stretch;
- var points = [[x-dx, y], [x, y+dy], [x+dx, y], [x, y-dy]];
- if (this.shadow) {
- this.shadowRenderer.draw(ctx, points);
- }
- this.shapeRenderer.draw(ctx, points, options);
- };
-
- $.jqplot.MarkerRenderer.prototype.drawPlus = function(x, y, ctx, fill, options) {
- var stretch = 1.0;
- var dx = this.size/2*stretch;
- var dy = this.size/2*stretch;
- var points1 = [[x, y-dy], [x, y+dy]];
- var points2 = [[x+dx, y], [x-dx, y]];
- var opts = $.extend(true, {}, this.options, {closePath:false});
- if (this.shadow) {
- this.shadowRenderer.draw(ctx, points1, {closePath:false});
- this.shadowRenderer.draw(ctx, points2, {closePath:false});
- }
- this.shapeRenderer.draw(ctx, points1, opts);
- this.shapeRenderer.draw(ctx, points2, opts);
- };
-
- $.jqplot.MarkerRenderer.prototype.drawX = function(x, y, ctx, fill, options) {
- var stretch = 1.0;
- var dx = this.size/2*stretch;
- var dy = this.size/2*stretch;
- var opts = $.extend(true, {}, this.options, {closePath:false});
- var points1 = [[x-dx, y-dy], [x+dx, y+dy]];
- var points2 = [[x-dx, y+dy], [x+dx, y-dy]];
- if (this.shadow) {
- this.shadowRenderer.draw(ctx, points1, {closePath:false});
- this.shadowRenderer.draw(ctx, points2, {closePath:false});
- }
- this.shapeRenderer.draw(ctx, points1, opts);
- this.shapeRenderer.draw(ctx, points2, opts);
- };
-
- $.jqplot.MarkerRenderer.prototype.drawDash = function(x, y, ctx, fill, options) {
- var stretch = 1.0;
- var dx = this.size/2*stretch;
- var dy = this.size/2*stretch;
- var points = [[x-dx, y], [x+dx, y]];
- if (this.shadow) {
- this.shadowRenderer.draw(ctx, points);
- }
- this.shapeRenderer.draw(ctx, points, options);
- };
-
- $.jqplot.MarkerRenderer.prototype.drawLine = function(p1, p2, ctx, fill, options) {
- var points = [p1, p2];
- if (this.shadow) {
- this.shadowRenderer.draw(ctx, points);
- }
- this.shapeRenderer.draw(ctx, points, options);
- };
-
- $.jqplot.MarkerRenderer.prototype.drawSquare = function(x, y, ctx, fill, options) {
- var stretch = 1.0;
- var dx = this.size/2/stretch;
- var dy = this.size/2*stretch;
- var points = [[x-dx, y-dy], [x-dx, y+dy], [x+dx, y+dy], [x+dx, y-dy]];
- if (this.shadow) {
- this.shadowRenderer.draw(ctx, points);
- }
- this.shapeRenderer.draw(ctx, points, options);
- };
-
- $.jqplot.MarkerRenderer.prototype.drawCircle = function(x, y, ctx, fill, options) {
- var radius = this.size/2;
- var end = 2*Math.PI;
- var points = [x, y, radius, 0, end, true];
- if (this.shadow) {
- this.shadowRenderer.draw(ctx, points);
- }
- this.shapeRenderer.draw(ctx, points, options);
- };
-
- $.jqplot.MarkerRenderer.prototype.draw = function(x, y, ctx, options) {
- options = options || {};
- // hack here b/c shape renderer uses canvas based color style options
- // and marker uses css style names.
- if (options.show == null || options.show != false) {
- if (options.color && !options.fillStyle) {
- options.fillStyle = options.color;
- }
- if (options.color && !options.strokeStyle) {
- options.strokeStyle = options.color;
- }
- switch (this.style) {
- case 'diamond':
- this.drawDiamond(x,y,ctx, false, options);
- break;
- case 'filledDiamond':
- this.drawDiamond(x,y,ctx, true, options);
- break;
- case 'circle':
- this.drawCircle(x,y,ctx, false, options);
- break;
- case 'filledCircle':
- this.drawCircle(x,y,ctx, true, options);
- break;
- case 'square':
- this.drawSquare(x,y,ctx, false, options);
- break;
- case 'filledSquare':
- this.drawSquare(x,y,ctx, true, options);
- break;
- case 'x':
- this.drawX(x,y,ctx, true, options);
- break;
- case 'plus':
- this.drawPlus(x,y,ctx, true, options);
- break;
- case 'dash':
- this.drawDash(x,y,ctx, true, options);
- break;
- case 'line':
- this.drawLine(x, y, ctx, false, options);
- break;
- default:
- this.drawDiamond(x,y,ctx, false, options);
- break;
- }
- }
- };
-
- // class: $.jqplot.shadowRenderer
- // The default jqPlot shadow renderer, rendering shadows behind shapes.
- $.jqplot.ShadowRenderer = function(options){
- // Group: Properties
-
- // prop: angle
- // Angle of the shadow in degrees. Measured counter-clockwise from the x axis.
- this.angle = 45;
- // prop: offset
- // Pixel offset at the given shadow angle of each shadow stroke from the last stroke.
- this.offset = 1;
- // prop: alpha
- // alpha transparency of shadow stroke.
- this.alpha = 0.07;
- // prop: lineWidth
- // width of the shadow line stroke.
- this.lineWidth = 1.5;
- // prop: lineJoin
- // How line segments of the shadow are joined.
- this.lineJoin = 'miter';
- // prop: lineCap
- // how ends of the shadow line are rendered.
- this.lineCap = 'round';
- // prop; closePath
- // whether line path segment is closed upon itself.
- this.closePath = false;
- // prop: fill
- // whether to fill the shape.
- this.fill = false;
- // prop: depth
- // how many times the shadow is stroked. Each stroke will be offset by offset at angle degrees.
- this.depth = 3;
- this.strokeStyle = 'rgba(0,0,0,0.1)';
- // prop: isarc
- // wether the shadow is an arc or not.
- this.isarc = false;
-
- $.extend(true, this, options);
- };
-
- $.jqplot.ShadowRenderer.prototype.init = function(options) {
- $.extend(true, this, options);
- };
-
- // function: draw
- // draws an transparent black (i.e. gray) shadow.
- //
- // ctx - canvas drawing context
- // points - array of points or [x, y, radius, start angle (rad), end angle (rad)]
- $.jqplot.ShadowRenderer.prototype.draw = function(ctx, points, options) {
- ctx.save();
- var opts = (options != null) ? options : {};
- var fill = (opts.fill != null) ? opts.fill : this.fill;
- var fillRect = (opts.fillRect != null) ? opts.fillRect : this.fillRect;
- var closePath = (opts.closePath != null) ? opts.closePath : this.closePath;
- var offset = (opts.offset != null) ? opts.offset : this.offset;
- var alpha = (opts.alpha != null) ? opts.alpha : this.alpha;
- var depth = (opts.depth != null) ? opts.depth : this.depth;
- var isarc = (opts.isarc != null) ? opts.isarc : this.isarc;
- var linePattern = (opts.linePattern != null) ? opts.linePattern : this.linePattern;
- ctx.lineWidth = (opts.lineWidth != null) ? opts.lineWidth : this.lineWidth;
- ctx.lineJoin = (opts.lineJoin != null) ? opts.lineJoin : this.lineJoin;
- ctx.lineCap = (opts.lineCap != null) ? opts.lineCap : this.lineCap;
- ctx.strokeStyle = opts.strokeStyle || this.strokeStyle || 'rgba(0,0,0,'+alpha+')';
- ctx.fillStyle = opts.fillStyle || this.fillStyle || 'rgba(0,0,0,'+alpha+')';
- for (var j=0; j'+
- // '').appendTo(tr);
- }
- if (this.showLabels) {
- td = $(document.createElement('td'));
- td.addClass('jqplot-table-legend jqplot-table-legend-label');
- td.css('paddingTop', rs);
- tr.append(td);
-
- // elem = $(' ');
- // elem.appendTo(tr);
- if (this.escapeHtml) {
- td.text(label);
- }
- else {
- td.html(label);
- }
- }
- td = null;
- div0 = null;
- div1 = null;
- tr = null;
- elem = null;
- };
-
- // called with scope of legend
- $.jqplot.TableLegendRenderer.prototype.draw = function() {
- if (this._elem) {
- this._elem.emptyForce();
- this._elem = null;
- }
-
- if (this.show) {
- var series = this._series;
- // make a table. one line label per row.
- var elem = document.createElement('table');
- this._elem = $(elem);
- this._elem.addClass('jqplot-table-legend');
-
- var ss = {position:'absolute'};
- if (this.background) {
- ss['background'] = this.background;
- }
- if (this.border) {
- ss['border'] = this.border;
- }
- if (this.fontSize) {
- ss['fontSize'] = this.fontSize;
- }
- if (this.fontFamily) {
- ss['fontFamily'] = this.fontFamily;
- }
- if (this.textColor) {
- ss['textColor'] = this.textColor;
- }
- if (this.marginTop != null) {
- ss['marginTop'] = this.marginTop;
- }
- if (this.marginBottom != null) {
- ss['marginBottom'] = this.marginBottom;
- }
- if (this.marginLeft != null) {
- ss['marginLeft'] = this.marginLeft;
- }
- if (this.marginRight != null) {
- ss['marginRight'] = this.marginRight;
- }
-
-
- var pad = false,
- reverse = false,
- s;
- for (var i = 0; i< series.length; i++) {
- s = series[i];
- if (s._stack || s.renderer.constructor == $.jqplot.BezierCurveRenderer){
- reverse = true;
- }
- if (s.show && s.showLabel) {
- var lt = this.labels[i] || s.label.toString();
- if (lt) {
- var color = s.color;
- if (reverse && i < series.length - 1){
- pad = true;
- }
- else if (reverse && i == series.length - 1){
- pad = false;
- }
- this.renderer.addrow.call(this, lt, color, pad, reverse);
- pad = true;
- }
- // let plugins add more rows to legend. Used by trend line plugin.
- for (var j=0; j<$.jqplot.addLegendRowHooks.length; j++) {
- var item = $.jqplot.addLegendRowHooks[j].call(this, s);
- if (item) {
- this.renderer.addrow.call(this, item.label, item.color, pad);
- pad = true;
- }
- }
- lt = null;
- }
- }
- }
- return this._elem;
- };
-
- $.jqplot.TableLegendRenderer.prototype.pack = function(offsets) {
- if (this.show) {
- if (this.placement == 'insideGrid') {
- switch (this.location) {
- case 'nw':
- var a = offsets.left;
- var b = offsets.top;
- this._elem.css('left', a);
- this._elem.css('top', b);
- break;
- case 'n':
- var a = (offsets.left + (this._plotDimensions.width - offsets.right))/2 - this.getWidth()/2;
- var b = offsets.top;
- this._elem.css('left', a);
- this._elem.css('top', b);
- break;
- case 'ne':
- var a = offsets.right;
- var b = offsets.top;
- this._elem.css({right:a, top:b});
- break;
- case 'e':
- var a = offsets.right;
- var b = (offsets.top + (this._plotDimensions.height - offsets.bottom))/2 - this.getHeight()/2;
- this._elem.css({right:a, top:b});
- break;
- case 'se':
- var a = offsets.right;
- var b = offsets.bottom;
- this._elem.css({right:a, bottom:b});
- break;
- case 's':
- var a = (offsets.left + (this._plotDimensions.width - offsets.right))/2 - this.getWidth()/2;
- var b = offsets.bottom;
- this._elem.css({left:a, bottom:b});
- break;
- case 'sw':
- var a = offsets.left;
- var b = offsets.bottom;
- this._elem.css({left:a, bottom:b});
- break;
- case 'w':
- var a = offsets.left;
- var b = (offsets.top + (this._plotDimensions.height - offsets.bottom))/2 - this.getHeight()/2;
- this._elem.css({left:a, top:b});
- break;
- default: // same as 'se'
- var a = offsets.right;
- var b = offsets.bottom;
- this._elem.css({right:a, bottom:b});
- break;
- }
-
- }
- else if (this.placement == 'outside'){
- switch (this.location) {
- case 'nw':
- var a = this._plotDimensions.width - offsets.left;
- var b = offsets.top;
- this._elem.css('right', a);
- this._elem.css('top', b);
- break;
- case 'n':
- var a = (offsets.left + (this._plotDimensions.width - offsets.right))/2 - this.getWidth()/2;
- var b = this._plotDimensions.height - offsets.top;
- this._elem.css('left', a);
- this._elem.css('bottom', b);
- break;
- case 'ne':
- var a = this._plotDimensions.width - offsets.right;
- var b = offsets.top;
- this._elem.css({left:a, top:b});
- break;
- case 'e':
- var a = this._plotDimensions.width - offsets.right;
- var b = (offsets.top + (this._plotDimensions.height - offsets.bottom))/2 - this.getHeight()/2;
- this._elem.css({left:a, top:b});
- break;
- case 'se':
- var a = this._plotDimensions.width - offsets.right;
- var b = offsets.bottom;
- this._elem.css({left:a, bottom:b});
- break;
- case 's':
- var a = (offsets.left + (this._plotDimensions.width - offsets.right))/2 - this.getWidth()/2;
- var b = this._plotDimensions.height - offsets.bottom;
- this._elem.css({left:a, top:b});
- break;
- case 'sw':
- var a = this._plotDimensions.width - offsets.left;
- var b = offsets.bottom;
- this._elem.css({right:a, bottom:b});
- break;
- case 'w':
- var a = this._plotDimensions.width - offsets.left;
- var b = (offsets.top + (this._plotDimensions.height - offsets.bottom))/2 - this.getHeight()/2;
- this._elem.css({right:a, top:b});
- break;
- default: // same as 'se'
- var a = offsets.right;
- var b = offsets.bottom;
- this._elem.css({right:a, bottom:b});
- break;
- }
- }
- else {
- switch (this.location) {
- case 'nw':
- this._elem.css({left:0, top:offsets.top});
- break;
- case 'n':
- var a = (offsets.left + (this._plotDimensions.width - offsets.right))/2 - this.getWidth()/2;
- this._elem.css({left: a, top:offsets.top});
- break;
- case 'ne':
- this._elem.css({right:0, top:offsets.top});
- break;
- case 'e':
- var b = (offsets.top + (this._plotDimensions.height - offsets.bottom))/2 - this.getHeight()/2;
- this._elem.css({right:offsets.right, top:b});
- break;
- case 'se':
- this._elem.css({right:offsets.right, bottom:offsets.bottom});
- break;
- case 's':
- var a = (offsets.left + (this._plotDimensions.width - offsets.right))/2 - this.getWidth()/2;
- this._elem.css({left: a, bottom:offsets.bottom});
- break;
- case 'sw':
- this._elem.css({left:offsets.left, bottom:offsets.bottom});
- break;
- case 'w':
- var b = (offsets.top + (this._plotDimensions.height - offsets.bottom))/2 - this.getHeight()/2;
- this._elem.css({left:offsets.left, top:b});
- break;
- default: // same as 'se'
- this._elem.css({right:offsets.right, bottom:offsets.bottom});
- break;
- }
- }
- }
- };
-
- /**
- * Class: $.jqplot.ThemeEngine
- * Theme Engine provides a programatic way to change some of the more
- * common jqplot styling options such as fonts, colors and grid options.
- * A theme engine instance is created with each plot. The theme engine
- * manages a collection of themes which can be modified, added to, or
- * applied to the plot.
- *
- * The themeEngine class is not instantiated directly.
- * When a plot is initialized, the current plot options are scanned
- * an a default theme named "Default" is created. This theme is
- * used as the basis for other themes added to the theme engine and
- * is always available.
- *
- * A theme is a simple javascript object with styling parameters for
- * various entities of the plot. A theme has the form:
- *
- *
- * > {
- * > _name:f "Default",
- * > target: {
- * > backgroundColor: "transparent"
- * > },
- * > legend: {
- * > textColor: null,
- * > fontFamily: null,
- * > fontSize: null,
- * > border: null,
- * > background: null
- * > },
- * > title: {
- * > textColor: "rgb(102, 102, 102)",
- * > fontFamily: "'Trebuchet MS',Arial,Helvetica,sans-serif",
- * > fontSize: "19.2px",
- * > textAlign: "center"
- * > },
- * > seriesStyles: {},
- * > series: [{
- * > color: "#4bb2c5",
- * > lineWidth: 2.5,
- * > linePattern: "solid",
- * > shadow: true,
- * > fillColor: "#4bb2c5",
- * > showMarker: true,
- * > markerOptions: {
- * > color: "#4bb2c5",
- * > show: true,
- * > style: 'filledCircle',
- * > lineWidth: 1.5,
- * > size: 4,
- * > shadow: true
- * > }
- * > }],
- * > grid: {
- * > drawGridlines: true,
- * > gridLineColor: "#cccccc",
- * > gridLineWidth: 1,
- * > backgroundColor: "#fffdf6",
- * > borderColor: "#999999",
- * > borderWidth: 2,
- * > shadow: true
- * > },
- * > axesStyles: {
- * > label: {},
- * > ticks: {}
- * > },
- * > axes: {
- * > xaxis: {
- * > borderColor: "#999999",
- * > borderWidth: 2,
- * > ticks: {
- * > show: true,
- * > showGridline: true,
- * > showLabel: true,
- * > showMark: true,
- * > size: 4,
- * > textColor: "",
- * > whiteSpace: "nowrap",
- * > fontSize: "12px",
- * > fontFamily: "'Trebuchet MS',Arial,Helvetica,sans-serif"
- * > },
- * > label: {
- * > textColor: "rgb(102, 102, 102)",
- * > whiteSpace: "normal",
- * > fontSize: "14.6667px",
- * > fontFamily: "'Trebuchet MS',Arial,Helvetica,sans-serif",
- * > fontWeight: "400"
- * > }
- * > },
- * > yaxis: {
- * > borderColor: "#999999",
- * > borderWidth: 2,
- * > ticks: {
- * > show: true,
- * > showGridline: true,
- * > showLabel: true,
- * > showMark: true,
- * > size: 4,
- * > textColor: "",
- * > whiteSpace: "nowrap",
- * > fontSize: "12px",
- * > fontFamily: "'Trebuchet MS',Arial,Helvetica,sans-serif"
- * > },
- * > label: {
- * > textColor: null,
- * > whiteSpace: null,
- * > fontSize: null,
- * > fontFamily: null,
- * > fontWeight: null
- * > }
- * > },
- * > x2axis: {...
- * > },
- * > ...
- * > y9axis: {...
- * > }
- * > }
- * > }
- *
- * "seriesStyles" is a style object that will be applied to all series in the plot.
- * It will forcibly override any styles applied on the individual series. "axesStyles" is
- * a style object that will be applied to all axes in the plot. It will also forcibly
- * override any styles on the individual axes.
- *
- * The example shown above has series options for a line series. Options for other
- * series types are shown below:
- *
- * Bar Series:
- *
- * > {
- * > color: "#4bb2c5",
- * > seriesColors: ["#4bb2c5", "#EAA228", "#c5b47f", "#579575", "#839557", "#958c12", "#953579", "#4b5de4", "#d8b83f", "#ff5800", "#0085cc", "#c747a3", "#cddf54", "#FBD178", "#26B4E3", "#bd70c7"],
- * > lineWidth: 2.5,
- * > shadow: true,
- * > barPadding: 2,
- * > barMargin: 10,
- * > barWidth: 15.09375,
- * > highlightColors: ["rgb(129,201,214)", "rgb(129,201,214)", "rgb(129,201,214)", "rgb(129,201,214)", "rgb(129,201,214)", "rgb(129,201,214)", "rgb(129,201,214)", "rgb(129,201,214)"]
- * > }
- *
- * Pie Series:
- *
- * > {
- * > seriesColors: ["#4bb2c5", "#EAA228", "#c5b47f", "#579575", "#839557", "#958c12", "#953579", "#4b5de4", "#d8b83f", "#ff5800", "#0085cc", "#c747a3", "#cddf54", "#FBD178", "#26B4E3", "#bd70c7"],
- * > padding: 20,
- * > sliceMargin: 0,
- * > fill: true,
- * > shadow: true,
- * > startAngle: 0,
- * > lineWidth: 2.5,
- * > highlightColors: ["rgb(129,201,214)", "rgb(240,189,104)", "rgb(214,202,165)", "rgb(137,180,158)", "rgb(168,180,137)", "rgb(180,174,89)", "rgb(180,113,161)", "rgb(129,141,236)", "rgb(227,205,120)", "rgb(255,138,76)", "rgb(76,169,219)", "rgb(215,126,190)", "rgb(220,232,135)", "rgb(200,167,96)", "rgb(103,202,235)", "rgb(208,154,215)"]
- * > }
- *
- * Funnel Series:
- *
- * > {
- * > color: "#4bb2c5",
- * > lineWidth: 2,
- * > shadow: true,
- * > padding: {
- * > top: 20,
- * > right: 20,
- * > bottom: 20,
- * > left: 20
- * > },
- * > sectionMargin: 6,
- * > seriesColors: ["#4bb2c5", "#EAA228", "#c5b47f", "#579575", "#839557", "#958c12", "#953579", "#4b5de4", "#d8b83f", "#ff5800", "#0085cc", "#c747a3", "#cddf54", "#FBD178", "#26B4E3", "#bd70c7"],
- * > highlightColors: ["rgb(147,208,220)", "rgb(242,199,126)", "rgb(220,210,178)", "rgb(154,191,172)", "rgb(180,191,154)", "rgb(191,186,112)", "rgb(191,133,174)", "rgb(147,157,238)", "rgb(231,212,139)", "rgb(255,154,102)", "rgb(102,181,224)", "rgb(221,144,199)", "rgb(225,235,152)", "rgb(200,167,96)", "rgb(124,210,238)", "rgb(215,169,221)"]
- * > }
- *
- */
- $.jqplot.ThemeEngine = function(){
- // Group: Properties
- //
- // prop: themes
- // hash of themes managed by the theme engine.
- // Indexed by theme name.
- this.themes = {};
- // prop: activeTheme
- // Pointer to currently active theme
- this.activeTheme=null;
-
- };
-
- // called with scope of plot
- $.jqplot.ThemeEngine.prototype.init = function() {
- // get the Default theme from the current plot settings.
- var th = new $.jqplot.Theme({_name:'Default'});
- var n, i, nn;
-
- for (n in th.target) {
- if (n == "textColor") {
- th.target[n] = this.target.css('color');
- }
- else {
- th.target[n] = this.target.css(n);
- }
- }
-
- if (this.title.show && this.title._elem) {
- for (n in th.title) {
- if (n == "textColor") {
- th.title[n] = this.title._elem.css('color');
- }
- else {
- th.title[n] = this.title._elem.css(n);
- }
- }
- }
-
- for (n in th.grid) {
- th.grid[n] = this.grid[n];
- }
- if (th.grid.backgroundColor == null && this.grid.background != null) {
- th.grid.backgroundColor = this.grid.background;
- }
- if (this.legend.show && this.legend._elem) {
- for (n in th.legend) {
- if (n == 'textColor') {
- th.legend[n] = this.legend._elem.css('color');
- }
- else {
- th.legend[n] = this.legend._elem.css(n);
- }
- }
- }
- var s;
-
- for (i=0; i w) {
- w = tempright;
- }
- if (tempbottom > h) {
- h = tempbottom;
- }
- });
- }
-
- newCanvas.width = w + Number(x_offset);
- newCanvas.height = h + Number(y_offset);
-
- var newContext = newCanvas.getContext("2d");
-
- newContext.save();
- newContext.fillStyle = backgroundColor;
- newContext.fillRect(0,0, newCanvas.width, newCanvas.height);
- newContext.restore();
-
- newContext.translate(transx, transy);
- newContext.textAlign = 'left';
- newContext.textBaseline = 'top';
-
- function getLineheight(el) {
- var lineheight = parseInt($(el).css('line-height'), 10);
-
- if (isNaN(lineheight)) {
- lineheight = parseInt($(el).css('font-size'), 10) * 1.2;
- }
- return lineheight;
- }
-
- function writeWrappedText (el, context, text, left, top, canvasWidth) {
- var lineheight = getLineheight(el);
- var tagwidth = $(el).innerWidth();
- var tagheight = $(el).innerHeight();
- var words = text.split(/\s+/);
- var wl = words.length;
- var w = '';
- var breaks = [];
- var temptop = top;
- var templeft = left;
-
- for (var i=0; i tagwidth) {
- breaks.push(i);
- w = '';
- }
- }
- if (breaks.length === 0) {
- // center text if necessary
- if ($(el).css('textAlign') === 'center') {
- templeft = left + (canvasWidth - context.measureText(w).width)/2 - transx;
- }
- context.fillText(text, templeft, top);
- }
- else {
- w = words.slice(0, breaks[0]).join(' ');
- // center text if necessary
- if ($(el).css('textAlign') === 'center') {
- templeft = left + (canvasWidth - context.measureText(w).width)/2 - transx;
- }
- context.fillText(w, templeft, temptop);
- temptop += lineheight;
- for (var i=1, l=breaks.length; i 0) {
- newContext.strokeRect(left, top, $(el).innerWidth(), $(el).innerHeight());
- }
-
- // find all the swatches
- $(el).find('div.jqplot-table-legend-swatch-outline').each(function() {
- // get the first div and stroke it
- var elem = $(this);
- newContext.strokeStyle = elem.css('border-top-color');
- var l = left + elem.position().left;
- var t = top + elem.position().top;
- newContext.strokeRect(l, t, elem.innerWidth(), elem.innerHeight());
-
- // now fill the swatch
-
- l += parseInt(elem.css('padding-left'), 10);
- t += parseInt(elem.css('padding-top'), 10);
- var h = elem.innerHeight() - 2 * parseInt(elem.css('padding-top'), 10);
- var w = elem.innerWidth() - 2 * parseInt(elem.css('padding-left'), 10);
-
- var swatch = elem.children('div.jqplot-table-legend-swatch');
- newContext.fillStyle = swatch.css('background-color');
- newContext.fillRect(l, t, w, h);
- });
-
- // now add text
-
- $(el).find('td.jqplot-table-legend-label').each(function(){
- var elem = $(this);
- var l = left + elem.position().left;
- var t = top + elem.position().top + parseInt(elem.css('padding-top'), 10);
- newContext.font = elem.jqplotGetComputedFontStyle();
- newContext.fillStyle = elem.css('color');
- newContext.fillText(elem.text(), l, t);
- });
-
- var elem = null;
- }
-
- else if (tagname == 'canvas') {
- newContext.drawImage(el, left, top);
- }
- }
- $(this).children().each(function() {
- _jqpToImage(this, x_offset, y_offset);
- });
- return newCanvas;
- };
-
- $.fn.jqplotToImageStr = function(options) {
- var imgCanvas = $(this).jqplotToImageCanvas(options);
- if (imgCanvas) {
- return imgCanvas.toDataURL("image/png");
- }
- else {
- return null;
- }
- };
-
- // create an element and return it.
- // Should work on canvas supporting browsers.
- $.fn.jqplotToImageElem = function(options) {
- var elem = document.createElement("img");
- var str = $(this).jqplotToImageStr(options);
- elem.src = str;
- return elem;
- };
-
- // create an element and return it.
- // Should work on canvas supporting browsers.
- $.fn.jqplotToImageElemStr = function(options) {
- var str = ' ';
- return str;
- };
-
- // Not gauranteed to work, even on canvas supporting browsers due to
- // limitations with location.href and browser support.
- $.fn.jqplotSaveImage = function() {
- var imgData = $(this).jqplotToImageStr({});
- if (imgData) {
- window.location.href = imgData.replace("image/png", "image/octet-stream");
- }
-
- };
-
- // Not gauranteed to work, even on canvas supporting browsers due to
- // limitations with window.open and arbitrary data.
- $.fn.jqplotViewImage = function() {
- var imgStr = $(this).jqplotToImageElemStr({});
- var imgData = $(this).jqplotToImageStr({});
- if (imgStr) {
- var w = window.open('');
- w.document.open("image/png");
- w.document.write(imgStr);
- w.document.close();
- w = null;
- }
- };
-
-
-
- /**
- * @description
- * Object with extended date parsing and formatting capabilities.
- * This library borrows many concepts and ideas from the Date Instance
- * Methods by Ken Snyder along with some parts of Ken's actual code.
- *
- * jsDate takes a different approach by not extending the built-in
- * Date Object, improving date parsing, allowing for multiple formatting
- * syntaxes and multiple and more easily expandable localization.
- *
- * @author Chris Leonello
- * @date #date#
- * @version #VERSION#
- * @copyright (c) 2010 Chris Leonello
- * jsDate is currently available for use in all personal or commercial projects
- * under both the MIT and GPL version 2.0 licenses. This means that you can
- * choose the license that best suits your project and use it accordingly.
- *
- * Ken's origianl Date Instance Methods and copyright notice:
- *
- * Ken Snyder (ken d snyder at gmail dot com)
- * 2008-09-10
- * version 2.0.2 (http://kendsnyder.com/sandbox/date/)
- * Creative Commons Attribution License 3.0 (http://creativecommons.org/licenses/by/3.0/)
- *
- *
- * @class
- * @name jsDate
- * @param {String | Number | Array | Date Object | Options Object} arguments Optional arguments, either a parsable date/time string,
- * a JavaScript timestamp, an array of numbers of form [year, month, day, hours, minutes, seconds, milliseconds],
- * a Date object, or an options object of form {syntax: "perl", date:some Date} where all options are optional.
- */
-
- var jsDate = function () {
-
- this.syntax = jsDate.config.syntax;
- this._type = "jsDate";
- this.proxy = new Date();
- this.options = {};
- this.locale = jsDate.regional.getLocale();
- this.formatString = '';
- this.defaultCentury = jsDate.config.defaultCentury;
-
- switch ( arguments.length ) {
- case 0:
- break;
- case 1:
- // other objects either won't have a _type property or,
- // if they do, it shouldn't be set to "jsDate", so
- // assume it is an options argument.
- if (get_type(arguments[0]) == "[object Object]" && arguments[0]._type != "jsDate") {
- var opts = this.options = arguments[0];
- this.syntax = opts.syntax || this.syntax;
- this.defaultCentury = opts.defaultCentury || this.defaultCentury;
- this.proxy = jsDate.createDate(opts.date);
- }
- else {
- this.proxy = jsDate.createDate(arguments[0]);
- }
- break;
- default:
- var a = [];
- for ( var i=0; i 0 ? 'floor' : 'ceil'](unitDiff));
- };
-
- /**
- * Get the abbreviated name of the current week day
- *
- * @returns {String}
- */
-
- jsDate.prototype.getAbbrDayName = function() {
- return jsDate.regional[this.locale]["dayNamesShort"][this.proxy.getDay()];
- };
-
- /**
- * Get the abbreviated name of the current month
- *
- * @returns {String}
- */
-
- jsDate.prototype.getAbbrMonthName = function() {
- return jsDate.regional[this.locale]["monthNamesShort"][this.proxy.getMonth()];
- };
-
- /**
- * Get UPPER CASE AM or PM for the current time
- *
- * @returns {String}
- */
-
- jsDate.prototype.getAMPM = function() {
- return this.proxy.getHours() >= 12 ? 'PM' : 'AM';
- };
-
- /**
- * Get lower case am or pm for the current time
- *
- * @returns {String}
- */
-
- jsDate.prototype.getAmPm = function() {
- return this.proxy.getHours() >= 12 ? 'pm' : 'am';
- };
-
- /**
- * Get the century (19 for 20th Century)
- *
- * @returns {Integer} Century (19 for 20th century).
- */
- jsDate.prototype.getCentury = function() {
- return parseInt(this.proxy.getFullYear()/100, 10);
- };
-
- /**
- * Implements Date functionality
- */
- jsDate.prototype.getDate = function() {
- return this.proxy.getDate();
- };
-
- /**
- * Implements Date functionality
- */
- jsDate.prototype.getDay = function() {
- return this.proxy.getDay();
- };
-
- /**
- * Get the Day of week 1 (Monday) thru 7 (Sunday)
- *
- * @returns {Integer} Day of week 1 (Monday) thru 7 (Sunday)
- */
- jsDate.prototype.getDayOfWeek = function() {
- var dow = this.proxy.getDay();
- return dow===0?7:dow;
- };
-
- /**
- * Get the day of the year
- *
- * @returns {Integer} 1 - 366, day of the year
- */
- jsDate.prototype.getDayOfYear = function() {
- var d = this.proxy;
- var ms = d - new Date('' + d.getFullYear() + '/1/1 GMT');
- ms += d.getTimezoneOffset()*60000;
- d = null;
- return parseInt(ms/60000/60/24, 10)+1;
- };
-
- /**
- * Get the name of the current week day
- *
- * @returns {String}
- */
-
- jsDate.prototype.getDayName = function() {
- return jsDate.regional[this.locale]["dayNames"][this.proxy.getDay()];
- };
-
- /**
- * Get the week number of the given year, starting with the first Sunday as the first week
- * @returns {Integer} Week number (13 for the 13th full week of the year).
- */
- jsDate.prototype.getFullWeekOfYear = function() {
- var d = this.proxy;
- var doy = this.getDayOfYear();
- var rdow = 6-d.getDay();
- var woy = parseInt((doy+rdow)/7, 10);
- return woy;
- };
-
- /**
- * Implements Date functionality
- */
- jsDate.prototype.getFullYear = function() {
- return this.proxy.getFullYear();
- };
-
- /**
- * Get the GMT offset in hours and minutes (e.g. +06:30)
- *
- * @returns {String}
- */
-
- jsDate.prototype.getGmtOffset = function() {
- // divide the minutes offset by 60
- var hours = this.proxy.getTimezoneOffset() / 60;
- // decide if we are ahead of or behind GMT
- var prefix = hours < 0 ? '+' : '-';
- // remove the negative sign if any
- hours = Math.abs(hours);
- // add the +/- to the padded number of hours to : to the padded minutes
- return prefix + addZeros(Math.floor(hours), 2) + ':' + addZeros((hours % 1) * 60, 2);
- };
-
- /**
- * Implements Date functionality
- */
- jsDate.prototype.getHours = function() {
- return this.proxy.getHours();
- };
-
- /**
- * Get the current hour on a 12-hour scheme
- *
- * @returns {Integer}
- */
-
- jsDate.prototype.getHours12 = function() {
- var hours = this.proxy.getHours();
- return hours > 12 ? hours - 12 : (hours == 0 ? 12 : hours);
- };
-
-
- jsDate.prototype.getIsoWeek = function() {
- var d = this.proxy;
- var woy = d.getWeekOfYear();
- var dow1_1 = (new Date('' + d.getFullYear() + '/1/1')).getDay();
- // First week is 01 and not 00 as in the case of %U and %W,
- // so we add 1 to the final result except if day 1 of the year
- // is a Monday (then %W returns 01).
- // We also need to subtract 1 if the day 1 of the year is
- // Friday-Sunday, so the resulting equation becomes:
- var idow = woy + (dow1_1 > 4 || dow1_1 <= 1 ? 0 : 1);
- if(idow == 53 && (new Date('' + d.getFullYear() + '/12/31')).getDay() < 4)
- {
- idow = 1;
- }
- else if(idow === 0)
- {
- d = new jsDate(new Date('' + (d.getFullYear()-1) + '/12/31'));
- idow = d.getIsoWeek();
- }
- d = null;
- return idow;
- };
-
- /**
- * Implements Date functionality
- */
- jsDate.prototype.getMilliseconds = function() {
- return this.proxy.getMilliseconds();
- };
-
- /**
- * Implements Date functionality
- */
- jsDate.prototype.getMinutes = function() {
- return this.proxy.getMinutes();
- };
-
- /**
- * Implements Date functionality
- */
- jsDate.prototype.getMonth = function() {
- return this.proxy.getMonth();
- };
-
- /**
- * Get the name of the current month
- *
- * @returns {String}
- */
-
- jsDate.prototype.getMonthName = function() {
- return jsDate.regional[this.locale]["monthNames"][this.proxy.getMonth()];
- };
-
- /**
- * Get the number of the current month, 1-12
- *
- * @returns {Integer}
- */
-
- jsDate.prototype.getMonthNumber = function() {
- return this.proxy.getMonth() + 1;
- };
-
- /**
- * Implements Date functionality
- */
- jsDate.prototype.getSeconds = function() {
- return this.proxy.getSeconds();
- };
-
- /**
- * Return a proper two-digit year integer
- *
- * @returns {Integer}
- */
-
- jsDate.prototype.getShortYear = function() {
- return this.proxy.getYear() % 100;
- };
-
- /**
- * Implements Date functionality
- */
- jsDate.prototype.getTime = function() {
- return this.proxy.getTime();
- };
-
- /**
- * Get the timezone abbreviation
- *
- * @returns {String} Abbreviation for the timezone
- */
- jsDate.prototype.getTimezoneAbbr = function() {
- return this.proxy.toString().replace(/^.*\(([^)]+)\)$/, '$1');
- };
-
- /**
- * Get the browser-reported name for the current timezone (e.g. MDT, Mountain Daylight Time)
- *
- * @returns {String}
- */
- jsDate.prototype.getTimezoneName = function() {
- var match = /(?:\((.+)\)$| ([A-Z]{3}) )/.exec(this.toString());
- return match[1] || match[2] || 'GMT' + this.getGmtOffset();
- };
-
- /**
- * Implements Date functionality
- */
- jsDate.prototype.getTimezoneOffset = function() {
- return this.proxy.getTimezoneOffset();
- };
-
-
- /**
- * Get the week number of the given year, starting with the first Monday as the first week
- * @returns {Integer} Week number (13 for the 13th week of the year).
- */
- jsDate.prototype.getWeekOfYear = function() {
- var doy = this.getDayOfYear();
- var rdow = 7 - this.getDayOfWeek();
- var woy = parseInt((doy+rdow)/7, 10);
- return woy;
- };
-
- /**
- * Get the current date as a Unix timestamp
- *
- * @returns {Integer}
- */
-
- jsDate.prototype.getUnix = function() {
- return Math.round(this.proxy.getTime() / 1000, 0);
- };
-
- /**
- * Implements Date functionality
- */
- jsDate.prototype.getYear = function() {
- return this.proxy.getYear();
- };
-
- /**
- * Return a date one day ahead (or any other unit)
- *
- * @param {String} unit Optional, year | month | day | week | hour | minute | second | millisecond
- * @returns {jsDate}
- */
-
- jsDate.prototype.next = function(unit) {
- unit = unit || 'day';
- return this.clone().add(1, unit);
- };
-
- /**
- * Set the jsDate instance to a new date.
- *
- * @param {String | Number | Array | Date Object | jsDate Object | Options Object} arguments Optional arguments,
- * either a parsable date/time string,
- * a JavaScript timestamp, an array of numbers of form [year, month, day, hours, minutes, seconds, milliseconds],
- * a Date object, jsDate Object or an options object of form {syntax: "perl", date:some Date} where all options are optional.
- */
- jsDate.prototype.set = function() {
- switch ( arguments.length ) {
- case 0:
- this.proxy = new Date();
- break;
- case 1:
- // other objects either won't have a _type property or,
- // if they do, it shouldn't be set to "jsDate", so
- // assume it is an options argument.
- if (get_type(arguments[0]) == "[object Object]" && arguments[0]._type != "jsDate") {
- var opts = this.options = arguments[0];
- this.syntax = opts.syntax || this.syntax;
- this.defaultCentury = opts.defaultCentury || this.defaultCentury;
- this.proxy = jsDate.createDate(opts.date);
- }
- else {
- this.proxy = jsDate.createDate(arguments[0]);
- }
- break;
- default:
- var a = [];
- for ( var i=0; ijsDate attempts to detect locale when loaded and defaults to 'en'.
- * If a localization is detected which is not available, jsDate defaults to 'en'.
- * Additional localizations can be added after jsDate loads. After adding a localization,
- * call the jsDate.regional.getLocale() method. Currently, en, fr and de are defined.
- *
- * Localizations must be an object and have the following properties defined: monthNames, monthNamesShort, dayNames, dayNamesShort and Localizations are added like:
- *
- * jsDate.regional['en'] = {
- * monthNames : 'January February March April May June July August September October November December'.split(' '),
- * monthNamesShort : 'Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec'.split(' '),
- * dayNames : 'Sunday Monday Tuesday Wednesday Thursday Friday Saturday'.split(' '),
- * dayNamesShort : 'Sun Mon Tue Wed Thu Fri Sat'.split(' ')
- * };
- *
- * After adding localizations, call jsDate.regional.getLocale(); to update the locale setting with the
- * new localizations.
- */
-
- jsDate.regional = {
- 'en': {
- monthNames: ['January','February','March','April','May','June','July','August','September','October','November','December'],
- monthNamesShort: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun','Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'],
- dayNames: ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'],
- dayNamesShort: ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'],
- formatString: '%Y-%m-%d %H:%M:%S'
- },
-
- 'fr': {
- monthNames: ['Janvier','Février','Mars','Avril','Mai','Juin','Juillet','Août','Septembre','Octobre','Novembre','Décembre'],
- monthNamesShort: ['Jan','Fév','Mar','Avr','Mai','Jun','Jul','Aoû','Sep','Oct','Nov','Déc'],
- dayNames: ['Dimanche','Lundi','Mardi','Mercredi','Jeudi','Vendredi','Samedi'],
- dayNamesShort: ['Dim','Lun','Mar','Mer','Jeu','Ven','Sam'],
- formatString: '%Y-%m-%d %H:%M:%S'
- },
-
- 'de': {
- monthNames: ['Januar','Februar','März','April','Mai','Juni','Juli','August','September','Oktober','November','Dezember'],
- monthNamesShort: ['Jan','Feb','Mär','Apr','Mai','Jun','Jul','Aug','Sep','Okt','Nov','Dez'],
- dayNames: ['Sonntag','Montag','Dienstag','Mittwoch','Donnerstag','Freitag','Samstag'],
- dayNamesShort: ['So','Mo','Di','Mi','Do','Fr','Sa'],
- formatString: '%Y-%m-%d %H:%M:%S'
- },
-
- 'es': {
- monthNames: ['Enero','Febrero','Marzo','Abril','Mayo','Junio', 'Julio','Agosto','Septiembre','Octubre','Noviembre','Diciembre'],
- monthNamesShort: ['Ene','Feb','Mar','Abr','May','Jun', 'Jul','Ago','Sep','Oct','Nov','Dic'],
- dayNames: ['Domingo','Lunes','Martes','Miércoles','Jueves','Viernes','Sábado'],
- dayNamesShort: ['Dom','Lun','Mar','Mié','Juv','Vie','Sáb'],
- formatString: '%Y-%m-%d %H:%M:%S'
- },
-
- 'ru': {
- monthNames: ['Январь','Февраль','Март','Апрель','Май','Июнь','Июль','Август','Сентябрь','Октябрь','Ноябрь','Декабрь'],
- monthNamesShort: ['Янв','Фев','Мар','Апр','Май','Июн','Июл','Авг','Сен','Окт','Ноя','Дек'],
- dayNames: ['воскресенье','понедельник','вторник','среда','четверг','пятница','суббота'],
- dayNamesShort: ['вск','пнд','втр','срд','чтв','птн','сбт'],
- formatString: '%Y-%m-%d %H:%M:%S'
- },
-
- 'ar': {
- monthNames: ['كانون الثاني', 'شباط', 'آذار', 'نيسان', 'آذار', 'حزيران','تموز', 'آب', 'أيلول', 'تشرين الأول', 'تشرين الثاني', 'كانون الأول'],
- monthNamesShort: ['1','2','3','4','5','6','7','8','9','10','11','12'],
- dayNames: ['السبت', 'الأحد', 'الاثنين', 'الثلاثاء', 'الأربعاء', 'الخميس', 'الجمعة'],
- dayNamesShort: ['سبت', 'أحد', 'اثنين', 'ثلاثاء', 'أربعاء', 'خميس', 'جمعة'],
- formatString: '%Y-%m-%d %H:%M:%S'
- },
-
- 'pt': {
- monthNames: ['Janeiro','Fevereiro','Março','Abril','Maio','Junho','Julho','Agosto','Setembro','Outubro','Novembro','Dezembro'],
- monthNamesShort: ['Jan','Fev','Mar','Abr','Mai','Jun','Jul','Ago','Set','Out','Nov','Dez'],
- dayNames: ['Domingo','Segunda-feira','Terça-feira','Quarta-feira','Quinta-feira','Sexta-feira','Sábado'],
- dayNamesShort: ['Dom','Seg','Ter','Qua','Qui','Sex','Sáb'],
- formatString: '%Y-%m-%d %H:%M:%S'
- },
-
- 'pt-BR': {
- monthNames: ['Janeiro','Fevereiro','Março','Abril','Maio','Junho', 'Julho','Agosto','Setembro','Outubro','Novembro','Dezembro'],
- monthNamesShort: ['Jan','Fev','Mar','Abr','Mai','Jun','Jul','Ago','Set','Out','Nov','Dez'],
- dayNames: ['Domingo','Segunda-feira','Terça-feira','Quarta-feira','Quinta-feira','Sexta-feira','Sábado'],
- dayNamesShort: ['Dom','Seg','Ter','Qua','Qui','Sex','Sáb'],
- formatString: '%Y-%m-%d %H:%M:%S'
- }
-
-
- };
-
- // Set english variants to 'en'
- jsDate.regional['en-US'] = jsDate.regional['en-GB'] = jsDate.regional['en'];
-
- /**
- * Try to determine the users locale based on the lang attribute of the html page. Defaults to 'en'
- * if it cannot figure out a locale of if the locale does not have a localization defined.
- * @returns {String} locale
- */
-
- jsDate.regional.getLocale = function () {
- var l = jsDate.config.defaultLocale;
-
- if ( document && document.getElementsByTagName('html') && document.getElementsByTagName('html')[0].lang ) {
- l = document.getElementsByTagName('html')[0].lang;
- if (!jsDate.regional.hasOwnProperty(l)) {
- l = jsDate.config.defaultLocale;
- }
- }
-
- return l;
- };
-
- // ms in day
- var day = 24 * 60 * 60 * 1000;
-
- // padd a number with zeros
- var addZeros = function(num, digits) {
- num = String(num);
- var i = digits - num.length;
- var s = String(Math.pow(10, i)).slice(1);
- return s.concat(num);
- };
-
- // representations used for calculating differences between dates.
- // This borrows heavily from Ken Snyder's work.
- var multipliers = {
- millisecond: 1,
- second: 1000,
- minute: 60 * 1000,
- hour: 60 * 60 * 1000,
- day: day,
- week: 7 * day,
- month: {
- // add a number of months
- add: function(d, number) {
- // add any years needed (increments of 12)
- multipliers.year.add(d, Math[number > 0 ? 'floor' : 'ceil'](number / 12));
- // ensure that we properly wrap betwen December and January
- // 11 % 12 = 11
- // 12 % 12 = 0
- var prevMonth = d.getMonth() + (number % 12);
- if (prevMonth == 12) {
- prevMonth = 0;
- d.setYear(d.getFullYear() + 1);
- } else if (prevMonth == -1) {
- prevMonth = 11;
- d.setYear(d.getFullYear() - 1);
- }
- d.setMonth(prevMonth);
- },
- // get the number of months between two Date objects (decimal to the nearest day)
- diff: function(d1, d2) {
- // get the number of years
- var diffYears = d1.getFullYear() - d2.getFullYear();
- // get the number of remaining months
- var diffMonths = d1.getMonth() - d2.getMonth() + (diffYears * 12);
- // get the number of remaining days
- var diffDays = d1.getDate() - d2.getDate();
- // return the month difference with the days difference as a decimal
- return diffMonths + (diffDays / 30);
- }
- },
- year: {
- // add a number of years
- add: function(d, number) {
- d.setYear(d.getFullYear() + Math[number > 0 ? 'floor' : 'ceil'](number));
- },
- // get the number of years between two Date objects (decimal to the nearest day)
- diff: function(d1, d2) {
- return multipliers.month.diff(d1, d2) / 12;
- }
- }
- };
- //
- // Alias each multiplier with an 's' to allow 'year' and 'years' for example.
- // This comes from Ken Snyders work.
- //
- for (var unit in multipliers) {
- if (unit.substring(unit.length - 1) != 's') { // IE will iterate newly added properties :|
- multipliers[unit + 's'] = multipliers[unit];
- }
- }
-
- //
- // take a jsDate instance and a format code and return the formatted value.
- // This is a somewhat modified version of Ken Snyder's method.
- //
- var format = function(d, code, syntax) {
- // if shorcut codes are used, recursively expand those.
- if (jsDate.formats[syntax]["shortcuts"][code]) {
- return jsDate.strftime(d, jsDate.formats[syntax]["shortcuts"][code], syntax);
- } else {
- // get the format code function and addZeros() argument
- var getter = (jsDate.formats[syntax]["codes"][code] || '').split('.');
- var nbr = d['get' + getter[0]] ? d['get' + getter[0]]() : '';
- if (getter[1]) {
- nbr = addZeros(nbr, getter[1]);
- }
- return nbr;
- }
- };
-
- /**
- * @static
- * Static function for convert a date to a string according to a given format. Also acts as namespace for strftime format codes.
- * strftime formatting can be accomplished without creating a jsDate object by calling jsDate.strftime():
- *
- * var formattedDate = jsDate.strftime('Feb 8, 2006 8:48:32', '%Y-%m-%d %H:%M:%S');
- *
- * @param {String | Number | Array | jsDate Object | Date Object} date A parsable date string, JavaScript time stamp, Array of form [year, month, day, hours, minutes, seconds, milliseconds], jsDate Object or Date object.
- * @param {String} formatString String with embedded date formatting codes.
- * See: {@link jsDate.formats}.
- * @param {String} syntax Optional syntax to use [default perl].
- * @param {String} locale Optional locale to use.
- * @returns {String} Formatted representation of the date.
- */
- //
- // Logic as implemented here is very similar to Ken Snyder's Date Instance Methods.
- //
- jsDate.strftime = function(d, formatString, syntax, locale) {
- var syn = 'perl';
- var loc = jsDate.regional.getLocale();
-
- // check if syntax and locale are available or reversed
- if (syntax && jsDate.formats.hasOwnProperty(syntax)) {
- syn = syntax;
- }
- else if (syntax && jsDate.regional.hasOwnProperty(syntax)) {
- loc = syntax;
- }
-
- if (locale && jsDate.formats.hasOwnProperty(locale)) {
- syn = locale;
- }
- else if (locale && jsDate.regional.hasOwnProperty(locale)) {
- loc = locale;
- }
-
- if (get_type(d) != "[object Object]" || d._type != "jsDate") {
- d = new jsDate(d);
- d.locale = loc;
- }
- if (!formatString) {
- formatString = d.formatString || jsDate.regional[loc]['formatString'];
- }
- // default the format string to year-month-day
- var source = formatString || '%Y-%m-%d',
- result = '',
- match;
- // replace each format code
- while (source.length > 0) {
- if (match = source.match(jsDate.formats[syn].codes.matcher)) {
- result += source.slice(0, match.index);
- result += (match[1] || '') + format(d, match[2], syn);
- source = source.slice(match.index + match[0].length);
- } else {
- result += source;
- source = '';
- }
- }
- return result;
- };
-
- /**
- * @namespace
- * Namespace to hold format codes and format shortcuts. "perl" and "php" format codes
- * and shortcuts are defined by default. Additional codes and shortcuts can be
- * added like:
- *
- *
- * jsDate.formats["perl"] = {
- * "codes": {
- * matcher: /someregex/,
- * Y: "fullYear", // name of "get" method without the "get",
- * ..., // more codes
- * },
- * "shortcuts": {
- * F: '%Y-%m-%d',
- * ..., // more shortcuts
- * }
- * };
- *
- *
- * Additionally, ISO and SQL shortcuts are defined and can be accesses via:
- * jsDate.formats.ISO and jsDate.formats.SQL
- */
-
- jsDate.formats = {
- ISO:'%Y-%m-%dT%H:%M:%S.%N%G',
- SQL:'%Y-%m-%d %H:%M:%S'
- };
-
- /**
- * Perl format codes and shortcuts for strftime.
- *
- * A hash (object) of codes where each code must be an array where the first member is
- * the name of a Date.prototype or jsDate.prototype function to call
- * and optionally a second member indicating the number to pass to addZeros()
- *
- *
The following format codes are defined:
- *
- *
- * Code Result Description
- * == Years ==
- * %Y 2008 Four-digit year
- * %y 08 Two-digit year
- *
- * == Months ==
- * %m 09 Two-digit month
- * %#m 9 One or two-digit month
- * %B September Full month name
- * %b Sep Abbreviated month name
- *
- * == Days ==
- * %d 05 Two-digit day of month
- * %#d 5 One or two-digit day of month
- * %e 5 One or two-digit day of month
- * %A Sunday Full name of the day of the week
- * %a Sun Abbreviated name of the day of the week
- * %w 0 Number of the day of the week (0 = Sunday, 6 = Saturday)
- *
- * == Hours ==
- * %H 23 Hours in 24-hour format (two digits)
- * %#H 3 Hours in 24-hour integer format (one or two digits)
- * %I 11 Hours in 12-hour format (two digits)
- * %#I 3 Hours in 12-hour integer format (one or two digits)
- * %p PM AM or PM
- *
- * == Minutes ==
- * %M 09 Minutes (two digits)
- * %#M 9 Minutes (one or two digits)
- *
- * == Seconds ==
- * %S 02 Seconds (two digits)
- * %#S 2 Seconds (one or two digits)
- * %s 1206567625723 Unix timestamp (Seconds past 1970-01-01 00:00:00)
- *
- * == Milliseconds ==
- * %N 008 Milliseconds (three digits)
- * %#N 8 Milliseconds (one to three digits)
- *
- * == Timezone ==
- * %O 360 difference in minutes between local time and GMT
- * %Z Mountain Standard Time Name of timezone as reported by browser
- * %G 06:00 Hours and minutes between GMT
- *
- * == Shortcuts ==
- * %F 2008-03-26 %Y-%m-%d
- * %T 05:06:30 %H:%M:%S
- * %X 05:06:30 %H:%M:%S
- * %x 03/26/08 %m/%d/%y
- * %D 03/26/08 %m/%d/%y
- * %#c Wed Mar 26 15:31:00 2008 %a %b %e %H:%M:%S %Y
- * %v 3-Sep-2008 %e-%b-%Y
- * %R 15:31 %H:%M
- * %r 03:31:00 PM %I:%M:%S %p
- *
- * == Characters ==
- * %n \n Newline
- * %t \t Tab
- * %% % Percent Symbol
- *
- *
- * Formatting shortcuts that will be translated into their longer version.
- * Be sure that format shortcuts do not refer to themselves: this will cause an infinite loop.
- *
- * Format codes and format shortcuts can be redefined after the jsDate
- * module is imported.
- *
- * Note that if you redefine the whole hash (object), you must supply a "matcher"
- * regex for the parser. The default matcher is:
- *
- * /()%(#?(%|[a-z]))/i
- *
- * which corresponds to the Perl syntax used by default.
- *
- * By customizing the matcher and format codes, nearly any strftime functionality is possible.
- */
-
- jsDate.formats.perl = {
- codes: {
- //
- // 2-part regex matcher for format codes
- //
- // first match must be the character before the code (to account for escaping)
- // second match must be the format code character(s)
- //
- matcher: /()%(#?(%|[a-z]))/i,
- // year
- Y: 'FullYear',
- y: 'ShortYear.2',
- // month
- m: 'MonthNumber.2',
- '#m': 'MonthNumber',
- B: 'MonthName',
- b: 'AbbrMonthName',
- // day
- d: 'Date.2',
- '#d': 'Date',
- e: 'Date',
- A: 'DayName',
- a: 'AbbrDayName',
- w: 'Day',
- // hours
- H: 'Hours.2',
- '#H': 'Hours',
- I: 'Hours12.2',
- '#I': 'Hours12',
- p: 'AMPM',
- // minutes
- M: 'Minutes.2',
- '#M': 'Minutes',
- // seconds
- S: 'Seconds.2',
- '#S': 'Seconds',
- s: 'Unix',
- // milliseconds
- N: 'Milliseconds.3',
- '#N': 'Milliseconds',
- // timezone
- O: 'TimezoneOffset',
- Z: 'TimezoneName',
- G: 'GmtOffset'
- },
-
- shortcuts: {
- // date
- F: '%Y-%m-%d',
- // time
- T: '%H:%M:%S',
- X: '%H:%M:%S',
- // local format date
- x: '%m/%d/%y',
- D: '%m/%d/%y',
- // local format extended
- '#c': '%a %b %e %H:%M:%S %Y',
- // local format short
- v: '%e-%b-%Y',
- R: '%H:%M',
- r: '%I:%M:%S %p',
- // tab and newline
- t: '\t',
- n: '\n',
- '%': '%'
- }
- };
-
- /**
- * PHP format codes and shortcuts for strftime.
- *
- * A hash (object) of codes where each code must be an array where the first member is
- * the name of a Date.prototype or jsDate.prototype function to call
- * and optionally a second member indicating the number to pass to addZeros()
- *
- * The following format codes are defined:
- *
- *
- * Code Result Description
- * === Days ===
- * %a Sun through Sat An abbreviated textual representation of the day
- * %A Sunday - Saturday A full textual representation of the day
- * %d 01 to 31 Two-digit day of the month (with leading zeros)
- * %e 1 to 31 Day of the month, with a space preceding single digits.
- * %j 001 to 366 Day of the year, 3 digits with leading zeros
- * %u 1 - 7 (Mon - Sun) ISO-8601 numeric representation of the day of the week
- * %w 0 - 6 (Sun - Sat) Numeric representation of the day of the week
- *
- * === Week ===
- * %U 13 Full Week number, starting with the first Sunday as the first week
- * %V 01 through 53 ISO-8601:1988 week number, starting with the first week of the year
- * with at least 4 weekdays, with Monday being the start of the week
- * %W 46 A numeric representation of the week of the year,
- * starting with the first Monday as the first week
- * === Month ===
- * %b Jan through Dec Abbreviated month name, based on the locale
- * %B January - December Full month name, based on the locale
- * %h Jan through Dec Abbreviated month name, based on the locale (an alias of %b)
- * %m 01 - 12 (Jan - Dec) Two digit representation of the month
- *
- * === Year ===
- * %C 19 Two digit century (year/100, truncated to an integer)
- * %y 09 for 2009 Two digit year
- * %Y 2038 Four digit year
- *
- * === Time ===
- * %H 00 through 23 Two digit representation of the hour in 24-hour format
- * %I 01 through 12 Two digit representation of the hour in 12-hour format
- * %l 1 through 12 Hour in 12-hour format, with a space preceeding single digits
- * %M 00 through 59 Two digit representation of the minute
- * %p AM/PM UPPER-CASE 'AM' or 'PM' based on the given time
- * %P am/pm lower-case 'am' or 'pm' based on the given time
- * %r 09:34:17 PM Same as %I:%M:%S %p
- * %R 00:35 Same as %H:%M
- * %S 00 through 59 Two digit representation of the second
- * %T 21:34:17 Same as %H:%M:%S
- * %X 03:59:16 Preferred time representation based on locale, without the date
- * %z -0500 or EST Either the time zone offset from UTC or the abbreviation
- * %Z -0500 or EST The time zone offset/abbreviation option NOT given by %z
- *
- * === Time and Date ===
- * %D 02/05/09 Same as %m/%d/%y
- * %F 2009-02-05 Same as %Y-%m-%d (commonly used in database datestamps)
- * %s 305815200 Unix Epoch Time timestamp (same as the time() function)
- * %x 02/05/09 Preferred date representation, without the time
- *
- * === Miscellaneous ===
- * %n --- A newline character (\n)
- * %t --- A Tab character (\t)
- * %% --- A literal percentage character (%)
- *
- */
-
- jsDate.formats.php = {
- codes: {
- //
- // 2-part regex matcher for format codes
- //
- // first match must be the character before the code (to account for escaping)
- // second match must be the format code character(s)
- //
- matcher: /()%((%|[a-z]))/i,
- // day
- a: 'AbbrDayName',
- A: 'DayName',
- d: 'Date.2',
- e: 'Date',
- j: 'DayOfYear.3',
- u: 'DayOfWeek',
- w: 'Day',
- // week
- U: 'FullWeekOfYear.2',
- V: 'IsoWeek.2',
- W: 'WeekOfYear.2',
- // month
- b: 'AbbrMonthName',
- B: 'MonthName',
- m: 'MonthNumber.2',
- h: 'AbbrMonthName',
- // year
- C: 'Century.2',
- y: 'ShortYear.2',
- Y: 'FullYear',
- // time
- H: 'Hours.2',
- I: 'Hours12.2',
- l: 'Hours12',
- p: 'AMPM',
- P: 'AmPm',
- M: 'Minutes.2',
- S: 'Seconds.2',
- s: 'Unix',
- O: 'TimezoneOffset',
- z: 'GmtOffset',
- Z: 'TimezoneAbbr'
- },
-
- shortcuts: {
- D: '%m/%d/%y',
- F: '%Y-%m-%d',
- T: '%H:%M:%S',
- X: '%H:%M:%S',
- x: '%m/%d/%y',
- R: '%H:%M',
- r: '%I:%M:%S %p',
- t: '\t',
- n: '\n',
- '%': '%'
- }
- };
- //
- // Conceptually, the logic implemented here is similar to Ken Snyder's Date Instance Methods.
- // I use his idea of a set of parsers which can be regular expressions or functions,
- // iterating through those, and then seeing if Date.parse() will create a date.
- // The parser expressions and functions are a little different and some bugs have been
- // worked out. Also, a lot of "pre-parsing" is done to fix implementation
- // variations of Date.parse() between browsers.
- //
- jsDate.createDate = function(date) {
- // if passing in multiple arguments, try Date constructor
- if (date == null) {
- return new Date();
- }
- // If the passed value is already a date object, return it
- if (date instanceof Date) {
- return date;
- }
- // if (typeof date == 'number') return new Date(date * 1000);
- // If the passed value is an integer, interpret it as a javascript timestamp
- if (typeof date == 'number') {
- return new Date(date);
- }
-
- // Before passing strings into Date.parse(), have to normalize them for certain conditions.
- // If strings are not formatted staccording to the EcmaScript spec, results from Date parse will be implementation dependent.
- //
- // For example:
- // * FF and Opera assume 2 digit dates are pre y2k, Chome assumes <50 is pre y2k, 50+ is 21st century.
- // * Chrome will correctly parse '1984-1-25' into localtime, FF and Opera will not parse.
- // * Both FF, Chrome and Opera will parse '1984/1/25' into localtime.
-
- // remove leading and trailing spaces
- var parsable = String(date).replace(/^\s*(.+)\s*$/g, '$1');
-
- // replace dahses (-) with slashes (/) in dates like n[nnn]/n[n]/n[nnn]
- parsable = parsable.replace(/^([0-9]{1,4})-([0-9]{1,2})-([0-9]{1,4})/, "$1/$2/$3");
-
- /////////
- // Need to check for '15-Dec-09' also.
- // FF will not parse, but Chrome will.
- // Chrome will set date to 2009 as well.
- /////////
-
- // first check for 'dd-mmm-yyyy' or 'dd/mmm/yyyy' like '15-Dec-2010'
- parsable = parsable.replace(/^(3[01]|[0-2]?\d)[-\/]([a-z]{3,})[-\/](\d{4})/i, "$1 $2 $3");
-
- // Now check for 'dd-mmm-yy' or 'dd/mmm/yy' and normalize years to default century.
- var match = parsable.match(/^(3[01]|[0-2]?\d)[-\/]([a-z]{3,})[-\/](\d{2})\D*/i);
- if (match && match.length > 3) {
- var m3 = parseFloat(match[3]);
- var ny = jsDate.config.defaultCentury + m3;
- ny = String(ny);
-
- // now replace 2 digit year with 4 digit year
- parsable = parsable.replace(/^(3[01]|[0-2]?\d)[-\/]([a-z]{3,})[-\/](\d{2})\D*/i, match[1] +' '+ match[2] +' '+ ny);
-
- }
-
- // Check for '1/19/70 8:14PM'
- // where starts with mm/dd/yy or yy/mm/dd and have something after
- // Check if 1st postiion is greater than 31, assume it is year.
- // Assme all 2 digit years are 1900's.
- // Finally, change them into US style mm/dd/yyyy representations.
- match = parsable.match(/^([0-9]{1,2})[-\/]([0-9]{1,2})[-\/]([0-9]{1,2})[^0-9]/);
-
- function h1(parsable, match) {
- var m1 = parseFloat(match[1]);
- var m2 = parseFloat(match[2]);
- var m3 = parseFloat(match[3]);
- var cent = jsDate.config.defaultCentury;
- var ny, nd, nm, str;
-
- if (m1 > 31) { // first number is a year
- nd = m3;
- nm = m2;
- ny = cent + m1;
- }
-
- else { // last number is the year
- nd = m2;
- nm = m1;
- ny = cent + m3;
- }
-
- str = nm+'/'+nd+'/'+ny;
-
- // now replace 2 digit year with 4 digit year
- return parsable.replace(/^([0-9]{1,2})[-\/]([0-9]{1,2})[-\/]([0-9]{1,2})/, str);
-
- }
-
- if (match && match.length > 3) {
- parsable = h1(parsable, match);
- }
-
- // Now check for '1/19/70' with nothing after and do as above
- var match = parsable.match(/^([0-9]{1,2})[-\/]([0-9]{1,2})[-\/]([0-9]{1,2})$/);
-
- if (match && match.length > 3) {
- parsable = h1(parsable, match);
- }
-
-
- var i = 0;
- var length = jsDate.matchers.length;
- var pattern,
- ms,
- current = parsable,
- obj;
- while (i < length) {
- ms = Date.parse(current);
- if (!isNaN(ms)) {
- return new Date(ms);
- }
- pattern = jsDate.matchers[i];
- if (typeof pattern == 'function') {
- obj = pattern.call(jsDate, current);
- if (obj instanceof Date) {
- return obj;
- }
- } else {
- current = parsable.replace(pattern[0], pattern[1]);
- }
- i++;
- }
- return NaN;
- };
-
-
- /**
- * @static
- * Handy static utility function to return the number of days in a given month.
- * @param {Integer} year Year
- * @param {Integer} month Month (1-12)
- * @returns {Integer} Number of days in the month.
- */
- //
- // handy utility method Borrowed right from Ken Snyder's Date Instance Mehtods.
- //
- jsDate.daysInMonth = function(year, month) {
- if (month == 2) {
- return new Date(year, 1, 29).getDate() == 29 ? 29 : 28;
- }
- return [undefined,31,undefined,31,30,31,30,31,31,30,31,30,31][month];
- };
-
-
- //
- // An Array of regular expressions or functions that will attempt to match the date string.
- // Functions are called with scope of a jsDate instance.
- //
- jsDate.matchers = [
- // convert dd.mmm.yyyy to mm/dd/yyyy (world date to US date).
- [/(3[01]|[0-2]\d)\s*\.\s*(1[0-2]|0\d)\s*\.\s*([1-9]\d{3})/, '$2/$1/$3'],
- // convert yyyy-mm-dd to mm/dd/yyyy (ISO date to US date).
- [/([1-9]\d{3})\s*-\s*(1[0-2]|0\d)\s*-\s*(3[01]|[0-2]\d)/, '$2/$3/$1'],
- // Handle 12 hour or 24 hour time with milliseconds am/pm and optional date part.
- function(str) {
- var match = str.match(/^(?:(.+)\s+)?([012]?\d)(?:\s*\:\s*(\d\d))?(?:\s*\:\s*(\d\d(\.\d*)?))?\s*(am|pm)?\s*$/i);
- // opt. date hour opt. minute opt. second opt. msec opt. am or pm
- if (match) {
- if (match[1]) {
- var d = this.createDate(match[1]);
- if (isNaN(d)) {
- return;
- }
- } else {
- var d = new Date();
- d.setMilliseconds(0);
- }
- var hour = parseFloat(match[2]);
- if (match[6]) {
- hour = match[6].toLowerCase() == 'am' ? (hour == 12 ? 0 : hour) : (hour == 12 ? 12 : hour + 12);
- }
- d.setHours(hour, parseInt(match[3] || 0, 10), parseInt(match[4] || 0, 10), ((parseFloat(match[5] || 0)) || 0)*1000);
- return d;
- }
- else {
- return str;
- }
- },
- // Handle ISO timestamp with time zone.
- function(str) {
- var match = str.match(/^(?:(.+))[T|\s+]([012]\d)(?:\:(\d\d))(?:\:(\d\d))(?:\.\d+)([\+\-]\d\d\:\d\d)$/i);
- if (match) {
- if (match[1]) {
- var d = this.createDate(match[1]);
- if (isNaN(d)) {
- return;
- }
- } else {
- var d = new Date();
- d.setMilliseconds(0);
- }
- var hour = parseFloat(match[2]);
- d.setHours(hour, parseInt(match[3], 10), parseInt(match[4], 10), parseFloat(match[5])*1000);
- return d;
- }
- else {
- return str;
- }
- },
- // Try to match ambiguous strings like 12/8/22.
- // Use FF date assumption that 2 digit years are 20th century (i.e. 1900's).
- // This may be redundant with pre processing of date already performed.
- function(str) {
- var match = str.match(/^([0-3]?\d)\s*[-\/.\s]{1}\s*([a-zA-Z]{3,9})\s*[-\/.\s]{1}\s*([0-3]?\d)$/);
- if (match) {
- var d = new Date();
- var cent = jsDate.config.defaultCentury;
- var m1 = parseFloat(match[1]);
- var m3 = parseFloat(match[3]);
- var ny, nd, nm;
- if (m1 > 31) { // first number is a year
- nd = m3;
- ny = cent + m1;
- }
-
- else { // last number is the year
- nd = m1;
- ny = cent + m3;
- }
-
- var nm = inArray(match[2], jsDate.regional[jsDate.regional.getLocale()]["monthNamesShort"]);
-
- if (nm == -1) {
- nm = inArray(match[2], jsDate.regional[jsDate.regional.getLocale()]["monthNames"]);
- }
-
- d.setFullYear(ny, nm, nd);
- d.setHours(0,0,0,0);
- return d;
- }
-
- else {
- return str;
- }
- }
- ];
-
- //
- // I think John Reisig published this method on his blog, ejohn.
- //
- function inArray( elem, array ) {
- if ( array.indexOf ) {
- return array.indexOf( elem );
- }
-
- for ( var i = 0, length = array.length; i < length; i++ ) {
- if ( array[ i ] === elem ) {
- return i;
- }
- }
-
- return -1;
- }
-
- //
- // Thanks to Kangax, Christian Sciberras and Stack Overflow for this method.
- //
- function get_type(thing){
- if(thing===null) return "[object Null]"; // special case
- return Object.prototype.toString.call(thing);
- }
-
- $.jsDate = jsDate;
-
-
- /**
- * JavaScript printf/sprintf functions.
- *
- * This code has been adapted from the publicly available sprintf methods
- * by Ash Searle. His original header follows:
- *
- * This code is unrestricted: you are free to use it however you like.
- *
- * The functions should work as expected, performing left or right alignment,
- * truncating strings, outputting numbers with a required precision etc.
- *
- * For complex cases, these functions follow the Perl implementations of
- * (s)printf, allowing arguments to be passed out-of-order, and to set the
- * precision or length of the output based on arguments instead of fixed
- * numbers.
- *
- * See http://perldoc.perl.org/functions/sprintf.html for more information.
- *
- * Implemented:
- * - zero and space-padding
- * - right and left-alignment,
- * - base X prefix (binary, octal and hex)
- * - positive number prefix
- * - (minimum) width
- * - precision / truncation / maximum width
- * - out of order arguments
- *
- * Not implemented (yet):
- * - vector flag
- * - size (bytes, words, long-words etc.)
- *
- * Will not implement:
- * - %n or %p (no pass-by-reference in JavaScript)
- *
- * @version 2007.04.27
- * @author Ash Searle
- *
- * You can see the original work and comments on his blog:
- * http://hexmen.com/blog/2007/03/printf-sprintf/
- * http://hexmen.com/js/sprintf.js
- */
-
- /**
- * @Modifications 2009.05.26
- * @author Chris Leonello
- *
- * Added %p %P specifier
- * Acts like %g or %G but will not add more significant digits to the output than present in the input.
- * Example:
- * Format: '%.3p', Input: 0.012, Output: 0.012
- * Format: '%.3g', Input: 0.012, Output: 0.0120
- * Format: '%.4p', Input: 12.0, Output: 12.0
- * Format: '%.4g', Input: 12.0, Output: 12.00
- * Format: '%.4p', Input: 4.321e-5, Output: 4.321e-5
- * Format: '%.4g', Input: 4.321e-5, Output: 4.3210e-5
- *
- * Example:
- * >>> $.jqplot.sprintf('%.2f, %d', 23.3452, 43.23)
- * "23.35, 43"
- * >>> $.jqplot.sprintf("no value: %n, decimal with thousands separator: %'d", 23.3452, 433524)
- * "no value: , decimal with thousands separator: 433,524"
- */
- $.jqplot.sprintf = function() {
- function pad(str, len, chr, leftJustify) {
- var padding = (str.length >= len) ? '' : Array(1 + len - str.length >>> 0).join(chr);
- return leftJustify ? str + padding : padding + str;
-
- }
-
- function thousand_separate(value) {
- var value_str = new String(value);
- for (var i=10; i>0; i--) {
- if (value_str == (value_str = value_str.replace(/^(\d+)(\d{3})/, "$1"+$.jqplot.sprintf.thousandsSeparator+"$2"))) break;
- }
- return value_str;
- }
-
- function justify(value, prefix, leftJustify, minWidth, zeroPad, htmlSpace) {
- var diff = minWidth - value.length;
- if (diff > 0) {
- var spchar = ' ';
- if (htmlSpace) { spchar = ' '; }
- if (leftJustify || !zeroPad) {
- value = pad(value, minWidth, spchar, leftJustify);
- } else {
- value = value.slice(0, prefix.length) + pad('', diff, '0', true) + value.slice(prefix.length);
- }
- }
- return value;
- }
-
- function formatBaseX(value, base, prefix, leftJustify, minWidth, precision, zeroPad, htmlSpace) {
- // Note: casts negative numbers to positive ones
- var number = value >>> 0;
- prefix = prefix && number && {'2': '0b', '8': '0', '16': '0x'}[base] || '';
- value = prefix + pad(number.toString(base), precision || 0, '0', false);
- return justify(value, prefix, leftJustify, minWidth, zeroPad, htmlSpace);
- }
-
- function formatString(value, leftJustify, minWidth, precision, zeroPad, htmlSpace) {
- if (precision != null) {
- value = value.slice(0, precision);
- }
- return justify(value, '', leftJustify, minWidth, zeroPad, htmlSpace);
- }
-
- var a = arguments, i = 0, format = a[i++];
-
- return format.replace($.jqplot.sprintf.regex, function(substring, valueIndex, flags, minWidth, _, precision, type) {
- if (substring == '%%') { return '%'; }
-
- // parse flags
- var leftJustify = false, positivePrefix = '', zeroPad = false, prefixBaseX = false, htmlSpace = false, thousandSeparation = false;
- for (var j = 0; flags && j < flags.length; j++) switch (flags.charAt(j)) {
- case ' ': positivePrefix = ' '; break;
- case '+': positivePrefix = '+'; break;
- case '-': leftJustify = true; break;
- case '0': zeroPad = true; break;
- case '#': prefixBaseX = true; break;
- case '&': htmlSpace = true; break;
- case '\'': thousandSeparation = true; break;
- }
-
- // parameters may be null, undefined, empty-string or real valued
- // we want to ignore null, undefined and empty-string values
-
- if (!minWidth) {
- minWidth = 0;
- }
- else if (minWidth == '*') {
- minWidth = +a[i++];
- }
- else if (minWidth.charAt(0) == '*') {
- minWidth = +a[minWidth.slice(1, -1)];
- }
- else {
- minWidth = +minWidth;
- }
-
- // Note: undocumented perl feature:
- if (minWidth < 0) {
- minWidth = -minWidth;
- leftJustify = true;
- }
-
- if (!isFinite(minWidth)) {
- throw new Error('$.jqplot.sprintf: (minimum-)width must be finite');
- }
-
- if (!precision) {
- precision = 'fFeE'.indexOf(type) > -1 ? 6 : (type == 'd') ? 0 : void(0);
- }
- else if (precision == '*') {
- precision = +a[i++];
- }
- else if (precision.charAt(0) == '*') {
- precision = +a[precision.slice(1, -1)];
- }
- else {
- precision = +precision;
- }
-
- // grab value using valueIndex if required?
- var value = valueIndex ? a[valueIndex.slice(0, -1)] : a[i++];
-
- switch (type) {
- case 's': {
- if (value == null) {
- return '';
- }
- return formatString(String(value), leftJustify, minWidth, precision, zeroPad, htmlSpace);
- }
- case 'c': return formatString(String.fromCharCode(+value), leftJustify, minWidth, precision, zeroPad, htmlSpace);
- case 'b': return formatBaseX(value, 2, prefixBaseX, leftJustify, minWidth, precision, zeroPad,htmlSpace);
- case 'o': return formatBaseX(value, 8, prefixBaseX, leftJustify, minWidth, precision, zeroPad, htmlSpace);
- case 'x': return formatBaseX(value, 16, prefixBaseX, leftJustify, minWidth, precision, zeroPad, htmlSpace);
- case 'X': return formatBaseX(value, 16, prefixBaseX, leftJustify, minWidth, precision, zeroPad, htmlSpace).toUpperCase();
- case 'u': return formatBaseX(value, 10, prefixBaseX, leftJustify, minWidth, precision, zeroPad, htmlSpace);
- case 'i': {
- var number = parseInt(+value, 10);
- if (isNaN(number)) {
- return '';
- }
- var prefix = number < 0 ? '-' : positivePrefix;
- var number_str = thousandSeparation ? thousand_separate(String(Math.abs(number))): String(Math.abs(number));
- value = prefix + pad(number_str, precision, '0', false);
- //value = prefix + pad(String(Math.abs(number)), precision, '0', false);
- return justify(value, prefix, leftJustify, minWidth, zeroPad, htmlSpace);
- }
- case 'd': {
- var number = Math.round(+value);
- if (isNaN(number)) {
- return '';
- }
- var prefix = number < 0 ? '-' : positivePrefix;
- var number_str = thousandSeparation ? thousand_separate(String(Math.abs(number))): String(Math.abs(number));
- value = prefix + pad(number_str, precision, '0', false);
- return justify(value, prefix, leftJustify, minWidth, zeroPad, htmlSpace);
- }
- case 'e':
- case 'E':
- case 'f':
- case 'F':
- case 'g':
- case 'G':
- {
- var number = +value;
- if (isNaN(number)) {
- return '';
- }
- var prefix = number < 0 ? '-' : positivePrefix;
- var method = ['toExponential', 'toFixed', 'toPrecision']['efg'.indexOf(type.toLowerCase())];
- var textTransform = ['toString', 'toUpperCase']['eEfFgG'.indexOf(type) % 2];
- var number_str = Math.abs(number)[method](precision);
- number_str = thousandSeparation ? thousand_separate(number_str): number_str;
- value = prefix + number_str;
- return justify(value, prefix, leftJustify, minWidth, zeroPad, htmlSpace)[textTransform]();
- }
- case 'p':
- case 'P':
- {
- // make sure number is a number
- var number = +value;
- if (isNaN(number)) {
- return '';
- }
- var prefix = number < 0 ? '-' : positivePrefix;
-
- var parts = String(Number(Math.abs(number)).toExponential()).split(/e|E/);
- var sd = (parts[0].indexOf('.') != -1) ? parts[0].length - 1 : parts[0].length;
- var zeros = (parts[1] < 0) ? -parts[1] - 1 : 0;
-
- if (Math.abs(number) < 1) {
- if (sd + zeros <= precision) {
- value = prefix + Math.abs(number).toPrecision(sd);
- }
- else {
- if (sd <= precision - 1) {
- value = prefix + Math.abs(number).toExponential(sd-1);
- }
- else {
- value = prefix + Math.abs(number).toExponential(precision-1);
- }
- }
- }
- else {
- var prec = (sd <= precision) ? sd : precision;
- value = prefix + Math.abs(number).toPrecision(prec);
- }
- var textTransform = ['toString', 'toUpperCase']['pP'.indexOf(type) % 2];
- return justify(value, prefix, leftJustify, minWidth, zeroPad, htmlSpace)[textTransform]();
- }
- case 'n': return '';
- default: return substring;
- }
- });
- };
-
- $.jqplot.sprintf.thousandsSeparator = ',';
-
- $.jqplot.sprintf.regex = /%%|%(\d+\$)?([-+#0&\' ]*)(\*\d+\$|\*|\d+)?(\.(\*\d+\$|\*|\d+))?([nAscboxXuidfegpEGP])/g;
-
- $.jqplot.getSignificantFigures = function(number) {
- var parts = String(Number(Math.abs(number)).toExponential()).split(/e|E/);
- // total significant digits
- var sd = (parts[0].indexOf('.') != -1) ? parts[0].length - 1 : parts[0].length;
- var zeros = (parts[1] < 0) ? -parts[1] - 1 : 0;
- // exponent
- var expn = parseInt(parts[1], 10);
- // digits to the left of the decimal place
- var dleft = (expn + 1 > 0) ? expn + 1 : 0;
- // digits to the right of the decimal place
- var dright = (sd <= dleft) ? 0 : sd - expn - 1;
- return {significantDigits: sd, digitsLeft: dleft, digitsRight: dright, zeros: zeros, exponent: expn} ;
- };
-
- $.jqplot.getPrecision = function(number) {
- return $.jqplot.getSignificantFigures(number).digitsRight;
- };
-
-})(jQuery);
-
-
- var backCompat = $.uiBackCompat !== false;
-
- $.jqplot.effects = {
- effect: {}
- };
-
- // prefix used for storing data on .data()
- var dataSpace = "jqplot.storage.";
-
- /******************************************************************************/
- /*********************************** EFFECTS **********************************/
- /******************************************************************************/
-
- $.extend( $.jqplot.effects, {
- version: "1.9pre",
-
- // Saves a set of properties in a data storage
- save: function( element, set ) {
- for( var i=0; i < set.length; i++ ) {
- if ( set[ i ] !== null ) {
- element.data( dataSpace + set[ i ], element[ 0 ].style[ set[ i ] ] );
- }
- }
- },
-
- // Restores a set of previously saved properties from a data storage
- restore: function( element, set ) {
- for( var i=0; i < set.length; i++ ) {
- if ( set[ i ] !== null ) {
- element.css( set[ i ], element.data( dataSpace + set[ i ] ) );
- }
- }
- },
-
- setMode: function( el, mode ) {
- if (mode === "toggle") {
- mode = el.is( ":hidden" ) ? "show" : "hide";
- }
- return mode;
- },
-
- // Wraps the element around a wrapper that copies position properties
- createWrapper: function( element ) {
-
- // if the element is already wrapped, return it
- if ( element.parent().is( ".ui-effects-wrapper" )) {
- return element.parent();
- }
-
- // wrap the element
- var props = {
- width: element.outerWidth(true),
- height: element.outerHeight(true),
- "float": element.css( "float" )
- },
- wrapper = $( "
" )
- .addClass( "ui-effects-wrapper" )
- .css({
- fontSize: "100%",
- background: "transparent",
- border: "none",
- margin: 0,
- padding: 0
- }),
- // Store the size in case width/height are defined in % - Fixes #5245
- size = {
- width: element.width(),
- height: element.height()
- },
- active = document.activeElement;
-
- element.wrap( wrapper );
-
- // Fixes #7595 - Elements lose focus when wrapped.
- if ( element[ 0 ] === active || $.contains( element[ 0 ], active ) ) {
- $( active ).focus();
- }
-
- wrapper = element.parent(); //Hotfix for jQuery 1.4 since some change in wrap() seems to actually loose the reference to the wrapped element
-
- // transfer positioning properties to the wrapper
- if ( element.css( "position" ) === "static" ) {
- wrapper.css({ position: "relative" });
- element.css({ position: "relative" });
- } else {
- $.extend( props, {
- position: element.css( "position" ),
- zIndex: element.css( "z-index" )
- });
- $.each([ "top", "left", "bottom", "right" ], function(i, pos) {
- props[ pos ] = element.css( pos );
- if ( isNaN( parseInt( props[ pos ], 10 ) ) ) {
- props[ pos ] = "auto";
- }
- });
- element.css({
- position: "relative",
- top: 0,
- left: 0,
- right: "auto",
- bottom: "auto"
- });
- }
- element.css(size);
-
- return wrapper.css( props ).show();
- },
-
- removeWrapper: function( element ) {
- var active = document.activeElement;
-
- if ( element.parent().is( ".ui-effects-wrapper" ) ) {
- element.parent().replaceWith( element );
-
- // Fixes #7595 - Elements lose focus when wrapped.
- if ( element[ 0 ] === active || $.contains( element[ 0 ], active ) ) {
- $( active ).focus();
- }
- }
-
-
- return element;
- }
- });
-
- // return an effect options object for the given parameters:
- function _normalizeArguments( effect, options, speed, callback ) {
-
- // short path for passing an effect options object:
- if ( $.isPlainObject( effect ) ) {
- return effect;
- }
-
- // convert to an object
- effect = { effect: effect };
-
- // catch (effect)
- if ( options === undefined ) {
- options = {};
- }
-
- // catch (effect, callback)
- if ( $.isFunction( options ) ) {
- callback = options;
- speed = null;
- options = {};
- }
-
- // catch (effect, speed, ?)
- if ( $.type( options ) === "number" || $.fx.speeds[ options ]) {
- callback = speed;
- speed = options;
- options = {};
- }
-
- // catch (effect, options, callback)
- if ( $.isFunction( speed ) ) {
- callback = speed;
- speed = null;
- }
-
- // add options to effect
- if ( options ) {
- $.extend( effect, options );
- }
-
- speed = speed || options.duration;
- effect.duration = $.fx.off ? 0 : typeof speed === "number"
- ? speed : speed in $.fx.speeds ? $.fx.speeds[ speed ] : $.fx.speeds._default;
-
- effect.complete = callback || options.complete;
-
- return effect;
- }
-
- function standardSpeed( speed ) {
- // valid standard speeds
- if ( !speed || typeof speed === "number" || $.fx.speeds[ speed ] ) {
- return true;
- }
-
- // invalid strings - treat as "normal" speed
- if ( typeof speed === "string" && !$.jqplot.effects.effect[ speed ] ) {
- // TODO: remove in 2.0 (#7115)
- if ( backCompat && $.jqplot.effects[ speed ] ) {
- return false;
- }
- return true;
- }
-
- return false;
- }
-
- $.fn.extend({
- jqplotEffect: function( effect, options, speed, callback ) {
- var args = _normalizeArguments.apply( this, arguments ),
- mode = args.mode,
- queue = args.queue,
- effectMethod = $.jqplot.effects.effect[ args.effect ],
-
- // DEPRECATED: remove in 2.0 (#7115)
- oldEffectMethod = !effectMethod && backCompat && $.jqplot.effects[ args.effect ];
-
- if ( $.fx.off || !( effectMethod || oldEffectMethod ) ) {
- // delegate to the original method (e.g., .show()) if possible
- if ( mode ) {
- return this[ mode ]( args.duration, args.complete );
- } else {
- return this.each( function() {
- if ( args.complete ) {
- args.complete.call( this );
- }
- });
- }
- }
-
- function run( next ) {
- var elem = $( this ),
- complete = args.complete,
- mode = args.mode;
-
- function done() {
- if ( $.isFunction( complete ) ) {
- complete.call( elem[0] );
- }
- if ( $.isFunction( next ) ) {
- next();
- }
- }
-
- // if the element is hiddden and mode is hide,
- // or element is visible and mode is show
- if ( elem.is( ":hidden" ) ? mode === "hide" : mode === "show" ) {
- done();
- } else {
- effectMethod.call( elem[0], args, done );
- }
- }
-
- // TODO: remove this check in 2.0, effectMethod will always be true
- if ( effectMethod ) {
- return queue === false ? this.each( run ) : this.queue( queue || "fx", run );
- } else {
- // DEPRECATED: remove in 2.0 (#7115)
- return oldEffectMethod.call(this, {
- options: args,
- duration: args.duration,
- callback: args.complete,
- mode: args.mode
- });
- }
- }
- });
-
-
-
- var rvertical = /up|down|vertical/,
- rpositivemotion = /up|left|vertical|horizontal/;
-
- $.jqplot.effects.effect.blind = function( o, done ) {
- // Create element
- var el = $( this ),
- props = [ "position", "top", "bottom", "left", "right", "height", "width" ],
- mode = $.jqplot.effects.setMode( el, o.mode || "hide" ),
- direction = o.direction || "up",
- vertical = rvertical.test( direction ),
- ref = vertical ? "height" : "width",
- ref2 = vertical ? "top" : "left",
- motion = rpositivemotion.test( direction ),
- animation = {},
- show = mode === "show",
- wrapper, distance, top;
-
- // // if already wrapped, the wrapper's properties are my property. #6245
- if ( el.parent().is( ".ui-effects-wrapper" ) ) {
- $.jqplot.effects.save( el.parent(), props );
- } else {
- $.jqplot.effects.save( el, props );
- }
- el.show();
- top = parseInt(el.css('top'), 10);
- wrapper = $.jqplot.effects.createWrapper( el ).css({
- overflow: "hidden"
- });
-
- distance = vertical ? wrapper[ ref ]() + top : wrapper[ ref ]();
-
- animation[ ref ] = show ? String(distance) : '0';
- if ( !motion ) {
- el
- .css( vertical ? "bottom" : "right", 0 )
- .css( vertical ? "top" : "left", "" )
- .css({ position: "absolute" });
- animation[ ref2 ] = show ? '0' : String(distance);
- }
-
- // // start at 0 if we are showing
- if ( show ) {
- wrapper.css( ref, 0 );
- if ( ! motion ) {
- wrapper.css( ref2, distance );
- }
- }
-
- // // Animate
- wrapper.animate( animation, {
- duration: o.duration,
- easing: o.easing,
- queue: false,
- complete: function() {
- if ( mode === "hide" ) {
- el.hide();
- }
- $.jqplot.effects.restore( el, props );
- $.jqplot.effects.removeWrapper( el );
- done();
- }
- });
-
- };
-
-
diff --git a/libreplan-webapp/src/main/webapp/jqplot/jquery.js b/libreplan-webapp/src/main/webapp/jqplot/jquery.js
deleted file mode 100644
index 11e6d0679..000000000
--- a/libreplan-webapp/src/main/webapp/jqplot/jquery.js
+++ /dev/null
@@ -1,9046 +0,0 @@
-/*!
- * jQuery JavaScript Library v1.6.4
- * http://jquery.com/
- *
- * Copyright 2011, John Resig
- * Dual licensed under the MIT or GPL Version 2 licenses.
- * http://jquery.org/license
- *
- * Includes Sizzle.js
- * http://sizzlejs.com/
- * Copyright 2011, The Dojo Foundation
- * Released under the MIT, BSD, and GPL Licenses.
- *
- * Date: Mon Sep 12 18:54:48 2011 -0400
- */
-(function( window, undefined ) {
-
-// Use the correct document accordingly with window argument (sandbox)
-var document = window.document,
- navigator = window.navigator,
- location = window.location;
-var jQuery = (function() {
-
-// Define a local copy of jQuery
-var jQuery = function( selector, context ) {
- // The jQuery object is actually just the init constructor 'enhanced'
- return new jQuery.fn.init( selector, context, rootjQuery );
- },
-
- // Map over jQuery in case of overwrite
- _jQuery = window.jQuery,
-
- // Map over the $ in case of overwrite
- _$ = window.$,
-
- // A central reference to the root jQuery(document)
- rootjQuery,
-
- // A simple way to check for HTML strings or ID strings
- // Prioritize #id over to avoid XSS via location.hash (#9521)
- quickExpr = /^(?:[^#<]*(<[\w\W]+>)[^>]*$|#([\w\-]*)$)/,
-
- // Check if a string has a non-whitespace character in it
- rnotwhite = /\S/,
-
- // Used for trimming whitespace
- trimLeft = /^\s+/,
- trimRight = /\s+$/,
-
- // Check for digits
- rdigit = /\d/,
-
- // Match a standalone tag
- rsingleTag = /^<(\w+)\s*\/?>(?:<\/\1>)?$/,
-
- // JSON RegExp
- rvalidchars = /^[\],:{}\s]*$/,
- rvalidescape = /\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,
- rvalidtokens = /"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,
- rvalidbraces = /(?:^|:|,)(?:\s*\[)+/g,
-
- // Useragent RegExp
- rwebkit = /(webkit)[ \/]([\w.]+)/,
- ropera = /(opera)(?:.*version)?[ \/]([\w.]+)/,
- rmsie = /(msie) ([\w.]+)/,
- rmozilla = /(mozilla)(?:.*? rv:([\w.]+))?/,
-
- // Matches dashed string for camelizing
- rdashAlpha = /-([a-z]|[0-9])/ig,
- rmsPrefix = /^-ms-/,
-
- // Used by jQuery.camelCase as callback to replace()
- fcamelCase = function( all, letter ) {
- return ( letter + "" ).toUpperCase();
- },
-
- // Keep a UserAgent string for use with jQuery.browser
- userAgent = navigator.userAgent,
-
- // For matching the engine and version of the browser
- browserMatch,
-
- // The deferred used on DOM ready
- readyList,
-
- // The ready event handler
- DOMContentLoaded,
-
- // Save a reference to some core methods
- toString = Object.prototype.toString,
- hasOwn = Object.prototype.hasOwnProperty,
- push = Array.prototype.push,
- slice = Array.prototype.slice,
- trim = String.prototype.trim,
- indexOf = Array.prototype.indexOf,
-
- // [[Class]] -> type pairs
- class2type = {};
-
-jQuery.fn = jQuery.prototype = {
- constructor: jQuery,
- init: function( selector, context, rootjQuery ) {
- var match, elem, ret, doc;
-
- // Handle $(""), $(null), or $(undefined)
- if ( !selector ) {
- return this;
- }
-
- // Handle $(DOMElement)
- if ( selector.nodeType ) {
- this.context = this[0] = selector;
- this.length = 1;
- return this;
- }
-
- // The body element only exists once, optimize finding it
- if ( selector === "body" && !context && document.body ) {
- this.context = document;
- this[0] = document.body;
- this.selector = selector;
- this.length = 1;
- return this;
- }
-
- // Handle HTML strings
- if ( typeof selector === "string" ) {
- // Are we dealing with HTML string or an ID?
- if ( selector.charAt(0) === "<" && selector.charAt( selector.length - 1 ) === ">" && selector.length >= 3 ) {
- // Assume that strings that start and end with <> are HTML and skip the regex check
- match = [ null, selector, null ];
-
- } else {
- match = quickExpr.exec( selector );
- }
-
- // Verify a match, and that no context was specified for #id
- if ( match && (match[1] || !context) ) {
-
- // HANDLE: $(html) -> $(array)
- if ( match[1] ) {
- context = context instanceof jQuery ? context[0] : context;
- doc = (context ? context.ownerDocument || context : document);
-
- // If a single string is passed in and it's a single tag
- // just do a createElement and skip the rest
- ret = rsingleTag.exec( selector );
-
- if ( ret ) {
- if ( jQuery.isPlainObject( context ) ) {
- selector = [ document.createElement( ret[1] ) ];
- jQuery.fn.attr.call( selector, context, true );
-
- } else {
- selector = [ doc.createElement( ret[1] ) ];
- }
-
- } else {
- ret = jQuery.buildFragment( [ match[1] ], [ doc ] );
- selector = (ret.cacheable ? jQuery.clone(ret.fragment) : ret.fragment).childNodes;
- }
-
- return jQuery.merge( this, selector );
-
- // HANDLE: $("#id")
- } else {
- elem = document.getElementById( match[2] );
-
- // Check parentNode to catch when Blackberry 4.6 returns
- // nodes that are no longer in the document #6963
- if ( elem && elem.parentNode ) {
- // Handle the case where IE and Opera return items
- // by name instead of ID
- if ( elem.id !== match[2] ) {
- return rootjQuery.find( selector );
- }
-
- // Otherwise, we inject the element directly into the jQuery object
- this.length = 1;
- this[0] = elem;
- }
-
- this.context = document;
- this.selector = selector;
- return this;
- }
-
- // HANDLE: $(expr, $(...))
- } else if ( !context || context.jquery ) {
- return (context || rootjQuery).find( selector );
-
- // HANDLE: $(expr, context)
- // (which is just equivalent to: $(context).find(expr)
- } else {
- return this.constructor( context ).find( selector );
- }
-
- // HANDLE: $(function)
- // Shortcut for document ready
- } else if ( jQuery.isFunction( selector ) ) {
- return rootjQuery.ready( selector );
- }
-
- if (selector.selector !== undefined) {
- this.selector = selector.selector;
- this.context = selector.context;
- }
-
- return jQuery.makeArray( selector, this );
- },
-
- // Start with an empty selector
- selector: "",
-
- // The current version of jQuery being used
- jquery: "1.6.4",
-
- // The default length of a jQuery object is 0
- length: 0,
-
- // The number of elements contained in the matched element set
- size: function() {
- return this.length;
- },
-
- toArray: function() {
- return slice.call( this, 0 );
- },
-
- // Get the Nth element in the matched element set OR
- // Get the whole matched element set as a clean array
- get: function( num ) {
- return num == null ?
-
- // Return a 'clean' array
- this.toArray() :
-
- // Return just the object
- ( num < 0 ? this[ this.length + num ] : this[ num ] );
- },
-
- // Take an array of elements and push it onto the stack
- // (returning the new matched element set)
- pushStack: function( elems, name, selector ) {
- // Build a new jQuery matched element set
- var ret = this.constructor();
-
- if ( jQuery.isArray( elems ) ) {
- push.apply( ret, elems );
-
- } else {
- jQuery.merge( ret, elems );
- }
-
- // Add the old object onto the stack (as a reference)
- ret.prevObject = this;
-
- ret.context = this.context;
-
- if ( name === "find" ) {
- ret.selector = this.selector + (this.selector ? " " : "") + selector;
- } else if ( name ) {
- ret.selector = this.selector + "." + name + "(" + selector + ")";
- }
-
- // Return the newly-formed element set
- return ret;
- },
-
- // Execute a callback for every element in the matched set.
- // (You can seed the arguments with an array of args, but this is
- // only used internally.)
- each: function( callback, args ) {
- return jQuery.each( this, callback, args );
- },
-
- ready: function( fn ) {
- // Attach the listeners
- jQuery.bindReady();
-
- // Add the callback
- readyList.done( fn );
-
- return this;
- },
-
- eq: function( i ) {
- return i === -1 ?
- this.slice( i ) :
- this.slice( i, +i + 1 );
- },
-
- first: function() {
- return this.eq( 0 );
- },
-
- last: function() {
- return this.eq( -1 );
- },
-
- slice: function() {
- return this.pushStack( slice.apply( this, arguments ),
- "slice", slice.call(arguments).join(",") );
- },
-
- map: function( callback ) {
- return this.pushStack( jQuery.map(this, function( elem, i ) {
- return callback.call( elem, i, elem );
- }));
- },
-
- end: function() {
- return this.prevObject || this.constructor(null);
- },
-
- // For internal use only.
- // Behaves like an Array's method, not like a jQuery method.
- push: push,
- sort: [].sort,
- splice: [].splice
-};
-
-// Give the init function the jQuery prototype for later instantiation
-jQuery.fn.init.prototype = jQuery.fn;
-
-jQuery.extend = jQuery.fn.extend = function() {
- var options, name, src, copy, copyIsArray, clone,
- target = arguments[0] || {},
- i = 1,
- length = arguments.length,
- deep = false;
-
- // Handle a deep copy situation
- if ( typeof target === "boolean" ) {
- deep = target;
- target = arguments[1] || {};
- // skip the boolean and the target
- i = 2;
- }
-
- // Handle case when target is a string or something (possible in deep copy)
- if ( typeof target !== "object" && !jQuery.isFunction(target) ) {
- target = {};
- }
-
- // extend jQuery itself if only one argument is passed
- if ( length === i ) {
- target = this;
- --i;
- }
-
- for ( ; i < length; i++ ) {
- // Only deal with non-null/undefined values
- if ( (options = arguments[ i ]) != null ) {
- // Extend the base object
- for ( name in options ) {
- src = target[ name ];
- copy = options[ name ];
-
- // Prevent never-ending loop
- if ( target === copy ) {
- continue;
- }
-
- // Recurse if we're merging plain objects or arrays
- if ( deep && copy && ( jQuery.isPlainObject(copy) || (copyIsArray = jQuery.isArray(copy)) ) ) {
- if ( copyIsArray ) {
- copyIsArray = false;
- clone = src && jQuery.isArray(src) ? src : [];
-
- } else {
- clone = src && jQuery.isPlainObject(src) ? src : {};
- }
-
- // Never move original objects, clone them
- target[ name ] = jQuery.extend( deep, clone, copy );
-
- // Don't bring in undefined values
- } else if ( copy !== undefined ) {
- target[ name ] = copy;
- }
- }
- }
- }
-
- // Return the modified object
- return target;
-};
-
-jQuery.extend({
- noConflict: function( deep ) {
- if ( window.$ === jQuery ) {
- window.$ = _$;
- }
-
- if ( deep && window.jQuery === jQuery ) {
- window.jQuery = _jQuery;
- }
-
- return jQuery;
- },
-
- // Is the DOM ready to be used? Set to true once it occurs.
- isReady: false,
-
- // A counter to track how many items to wait for before
- // the ready event fires. See #6781
- readyWait: 1,
-
- // Hold (or release) the ready event
- holdReady: function( hold ) {
- if ( hold ) {
- jQuery.readyWait++;
- } else {
- jQuery.ready( true );
- }
- },
-
- // Handle when the DOM is ready
- ready: function( wait ) {
- // Either a released hold or an DOMready/load event and not yet ready
- if ( (wait === true && !--jQuery.readyWait) || (wait !== true && !jQuery.isReady) ) {
- // Make sure body exists, at least, in case IE gets a little overzealous (ticket #5443).
- if ( !document.body ) {
- return setTimeout( jQuery.ready, 1 );
- }
-
- // Remember that the DOM is ready
- jQuery.isReady = true;
-
- // If a normal DOM Ready event fired, decrement, and wait if need be
- if ( wait !== true && --jQuery.readyWait > 0 ) {
- return;
- }
-
- // If there are functions bound, to execute
- readyList.resolveWith( document, [ jQuery ] );
-
- // Trigger any bound ready events
- if ( jQuery.fn.trigger ) {
- jQuery( document ).trigger( "ready" ).unbind( "ready" );
- }
- }
- },
-
- bindReady: function() {
- if ( readyList ) {
- return;
- }
-
- readyList = jQuery._Deferred();
-
- // Catch cases where $(document).ready() is called after the
- // browser event has already occurred.
- if ( document.readyState === "complete" ) {
- // Handle it asynchronously to allow scripts the opportunity to delay ready
- return setTimeout( jQuery.ready, 1 );
- }
-
- // Mozilla, Opera and webkit nightlies currently support this event
- if ( document.addEventListener ) {
- // Use the handy event callback
- document.addEventListener( "DOMContentLoaded", DOMContentLoaded, false );
-
- // A fallback to window.onload, that will always work
- window.addEventListener( "load", jQuery.ready, false );
-
- // If IE event model is used
- } else if ( document.attachEvent ) {
- // ensure firing before onload,
- // maybe late but safe also for iframes
- document.attachEvent( "onreadystatechange", DOMContentLoaded );
-
- // A fallback to window.onload, that will always work
- window.attachEvent( "onload", jQuery.ready );
-
- // If IE and not a frame
- // continually check to see if the document is ready
- var toplevel = false;
-
- try {
- toplevel = window.frameElement == null;
- } catch(e) {}
-
- if ( document.documentElement.doScroll && toplevel ) {
- doScrollCheck();
- }
- }
- },
-
- // See test/unit/core.js for details concerning isFunction.
- // Since version 1.3, DOM methods and functions like alert
- // aren't supported. They return false on IE (#2968).
- isFunction: function( obj ) {
- return jQuery.type(obj) === "function";
- },
-
- isArray: Array.isArray || function( obj ) {
- return jQuery.type(obj) === "array";
- },
-
- // A crude way of determining if an object is a window
- isWindow: function( obj ) {
- return obj && typeof obj === "object" && "setInterval" in obj;
- },
-
- isNaN: function( obj ) {
- return obj == null || !rdigit.test( obj ) || isNaN( obj );
- },
-
- type: function( obj ) {
- return obj == null ?
- String( obj ) :
- class2type[ toString.call(obj) ] || "object";
- },
-
- isPlainObject: function( obj ) {
- // Must be an Object.
- // Because of IE, we also have to check the presence of the constructor property.
- // Make sure that DOM nodes and window objects don't pass through, as well
- if ( !obj || jQuery.type(obj) !== "object" || obj.nodeType || jQuery.isWindow( obj ) ) {
- return false;
- }
-
- try {
- // Not own constructor property must be Object
- if ( obj.constructor &&
- !hasOwn.call(obj, "constructor") &&
- !hasOwn.call(obj.constructor.prototype, "isPrototypeOf") ) {
- return false;
- }
- } catch ( e ) {
- // IE8,9 Will throw exceptions on certain host objects #9897
- return false;
- }
-
- // Own properties are enumerated firstly, so to speed up,
- // if last one is own, then all properties are own.
-
- var key;
- for ( key in obj ) {}
-
- return key === undefined || hasOwn.call( obj, key );
- },
-
- isEmptyObject: function( obj ) {
- for ( var name in obj ) {
- return false;
- }
- return true;
- },
-
- error: function( msg ) {
- throw msg;
- },
-
- parseJSON: function( data ) {
- if ( typeof data !== "string" || !data ) {
- return null;
- }
-
- // Make sure leading/trailing whitespace is removed (IE can't handle it)
- data = jQuery.trim( data );
-
- // Attempt to parse using the native JSON parser first
- if ( window.JSON && window.JSON.parse ) {
- return window.JSON.parse( data );
- }
-
- // Make sure the incoming data is actual JSON
- // Logic borrowed from http://json.org/json2.js
- if ( rvalidchars.test( data.replace( rvalidescape, "@" )
- .replace( rvalidtokens, "]" )
- .replace( rvalidbraces, "")) ) {
-
- return (new Function( "return " + data ))();
-
- }
- jQuery.error( "Invalid JSON: " + data );
- },
-
- // Cross-browser xml parsing
- parseXML: function( data ) {
- var xml, tmp;
- try {
- if ( window.DOMParser ) { // Standard
- tmp = new DOMParser();
- xml = tmp.parseFromString( data , "text/xml" );
- } else { // IE
- xml = new ActiveXObject( "Microsoft.XMLDOM" );
- xml.async = "false";
- xml.loadXML( data );
- }
- } catch( e ) {
- xml = undefined;
- }
- if ( !xml || !xml.documentElement || xml.getElementsByTagName( "parsererror" ).length ) {
- jQuery.error( "Invalid XML: " + data );
- }
- return xml;
- },
-
- noop: function() {},
-
- // Evaluates a script in a global context
- // Workarounds based on findings by Jim Driscoll
- // http://weblogs.java.net/blog/driscoll/archive/2009/09/08/eval-javascript-global-context
- globalEval: function( data ) {
- if ( data && rnotwhite.test( data ) ) {
- // We use execScript on Internet Explorer
- // We use an anonymous function so that context is window
- // rather than jQuery in Firefox
- ( window.execScript || function( data ) {
- window[ "eval" ].call( window, data );
- } )( data );
- }
- },
-
- // Convert dashed to camelCase; used by the css and data modules
- // Microsoft forgot to hump their vendor prefix (#9572)
- camelCase: function( string ) {
- return string.replace( rmsPrefix, "ms-" ).replace( rdashAlpha, fcamelCase );
- },
-
- nodeName: function( elem, name ) {
- return elem.nodeName && elem.nodeName.toUpperCase() === name.toUpperCase();
- },
-
- // args is for internal usage only
- each: function( object, callback, args ) {
- var name, i = 0,
- length = object.length,
- isObj = length === undefined || jQuery.isFunction( object );
-
- if ( args ) {
- if ( isObj ) {
- for ( name in object ) {
- if ( callback.apply( object[ name ], args ) === false ) {
- break;
- }
- }
- } else {
- for ( ; i < length; ) {
- if ( callback.apply( object[ i++ ], args ) === false ) {
- break;
- }
- }
- }
-
- // A special, fast, case for the most common use of each
- } else {
- if ( isObj ) {
- for ( name in object ) {
- if ( callback.call( object[ name ], name, object[ name ] ) === false ) {
- break;
- }
- }
- } else {
- for ( ; i < length; ) {
- if ( callback.call( object[ i ], i, object[ i++ ] ) === false ) {
- break;
- }
- }
- }
- }
-
- return object;
- },
-
- // Use native String.trim function wherever possible
- trim: trim ?
- function( text ) {
- return text == null ?
- "" :
- trim.call( text );
- } :
-
- // Otherwise use our own trimming functionality
- function( text ) {
- return text == null ?
- "" :
- text.toString().replace( trimLeft, "" ).replace( trimRight, "" );
- },
-
- // results is for internal usage only
- makeArray: function( array, results ) {
- var ret = results || [];
-
- if ( array != null ) {
- // The window, strings (and functions) also have 'length'
- // The extra typeof function check is to prevent crashes
- // in Safari 2 (See: #3039)
- // Tweaked logic slightly to handle Blackberry 4.7 RegExp issues #6930
- var type = jQuery.type( array );
-
- if ( array.length == null || type === "string" || type === "function" || type === "regexp" || jQuery.isWindow( array ) ) {
- push.call( ret, array );
- } else {
- jQuery.merge( ret, array );
- }
- }
-
- return ret;
- },
-
- inArray: function( elem, array ) {
- if ( !array ) {
- return -1;
- }
-
- if ( indexOf ) {
- return indexOf.call( array, elem );
- }
-
- for ( var i = 0, length = array.length; i < length; i++ ) {
- if ( array[ i ] === elem ) {
- return i;
- }
- }
-
- return -1;
- },
-
- merge: function( first, second ) {
- var i = first.length,
- j = 0;
-
- if ( typeof second.length === "number" ) {
- for ( var l = second.length; j < l; j++ ) {
- first[ i++ ] = second[ j ];
- }
-
- } else {
- while ( second[j] !== undefined ) {
- first[ i++ ] = second[ j++ ];
- }
- }
-
- first.length = i;
-
- return first;
- },
-
- grep: function( elems, callback, inv ) {
- var ret = [], retVal;
- inv = !!inv;
-
- // Go through the array, only saving the items
- // that pass the validator function
- for ( var i = 0, length = elems.length; i < length; i++ ) {
- retVal = !!callback( elems[ i ], i );
- if ( inv !== retVal ) {
- ret.push( elems[ i ] );
- }
- }
-
- return ret;
- },
-
- // arg is for internal usage only
- map: function( elems, callback, arg ) {
- var value, key, ret = [],
- i = 0,
- length = elems.length,
- // jquery objects are treated as arrays
- isArray = elems instanceof jQuery || length !== undefined && typeof length === "number" && ( ( length > 0 && elems[ 0 ] && elems[ length -1 ] ) || length === 0 || jQuery.isArray( elems ) ) ;
-
- // Go through the array, translating each of the items to their
- if ( isArray ) {
- for ( ; i < length; i++ ) {
- value = callback( elems[ i ], i, arg );
-
- if ( value != null ) {
- ret[ ret.length ] = value;
- }
- }
-
- // Go through every key on the object,
- } else {
- for ( key in elems ) {
- value = callback( elems[ key ], key, arg );
-
- if ( value != null ) {
- ret[ ret.length ] = value;
- }
- }
- }
-
- // Flatten any nested arrays
- return ret.concat.apply( [], ret );
- },
-
- // A global GUID counter for objects
- guid: 1,
-
- // Bind a function to a context, optionally partially applying any
- // arguments.
- proxy: function( fn, context ) {
- if ( typeof context === "string" ) {
- var tmp = fn[ context ];
- context = fn;
- fn = tmp;
- }
-
- // Quick check to determine if target is callable, in the spec
- // this throws a TypeError, but we will just return undefined.
- if ( !jQuery.isFunction( fn ) ) {
- return undefined;
- }
-
- // Simulated bind
- var args = slice.call( arguments, 2 ),
- proxy = function() {
- return fn.apply( context, args.concat( slice.call( arguments ) ) );
- };
-
- // Set the guid of unique handler to the same of original handler, so it can be removed
- proxy.guid = fn.guid = fn.guid || proxy.guid || jQuery.guid++;
-
- return proxy;
- },
-
- // Mutifunctional method to get and set values to a collection
- // The value/s can optionally be executed if it's a function
- access: function( elems, key, value, exec, fn, pass ) {
- var length = elems.length;
-
- // Setting many attributes
- if ( typeof key === "object" ) {
- for ( var k in key ) {
- jQuery.access( elems, k, key[k], exec, fn, value );
- }
- return elems;
- }
-
- // Setting one attribute
- if ( value !== undefined ) {
- // Optionally, function values get executed if exec is true
- exec = !pass && exec && jQuery.isFunction(value);
-
- for ( var i = 0; i < length; i++ ) {
- fn( elems[i], key, exec ? value.call( elems[i], i, fn( elems[i], key ) ) : value, pass );
- }
-
- return elems;
- }
-
- // Getting an attribute
- return length ? fn( elems[0], key ) : undefined;
- },
-
- now: function() {
- return (new Date()).getTime();
- },
-
- // Use of jQuery.browser is frowned upon.
- // More details: http://docs.jquery.com/Utilities/jQuery.browser
- uaMatch: function( ua ) {
- ua = ua.toLowerCase();
-
- var match = rwebkit.exec( ua ) ||
- ropera.exec( ua ) ||
- rmsie.exec( ua ) ||
- ua.indexOf("compatible") < 0 && rmozilla.exec( ua ) ||
- [];
-
- return { browser: match[1] || "", version: match[2] || "0" };
- },
-
- sub: function() {
- function jQuerySub( selector, context ) {
- return new jQuerySub.fn.init( selector, context );
- }
- jQuery.extend( true, jQuerySub, this );
- jQuerySub.superclass = this;
- jQuerySub.fn = jQuerySub.prototype = this();
- jQuerySub.fn.constructor = jQuerySub;
- jQuerySub.sub = this.sub;
- jQuerySub.fn.init = function init( selector, context ) {
- if ( context && context instanceof jQuery && !(context instanceof jQuerySub) ) {
- context = jQuerySub( context );
- }
-
- return jQuery.fn.init.call( this, selector, context, rootjQuerySub );
- };
- jQuerySub.fn.init.prototype = jQuerySub.fn;
- var rootjQuerySub = jQuerySub(document);
- return jQuerySub;
- },
-
- browser: {}
-});
-
-// Populate the class2type map
-jQuery.each("Boolean Number String Function Array Date RegExp Object".split(" "), function(i, name) {
- class2type[ "[object " + name + "]" ] = name.toLowerCase();
-});
-
-browserMatch = jQuery.uaMatch( userAgent );
-if ( browserMatch.browser ) {
- jQuery.browser[ browserMatch.browser ] = true;
- jQuery.browser.version = browserMatch.version;
-}
-
-// Deprecated, use jQuery.browser.webkit instead
-if ( jQuery.browser.webkit ) {
- jQuery.browser.safari = true;
-}
-
-// IE doesn't match non-breaking spaces with \s
-if ( rnotwhite.test( "\xA0" ) ) {
- trimLeft = /^[\s\xA0]+/;
- trimRight = /[\s\xA0]+$/;
-}
-
-// All jQuery objects should point back to these
-rootjQuery = jQuery(document);
-
-// Cleanup functions for the document ready method
-if ( document.addEventListener ) {
- DOMContentLoaded = function() {
- document.removeEventListener( "DOMContentLoaded", DOMContentLoaded, false );
- jQuery.ready();
- };
-
-} else if ( document.attachEvent ) {
- DOMContentLoaded = function() {
- // Make sure body exists, at least, in case IE gets a little overzealous (ticket #5443).
- if ( document.readyState === "complete" ) {
- document.detachEvent( "onreadystatechange", DOMContentLoaded );
- jQuery.ready();
- }
- };
-}
-
-// The DOM ready check for Internet Explorer
-function doScrollCheck() {
- if ( jQuery.isReady ) {
- return;
- }
-
- try {
- // If IE is used, use the trick by Diego Perini
- // http://javascript.nwbox.com/IEContentLoaded/
- document.documentElement.doScroll("left");
- } catch(e) {
- setTimeout( doScrollCheck, 1 );
- return;
- }
-
- // and execute any waiting functions
- jQuery.ready();
-}
-
-return jQuery;
-
-})();
-
-
-var // Promise methods
- promiseMethods = "done fail isResolved isRejected promise then always pipe".split( " " ),
- // Static reference to slice
- sliceDeferred = [].slice;
-
-jQuery.extend({
- // Create a simple deferred (one callbacks list)
- _Deferred: function() {
- var // callbacks list
- callbacks = [],
- // stored [ context , args ]
- fired,
- // to avoid firing when already doing so
- firing,
- // flag to know if the deferred has been cancelled
- cancelled,
- // the deferred itself
- deferred = {
-
- // done( f1, f2, ...)
- done: function() {
- if ( !cancelled ) {
- var args = arguments,
- i,
- length,
- elem,
- type,
- _fired;
- if ( fired ) {
- _fired = fired;
- fired = 0;
- }
- for ( i = 0, length = args.length; i < length; i++ ) {
- elem = args[ i ];
- type = jQuery.type( elem );
- if ( type === "array" ) {
- deferred.done.apply( deferred, elem );
- } else if ( type === "function" ) {
- callbacks.push( elem );
- }
- }
- if ( _fired ) {
- deferred.resolveWith( _fired[ 0 ], _fired[ 1 ] );
- }
- }
- return this;
- },
-
- // resolve with given context and args
- resolveWith: function( context, args ) {
- if ( !cancelled && !fired && !firing ) {
- // make sure args are available (#8421)
- args = args || [];
- firing = 1;
- try {
- while( callbacks[ 0 ] ) {
- callbacks.shift().apply( context, args );
- }
- }
- finally {
- fired = [ context, args ];
- firing = 0;
- }
- }
- return this;
- },
-
- // resolve with this as context and given arguments
- resolve: function() {
- deferred.resolveWith( this, arguments );
- return this;
- },
-
- // Has this deferred been resolved?
- isResolved: function() {
- return !!( firing || fired );
- },
-
- // Cancel
- cancel: function() {
- cancelled = 1;
- callbacks = [];
- return this;
- }
- };
-
- return deferred;
- },
-
- // Full fledged deferred (two callbacks list)
- Deferred: function( func ) {
- var deferred = jQuery._Deferred(),
- failDeferred = jQuery._Deferred(),
- promise;
- // Add errorDeferred methods, then and promise
- jQuery.extend( deferred, {
- then: function( doneCallbacks, failCallbacks ) {
- deferred.done( doneCallbacks ).fail( failCallbacks );
- return this;
- },
- always: function() {
- return deferred.done.apply( deferred, arguments ).fail.apply( this, arguments );
- },
- fail: failDeferred.done,
- rejectWith: failDeferred.resolveWith,
- reject: failDeferred.resolve,
- isRejected: failDeferred.isResolved,
- pipe: function( fnDone, fnFail ) {
- return jQuery.Deferred(function( newDefer ) {
- jQuery.each( {
- done: [ fnDone, "resolve" ],
- fail: [ fnFail, "reject" ]
- }, function( handler, data ) {
- var fn = data[ 0 ],
- action = data[ 1 ],
- returned;
- if ( jQuery.isFunction( fn ) ) {
- deferred[ handler ](function() {
- returned = fn.apply( this, arguments );
- if ( returned && jQuery.isFunction( returned.promise ) ) {
- returned.promise().then( newDefer.resolve, newDefer.reject );
- } else {
- newDefer[ action + "With" ]( this === deferred ? newDefer : this, [ returned ] );
- }
- });
- } else {
- deferred[ handler ]( newDefer[ action ] );
- }
- });
- }).promise();
- },
- // Get a promise for this deferred
- // If obj is provided, the promise aspect is added to the object
- promise: function( obj ) {
- if ( obj == null ) {
- if ( promise ) {
- return promise;
- }
- promise = obj = {};
- }
- var i = promiseMethods.length;
- while( i-- ) {
- obj[ promiseMethods[i] ] = deferred[ promiseMethods[i] ];
- }
- return obj;
- }
- });
- // Make sure only one callback list will be used
- deferred.done( failDeferred.cancel ).fail( deferred.cancel );
- // Unexpose cancel
- delete deferred.cancel;
- // Call given func if any
- if ( func ) {
- func.call( deferred, deferred );
- }
- return deferred;
- },
-
- // Deferred helper
- when: function( firstParam ) {
- var args = arguments,
- i = 0,
- length = args.length,
- count = length,
- deferred = length <= 1 && firstParam && jQuery.isFunction( firstParam.promise ) ?
- firstParam :
- jQuery.Deferred();
- function resolveFunc( i ) {
- return function( value ) {
- args[ i ] = arguments.length > 1 ? sliceDeferred.call( arguments, 0 ) : value;
- if ( !( --count ) ) {
- // Strange bug in FF4:
- // Values changed onto the arguments object sometimes end up as undefined values
- // outside the $.when method. Cloning the object into a fresh array solves the issue
- deferred.resolveWith( deferred, sliceDeferred.call( args, 0 ) );
- }
- };
- }
- if ( length > 1 ) {
- for( ; i < length; i++ ) {
- if ( args[ i ] && jQuery.isFunction( args[ i ].promise ) ) {
- args[ i ].promise().then( resolveFunc(i), deferred.reject );
- } else {
- --count;
- }
- }
- if ( !count ) {
- deferred.resolveWith( deferred, args );
- }
- } else if ( deferred !== firstParam ) {
- deferred.resolveWith( deferred, length ? [ firstParam ] : [] );
- }
- return deferred.promise();
- }
-});
-
-
-
-jQuery.support = (function() {
-
- var div = document.createElement( "div" ),
- documentElement = document.documentElement,
- all,
- a,
- select,
- opt,
- input,
- marginDiv,
- support,
- fragment,
- body,
- testElementParent,
- testElement,
- testElementStyle,
- tds,
- events,
- eventName,
- i,
- isSupported;
-
- // Preliminary tests
- div.setAttribute("className", "t");
- div.innerHTML = " a ";
-
-
- all = div.getElementsByTagName( "*" );
- a = div.getElementsByTagName( "a" )[ 0 ];
-
- // Can't get basic test support
- if ( !all || !all.length || !a ) {
- return {};
- }
-
- // First batch of supports tests
- select = document.createElement( "select" );
- opt = select.appendChild( document.createElement("option") );
- input = div.getElementsByTagName( "input" )[ 0 ];
-
- support = {
- // IE strips leading whitespace when .innerHTML is used
- leadingWhitespace: ( div.firstChild.nodeType === 3 ),
-
- // Make sure that tbody elements aren't automatically inserted
- // IE will insert them into empty tables
- tbody: !div.getElementsByTagName( "tbody" ).length,
-
- // Make sure that link elements get serialized correctly by innerHTML
- // This requires a wrapper element in IE
- htmlSerialize: !!div.getElementsByTagName( "link" ).length,
-
- // Get the style information from getAttribute
- // (IE uses .cssText instead)
- style: /top/.test( a.getAttribute("style") ),
-
- // Make sure that URLs aren't manipulated
- // (IE normalizes it by default)
- hrefNormalized: ( a.getAttribute( "href" ) === "/a" ),
-
- // Make sure that element opacity exists
- // (IE uses filter instead)
- // Use a regex to work around a WebKit issue. See #5145
- opacity: /^0.55$/.test( a.style.opacity ),
-
- // Verify style float existence
- // (IE uses styleFloat instead of cssFloat)
- cssFloat: !!a.style.cssFloat,
-
- // Make sure that if no value is specified for a checkbox
- // that it defaults to "on".
- // (WebKit defaults to "" instead)
- checkOn: ( input.value === "on" ),
-
- // Make sure that a selected-by-default option has a working selected property.
- // (WebKit defaults to false instead of true, IE too, if it's in an optgroup)
- optSelected: opt.selected,
-
- // Test setAttribute on camelCase class. If it works, we need attrFixes when doing get/setAttribute (ie6/7)
- getSetAttribute: div.className !== "t",
-
- // Will be defined later
- submitBubbles: true,
- changeBubbles: true,
- focusinBubbles: false,
- deleteExpando: true,
- noCloneEvent: true,
- inlineBlockNeedsLayout: false,
- shrinkWrapBlocks: false,
- reliableMarginRight: true
- };
-
- // Make sure checked status is properly cloned
- input.checked = true;
- support.noCloneChecked = input.cloneNode( true ).checked;
-
- // Make sure that the options inside disabled selects aren't marked as disabled
- // (WebKit marks them as disabled)
- select.disabled = true;
- support.optDisabled = !opt.disabled;
-
- // Test to see if it's possible to delete an expando from an element
- // Fails in Internet Explorer
- try {
- delete div.test;
- } catch( e ) {
- support.deleteExpando = false;
- }
-
- if ( !div.addEventListener && div.attachEvent && div.fireEvent ) {
- div.attachEvent( "onclick", function() {
- // Cloning a node shouldn't copy over any
- // bound event handlers (IE does this)
- support.noCloneEvent = false;
- });
- div.cloneNode( true ).fireEvent( "onclick" );
- }
-
- // Check if a radio maintains it's value
- // after being appended to the DOM
- input = document.createElement("input");
- input.value = "t";
- input.setAttribute("type", "radio");
- support.radioValue = input.value === "t";
-
- input.setAttribute("checked", "checked");
- div.appendChild( input );
- fragment = document.createDocumentFragment();
- fragment.appendChild( div.firstChild );
-
- // WebKit doesn't clone checked state correctly in fragments
- support.checkClone = fragment.cloneNode( true ).cloneNode( true ).lastChild.checked;
-
- div.innerHTML = "";
-
- // Figure out if the W3C box model works as expected
- div.style.width = div.style.paddingLeft = "1px";
-
- body = document.getElementsByTagName( "body" )[ 0 ];
- // We use our own, invisible, body unless the body is already present
- // in which case we use a div (#9239)
- testElement = document.createElement( body ? "div" : "body" );
- testElementStyle = {
- visibility: "hidden",
- width: 0,
- height: 0,
- border: 0,
- margin: 0,
- background: "none"
- };
- if ( body ) {
- jQuery.extend( testElementStyle, {
- position: "absolute",
- left: "-1000px",
- top: "-1000px"
- });
- }
- for ( i in testElementStyle ) {
- testElement.style[ i ] = testElementStyle[ i ];
- }
- testElement.appendChild( div );
- testElementParent = body || documentElement;
- testElementParent.insertBefore( testElement, testElementParent.firstChild );
-
- // Check if a disconnected checkbox will retain its checked
- // value of true after appended to the DOM (IE6/7)
- support.appendChecked = input.checked;
-
- support.boxModel = div.offsetWidth === 2;
-
- if ( "zoom" in div.style ) {
- // Check if natively block-level elements act like inline-block
- // elements when setting their display to 'inline' and giving
- // them layout
- // (IE < 8 does this)
- div.style.display = "inline";
- div.style.zoom = 1;
- support.inlineBlockNeedsLayout = ( div.offsetWidth === 2 );
-
- // Check if elements with layout shrink-wrap their children
- // (IE 6 does this)
- div.style.display = "";
- div.innerHTML = "
";
- support.shrinkWrapBlocks = ( div.offsetWidth !== 2 );
- }
-
- div.innerHTML = "";
- tds = div.getElementsByTagName( "td" );
-
- // Check if table cells still have offsetWidth/Height when they are set
- // to display:none and there are still other visible table cells in a
- // table row; if so, offsetWidth/Height are not reliable for use when
- // determining if an element has been hidden directly using
- // display:none (it is still safe to use offsets if a parent element is
- // hidden; don safety goggles and see bug #4512 for more information).
- // (only IE 8 fails this test)
- isSupported = ( tds[ 0 ].offsetHeight === 0 );
-
- tds[ 0 ].style.display = "";
- tds[ 1 ].style.display = "none";
-
- // Check if empty table cells still have offsetWidth/Height
- // (IE < 8 fail this test)
- support.reliableHiddenOffsets = isSupported && ( tds[ 0 ].offsetHeight === 0 );
- div.innerHTML = "";
-
- // Check if div with explicit width and no margin-right incorrectly
- // gets computed margin-right based on width of container. For more
- // info see bug #3333
- // Fails in WebKit before Feb 2011 nightlies
- // WebKit Bug 13343 - getComputedStyle returns wrong value for margin-right
- if ( document.defaultView && document.defaultView.getComputedStyle ) {
- marginDiv = document.createElement( "div" );
- marginDiv.style.width = "0";
- marginDiv.style.marginRight = "0";
- div.appendChild( marginDiv );
- support.reliableMarginRight =
- ( parseInt( ( document.defaultView.getComputedStyle( marginDiv, null ) || { marginRight: 0 } ).marginRight, 10 ) || 0 ) === 0;
- }
-
- // Remove the body element we added
- testElement.innerHTML = "";
- testElementParent.removeChild( testElement );
-
- // Technique from Juriy Zaytsev
- // http://thinkweb2.com/projects/prototype/detecting-event-support-without-browser-sniffing/
- // We only care about the case where non-standard event systems
- // are used, namely in IE. Short-circuiting here helps us to
- // avoid an eval call (in setAttribute) which can cause CSP
- // to go haywire. See: https://developer.mozilla.org/en/Security/CSP
- if ( div.attachEvent ) {
- for( i in {
- submit: 1,
- change: 1,
- focusin: 1
- } ) {
- eventName = "on" + i;
- isSupported = ( eventName in div );
- if ( !isSupported ) {
- div.setAttribute( eventName, "return;" );
- isSupported = ( typeof div[ eventName ] === "function" );
- }
- support[ i + "Bubbles" ] = isSupported;
- }
- }
-
- // Null connected elements to avoid leaks in IE
- testElement = fragment = select = opt = body = marginDiv = div = input = null;
-
- return support;
-})();
-
-// Keep track of boxModel
-jQuery.boxModel = jQuery.support.boxModel;
-
-
-
-
-var rbrace = /^(?:\{.*\}|\[.*\])$/,
- rmultiDash = /([A-Z])/g;
-
-jQuery.extend({
- cache: {},
-
- // Please use with caution
- uuid: 0,
-
- // Unique for each copy of jQuery on the page
- // Non-digits removed to match rinlinejQuery
- expando: "jQuery" + ( jQuery.fn.jquery + Math.random() ).replace( /\D/g, "" ),
-
- // The following elements throw uncatchable exceptions if you
- // attempt to add expando properties to them.
- noData: {
- "embed": true,
- // Ban all objects except for Flash (which handle expandos)
- "object": "clsid:D27CDB6E-AE6D-11cf-96B8-444553540000",
- "applet": true
- },
-
- hasData: function( elem ) {
- elem = elem.nodeType ? jQuery.cache[ elem[jQuery.expando] ] : elem[ jQuery.expando ];
-
- return !!elem && !isEmptyDataObject( elem );
- },
-
- data: function( elem, name, data, pvt /* Internal Use Only */ ) {
- if ( !jQuery.acceptData( elem ) ) {
- return;
- }
-
- var thisCache, ret,
- internalKey = jQuery.expando,
- getByName = typeof name === "string",
-
- // We have to handle DOM nodes and JS objects differently because IE6-7
- // can't GC object references properly across the DOM-JS boundary
- isNode = elem.nodeType,
-
- // Only DOM nodes need the global jQuery cache; JS object data is
- // attached directly to the object so GC can occur automatically
- cache = isNode ? jQuery.cache : elem,
-
- // Only defining an ID for JS objects if its cache already exists allows
- // the code to shortcut on the same path as a DOM node with no cache
- id = isNode ? elem[ jQuery.expando ] : elem[ jQuery.expando ] && jQuery.expando;
-
- // Avoid doing any more work than we need to when trying to get data on an
- // object that has no data at all
- if ( (!id || (pvt && id && (cache[ id ] && !cache[ id ][ internalKey ]))) && getByName && data === undefined ) {
- return;
- }
-
- if ( !id ) {
- // Only DOM nodes need a new unique ID for each element since their data
- // ends up in the global cache
- if ( isNode ) {
- elem[ jQuery.expando ] = id = ++jQuery.uuid;
- } else {
- id = jQuery.expando;
- }
- }
-
- if ( !cache[ id ] ) {
- cache[ id ] = {};
-
- // TODO: This is a hack for 1.5 ONLY. Avoids exposing jQuery
- // metadata on plain JS objects when the object is serialized using
- // JSON.stringify
- if ( !isNode ) {
- cache[ id ].toJSON = jQuery.noop;
- }
- }
-
- // An object can be passed to jQuery.data instead of a key/value pair; this gets
- // shallow copied over onto the existing cache
- if ( typeof name === "object" || typeof name === "function" ) {
- if ( pvt ) {
- cache[ id ][ internalKey ] = jQuery.extend(cache[ id ][ internalKey ], name);
- } else {
- cache[ id ] = jQuery.extend(cache[ id ], name);
- }
- }
-
- thisCache = cache[ id ];
-
- // Internal jQuery data is stored in a separate object inside the object's data
- // cache in order to avoid key collisions between internal data and user-defined
- // data
- if ( pvt ) {
- if ( !thisCache[ internalKey ] ) {
- thisCache[ internalKey ] = {};
- }
-
- thisCache = thisCache[ internalKey ];
- }
-
- if ( data !== undefined ) {
- thisCache[ jQuery.camelCase( name ) ] = data;
- }
-
- // TODO: This is a hack for 1.5 ONLY. It will be removed in 1.6. Users should
- // not attempt to inspect the internal events object using jQuery.data, as this
- // internal data object is undocumented and subject to change.
- if ( name === "events" && !thisCache[name] ) {
- return thisCache[ internalKey ] && thisCache[ internalKey ].events;
- }
-
- // Check for both converted-to-camel and non-converted data property names
- // If a data property was specified
- if ( getByName ) {
-
- // First Try to find as-is property data
- ret = thisCache[ name ];
-
- // Test for null|undefined property data
- if ( ret == null ) {
-
- // Try to find the camelCased property
- ret = thisCache[ jQuery.camelCase( name ) ];
- }
- } else {
- ret = thisCache;
- }
-
- return ret;
- },
-
- removeData: function( elem, name, pvt /* Internal Use Only */ ) {
- if ( !jQuery.acceptData( elem ) ) {
- return;
- }
-
- var thisCache,
-
- // Reference to internal data cache key
- internalKey = jQuery.expando,
-
- isNode = elem.nodeType,
-
- // See jQuery.data for more information
- cache = isNode ? jQuery.cache : elem,
-
- // See jQuery.data for more information
- id = isNode ? elem[ jQuery.expando ] : jQuery.expando;
-
- // If there is already no cache entry for this object, there is no
- // purpose in continuing
- if ( !cache[ id ] ) {
- return;
- }
-
- if ( name ) {
-
- thisCache = pvt ? cache[ id ][ internalKey ] : cache[ id ];
-
- if ( thisCache ) {
-
- // Support interoperable removal of hyphenated or camelcased keys
- if ( !thisCache[ name ] ) {
- name = jQuery.camelCase( name );
- }
-
- delete thisCache[ name ];
-
- // If there is no data left in the cache, we want to continue
- // and let the cache object itself get destroyed
- if ( !isEmptyDataObject(thisCache) ) {
- return;
- }
- }
- }
-
- // See jQuery.data for more information
- if ( pvt ) {
- delete cache[ id ][ internalKey ];
-
- // Don't destroy the parent cache unless the internal data object
- // had been the only thing left in it
- if ( !isEmptyDataObject(cache[ id ]) ) {
- return;
- }
- }
-
- var internalCache = cache[ id ][ internalKey ];
-
- // Browsers that fail expando deletion also refuse to delete expandos on
- // the window, but it will allow it on all other JS objects; other browsers
- // don't care
- // Ensure that `cache` is not a window object #10080
- if ( jQuery.support.deleteExpando || !cache.setInterval ) {
- delete cache[ id ];
- } else {
- cache[ id ] = null;
- }
-
- // We destroyed the entire user cache at once because it's faster than
- // iterating through each key, but we need to continue to persist internal
- // data if it existed
- if ( internalCache ) {
- cache[ id ] = {};
- // TODO: This is a hack for 1.5 ONLY. Avoids exposing jQuery
- // metadata on plain JS objects when the object is serialized using
- // JSON.stringify
- if ( !isNode ) {
- cache[ id ].toJSON = jQuery.noop;
- }
-
- cache[ id ][ internalKey ] = internalCache;
-
- // Otherwise, we need to eliminate the expando on the node to avoid
- // false lookups in the cache for entries that no longer exist
- } else if ( isNode ) {
- // IE does not allow us to delete expando properties from nodes,
- // nor does it have a removeAttribute function on Document nodes;
- // we must handle all of these cases
- if ( jQuery.support.deleteExpando ) {
- delete elem[ jQuery.expando ];
- } else if ( elem.removeAttribute ) {
- elem.removeAttribute( jQuery.expando );
- } else {
- elem[ jQuery.expando ] = null;
- }
- }
- },
-
- // For internal use only.
- _data: function( elem, name, data ) {
- return jQuery.data( elem, name, data, true );
- },
-
- // A method for determining if a DOM node can handle the data expando
- acceptData: function( elem ) {
- if ( elem.nodeName ) {
- var match = jQuery.noData[ elem.nodeName.toLowerCase() ];
-
- if ( match ) {
- return !(match === true || elem.getAttribute("classid") !== match);
- }
- }
-
- return true;
- }
-});
-
-jQuery.fn.extend({
- data: function( key, value ) {
- var data = null;
-
- if ( typeof key === "undefined" ) {
- if ( this.length ) {
- data = jQuery.data( this[0] );
-
- if ( this[0].nodeType === 1 ) {
- var attr = this[0].attributes, name;
- for ( var i = 0, l = attr.length; i < l; i++ ) {
- name = attr[i].name;
-
- if ( name.indexOf( "data-" ) === 0 ) {
- name = jQuery.camelCase( name.substring(5) );
-
- dataAttr( this[0], name, data[ name ] );
- }
- }
- }
- }
-
- return data;
-
- } else if ( typeof key === "object" ) {
- return this.each(function() {
- jQuery.data( this, key );
- });
- }
-
- var parts = key.split(".");
- parts[1] = parts[1] ? "." + parts[1] : "";
-
- if ( value === undefined ) {
- data = this.triggerHandler("getData" + parts[1] + "!", [parts[0]]);
-
- // Try to fetch any internally stored data first
- if ( data === undefined && this.length ) {
- data = jQuery.data( this[0], key );
- data = dataAttr( this[0], key, data );
- }
-
- return data === undefined && parts[1] ?
- this.data( parts[0] ) :
- data;
-
- } else {
- return this.each(function() {
- var $this = jQuery( this ),
- args = [ parts[0], value ];
-
- $this.triggerHandler( "setData" + parts[1] + "!", args );
- jQuery.data( this, key, value );
- $this.triggerHandler( "changeData" + parts[1] + "!", args );
- });
- }
- },
-
- removeData: function( key ) {
- return this.each(function() {
- jQuery.removeData( this, key );
- });
- }
-});
-
-function dataAttr( elem, key, data ) {
- // If nothing was found internally, try to fetch any
- // data from the HTML5 data-* attribute
- if ( data === undefined && elem.nodeType === 1 ) {
-
- var name = "data-" + key.replace( rmultiDash, "-$1" ).toLowerCase();
-
- data = elem.getAttribute( name );
-
- if ( typeof data === "string" ) {
- try {
- data = data === "true" ? true :
- data === "false" ? false :
- data === "null" ? null :
- !jQuery.isNaN( data ) ? parseFloat( data ) :
- rbrace.test( data ) ? jQuery.parseJSON( data ) :
- data;
- } catch( e ) {}
-
- // Make sure we set the data so it isn't changed later
- jQuery.data( elem, key, data );
-
- } else {
- data = undefined;
- }
- }
-
- return data;
-}
-
-// TODO: This is a hack for 1.5 ONLY to allow objects with a single toJSON
-// property to be considered empty objects; this property always exists in
-// order to make sure JSON.stringify does not expose internal metadata
-function isEmptyDataObject( obj ) {
- for ( var name in obj ) {
- if ( name !== "toJSON" ) {
- return false;
- }
- }
-
- return true;
-}
-
-
-
-
-function handleQueueMarkDefer( elem, type, src ) {
- var deferDataKey = type + "defer",
- queueDataKey = type + "queue",
- markDataKey = type + "mark",
- defer = jQuery.data( elem, deferDataKey, undefined, true );
- if ( defer &&
- ( src === "queue" || !jQuery.data( elem, queueDataKey, undefined, true ) ) &&
- ( src === "mark" || !jQuery.data( elem, markDataKey, undefined, true ) ) ) {
- // Give room for hard-coded callbacks to fire first
- // and eventually mark/queue something else on the element
- setTimeout( function() {
- if ( !jQuery.data( elem, queueDataKey, undefined, true ) &&
- !jQuery.data( elem, markDataKey, undefined, true ) ) {
- jQuery.removeData( elem, deferDataKey, true );
- defer.resolve();
- }
- }, 0 );
- }
-}
-
-jQuery.extend({
-
- _mark: function( elem, type ) {
- if ( elem ) {
- type = (type || "fx") + "mark";
- jQuery.data( elem, type, (jQuery.data(elem,type,undefined,true) || 0) + 1, true );
- }
- },
-
- _unmark: function( force, elem, type ) {
- if ( force !== true ) {
- type = elem;
- elem = force;
- force = false;
- }
- if ( elem ) {
- type = type || "fx";
- var key = type + "mark",
- count = force ? 0 : ( (jQuery.data( elem, key, undefined, true) || 1 ) - 1 );
- if ( count ) {
- jQuery.data( elem, key, count, true );
- } else {
- jQuery.removeData( elem, key, true );
- handleQueueMarkDefer( elem, type, "mark" );
- }
- }
- },
-
- queue: function( elem, type, data ) {
- if ( elem ) {
- type = (type || "fx") + "queue";
- var q = jQuery.data( elem, type, undefined, true );
- // Speed up dequeue by getting out quickly if this is just a lookup
- if ( data ) {
- if ( !q || jQuery.isArray(data) ) {
- q = jQuery.data( elem, type, jQuery.makeArray(data), true );
- } else {
- q.push( data );
- }
- }
- return q || [];
- }
- },
-
- dequeue: function( elem, type ) {
- type = type || "fx";
-
- var queue = jQuery.queue( elem, type ),
- fn = queue.shift(),
- defer;
-
- // If the fx queue is dequeued, always remove the progress sentinel
- if ( fn === "inprogress" ) {
- fn = queue.shift();
- }
-
- if ( fn ) {
- // Add a progress sentinel to prevent the fx queue from being
- // automatically dequeued
- if ( type === "fx" ) {
- queue.unshift("inprogress");
- }
-
- fn.call(elem, function() {
- jQuery.dequeue(elem, type);
- });
- }
-
- if ( !queue.length ) {
- jQuery.removeData( elem, type + "queue", true );
- handleQueueMarkDefer( elem, type, "queue" );
- }
- }
-});
-
-jQuery.fn.extend({
- queue: function( type, data ) {
- if ( typeof type !== "string" ) {
- data = type;
- type = "fx";
- }
-
- if ( data === undefined ) {
- return jQuery.queue( this[0], type );
- }
- return this.each(function() {
- var queue = jQuery.queue( this, type, data );
-
- if ( type === "fx" && queue[0] !== "inprogress" ) {
- jQuery.dequeue( this, type );
- }
- });
- },
- dequeue: function( type ) {
- return this.each(function() {
- jQuery.dequeue( this, type );
- });
- },
- // Based off of the plugin by Clint Helfers, with permission.
- // http://blindsignals.com/index.php/2009/07/jquery-delay/
- delay: function( time, type ) {
- time = jQuery.fx ? jQuery.fx.speeds[time] || time : time;
- type = type || "fx";
-
- return this.queue( type, function() {
- var elem = this;
- setTimeout(function() {
- jQuery.dequeue( elem, type );
- }, time );
- });
- },
- clearQueue: function( type ) {
- return this.queue( type || "fx", [] );
- },
- // Get a promise resolved when queues of a certain type
- // are emptied (fx is the type by default)
- promise: function( type, object ) {
- if ( typeof type !== "string" ) {
- object = type;
- type = undefined;
- }
- type = type || "fx";
- var defer = jQuery.Deferred(),
- elements = this,
- i = elements.length,
- count = 1,
- deferDataKey = type + "defer",
- queueDataKey = type + "queue",
- markDataKey = type + "mark",
- tmp;
- function resolve() {
- if ( !( --count ) ) {
- defer.resolveWith( elements, [ elements ] );
- }
- }
- while( i-- ) {
- if (( tmp = jQuery.data( elements[ i ], deferDataKey, undefined, true ) ||
- ( jQuery.data( elements[ i ], queueDataKey, undefined, true ) ||
- jQuery.data( elements[ i ], markDataKey, undefined, true ) ) &&
- jQuery.data( elements[ i ], deferDataKey, jQuery._Deferred(), true ) )) {
- count++;
- tmp.done( resolve );
- }
- }
- resolve();
- return defer.promise();
- }
-});
-
-
-
-
-var rclass = /[\n\t\r]/g,
- rspace = /\s+/,
- rreturn = /\r/g,
- rtype = /^(?:button|input)$/i,
- rfocusable = /^(?:button|input|object|select|textarea)$/i,
- rclickable = /^a(?:rea)?$/i,
- rboolean = /^(?:autofocus|autoplay|async|checked|controls|defer|disabled|hidden|loop|multiple|open|readonly|required|scoped|selected)$/i,
- nodeHook, boolHook;
-
-jQuery.fn.extend({
- attr: function( name, value ) {
- return jQuery.access( this, name, value, true, jQuery.attr );
- },
-
- removeAttr: function( name ) {
- return this.each(function() {
- jQuery.removeAttr( this, name );
- });
- },
-
- prop: function( name, value ) {
- return jQuery.access( this, name, value, true, jQuery.prop );
- },
-
- removeProp: function( name ) {
- name = jQuery.propFix[ name ] || name;
- return this.each(function() {
- // try/catch handles cases where IE balks (such as removing a property on window)
- try {
- this[ name ] = undefined;
- delete this[ name ];
- } catch( e ) {}
- });
- },
-
- addClass: function( value ) {
- var classNames, i, l, elem,
- setClass, c, cl;
-
- if ( jQuery.isFunction( value ) ) {
- return this.each(function( j ) {
- jQuery( this ).addClass( value.call(this, j, this.className) );
- });
- }
-
- if ( value && typeof value === "string" ) {
- classNames = value.split( rspace );
-
- for ( i = 0, l = this.length; i < l; i++ ) {
- elem = this[ i ];
-
- if ( elem.nodeType === 1 ) {
- if ( !elem.className && classNames.length === 1 ) {
- elem.className = value;
-
- } else {
- setClass = " " + elem.className + " ";
-
- for ( c = 0, cl = classNames.length; c < cl; c++ ) {
- if ( !~setClass.indexOf( " " + classNames[ c ] + " " ) ) {
- setClass += classNames[ c ] + " ";
- }
- }
- elem.className = jQuery.trim( setClass );
- }
- }
- }
- }
-
- return this;
- },
-
- removeClass: function( value ) {
- var classNames, i, l, elem, className, c, cl;
-
- if ( jQuery.isFunction( value ) ) {
- return this.each(function( j ) {
- jQuery( this ).removeClass( value.call(this, j, this.className) );
- });
- }
-
- if ( (value && typeof value === "string") || value === undefined ) {
- classNames = (value || "").split( rspace );
-
- for ( i = 0, l = this.length; i < l; i++ ) {
- elem = this[ i ];
-
- if ( elem.nodeType === 1 && elem.className ) {
- if ( value ) {
- className = (" " + elem.className + " ").replace( rclass, " " );
- for ( c = 0, cl = classNames.length; c < cl; c++ ) {
- className = className.replace(" " + classNames[ c ] + " ", " ");
- }
- elem.className = jQuery.trim( className );
-
- } else {
- elem.className = "";
- }
- }
- }
- }
-
- return this;
- },
-
- toggleClass: function( value, stateVal ) {
- var type = typeof value,
- isBool = typeof stateVal === "boolean";
-
- if ( jQuery.isFunction( value ) ) {
- return this.each(function( i ) {
- jQuery( this ).toggleClass( value.call(this, i, this.className, stateVal), stateVal );
- });
- }
-
- return this.each(function() {
- if ( type === "string" ) {
- // toggle individual class names
- var className,
- i = 0,
- self = jQuery( this ),
- state = stateVal,
- classNames = value.split( rspace );
-
- while ( (className = classNames[ i++ ]) ) {
- // check each className given, space seperated list
- state = isBool ? state : !self.hasClass( className );
- self[ state ? "addClass" : "removeClass" ]( className );
- }
-
- } else if ( type === "undefined" || type === "boolean" ) {
- if ( this.className ) {
- // store className if set
- jQuery._data( this, "__className__", this.className );
- }
-
- // toggle whole className
- this.className = this.className || value === false ? "" : jQuery._data( this, "__className__" ) || "";
- }
- });
- },
-
- hasClass: function( selector ) {
- var className = " " + selector + " ";
- for ( var i = 0, l = this.length; i < l; i++ ) {
- if ( this[i].nodeType === 1 && (" " + this[i].className + " ").replace(rclass, " ").indexOf( className ) > -1 ) {
- return true;
- }
- }
-
- return false;
- },
-
- val: function( value ) {
- var hooks, ret,
- elem = this[0];
-
- if ( !arguments.length ) {
- if ( elem ) {
- hooks = jQuery.valHooks[ elem.nodeName.toLowerCase() ] || jQuery.valHooks[ elem.type ];
-
- if ( hooks && "get" in hooks && (ret = hooks.get( elem, "value" )) !== undefined ) {
- return ret;
- }
-
- ret = elem.value;
-
- return typeof ret === "string" ?
- // handle most common string cases
- ret.replace(rreturn, "") :
- // handle cases where value is null/undef or number
- ret == null ? "" : ret;
- }
-
- return undefined;
- }
-
- var isFunction = jQuery.isFunction( value );
-
- return this.each(function( i ) {
- var self = jQuery(this), val;
-
- if ( this.nodeType !== 1 ) {
- return;
- }
-
- if ( isFunction ) {
- val = value.call( this, i, self.val() );
- } else {
- val = value;
- }
-
- // Treat null/undefined as ""; convert numbers to string
- if ( val == null ) {
- val = "";
- } else if ( typeof val === "number" ) {
- val += "";
- } else if ( jQuery.isArray( val ) ) {
- val = jQuery.map(val, function ( value ) {
- return value == null ? "" : value + "";
- });
- }
-
- hooks = jQuery.valHooks[ this.nodeName.toLowerCase() ] || jQuery.valHooks[ this.type ];
-
- // If set returns undefined, fall back to normal setting
- if ( !hooks || !("set" in hooks) || hooks.set( this, val, "value" ) === undefined ) {
- this.value = val;
- }
- });
- }
-});
-
-jQuery.extend({
- valHooks: {
- option: {
- get: function( elem ) {
- // attributes.value is undefined in Blackberry 4.7 but
- // uses .value. See #6932
- var val = elem.attributes.value;
- return !val || val.specified ? elem.value : elem.text;
- }
- },
- select: {
- get: function( elem ) {
- var value,
- index = elem.selectedIndex,
- values = [],
- options = elem.options,
- one = elem.type === "select-one";
-
- // Nothing was selected
- if ( index < 0 ) {
- return null;
- }
-
- // Loop through all the selected options
- for ( var i = one ? index : 0, max = one ? index + 1 : options.length; i < max; i++ ) {
- var option = options[ i ];
-
- // Don't return options that are disabled or in a disabled optgroup
- if ( option.selected && (jQuery.support.optDisabled ? !option.disabled : option.getAttribute("disabled") === null) &&
- (!option.parentNode.disabled || !jQuery.nodeName( option.parentNode, "optgroup" )) ) {
-
- // Get the specific value for the option
- value = jQuery( option ).val();
-
- // We don't need an array for one selects
- if ( one ) {
- return value;
- }
-
- // Multi-Selects return an array
- values.push( value );
- }
- }
-
- // Fixes Bug #2551 -- select.val() broken in IE after form.reset()
- if ( one && !values.length && options.length ) {
- return jQuery( options[ index ] ).val();
- }
-
- return values;
- },
-
- set: function( elem, value ) {
- var values = jQuery.makeArray( value );
-
- jQuery(elem).find("option").each(function() {
- this.selected = jQuery.inArray( jQuery(this).val(), values ) >= 0;
- });
-
- if ( !values.length ) {
- elem.selectedIndex = -1;
- }
- return values;
- }
- }
- },
-
- attrFn: {
- val: true,
- css: true,
- html: true,
- text: true,
- data: true,
- width: true,
- height: true,
- offset: true
- },
-
- attrFix: {
- // Always normalize to ensure hook usage
- tabindex: "tabIndex"
- },
-
- attr: function( elem, name, value, pass ) {
- var nType = elem.nodeType;
-
- // don't get/set attributes on text, comment and attribute nodes
- if ( !elem || nType === 3 || nType === 8 || nType === 2 ) {
- return undefined;
- }
-
- if ( pass && name in jQuery.attrFn ) {
- return jQuery( elem )[ name ]( value );
- }
-
- // Fallback to prop when attributes are not supported
- if ( !("getAttribute" in elem) ) {
- return jQuery.prop( elem, name, value );
- }
-
- var ret, hooks,
- notxml = nType !== 1 || !jQuery.isXMLDoc( elem );
-
- // Normalize the name if needed
- if ( notxml ) {
- name = jQuery.attrFix[ name ] || name;
-
- hooks = jQuery.attrHooks[ name ];
-
- if ( !hooks ) {
- // Use boolHook for boolean attributes
- if ( rboolean.test( name ) ) {
- hooks = boolHook;
-
- // Use nodeHook if available( IE6/7 )
- } else if ( nodeHook ) {
- hooks = nodeHook;
- }
- }
- }
-
- if ( value !== undefined ) {
-
- if ( value === null ) {
- jQuery.removeAttr( elem, name );
- return undefined;
-
- } else if ( hooks && "set" in hooks && notxml && (ret = hooks.set( elem, value, name )) !== undefined ) {
- return ret;
-
- } else {
- elem.setAttribute( name, "" + value );
- return value;
- }
-
- } else if ( hooks && "get" in hooks && notxml && (ret = hooks.get( elem, name )) !== null ) {
- return ret;
-
- } else {
-
- ret = elem.getAttribute( name );
-
- // Non-existent attributes return null, we normalize to undefined
- return ret === null ?
- undefined :
- ret;
- }
- },
-
- removeAttr: function( elem, name ) {
- var propName;
- if ( elem.nodeType === 1 ) {
- name = jQuery.attrFix[ name ] || name;
-
- jQuery.attr( elem, name, "" );
- elem.removeAttribute( name );
-
- // Set corresponding property to false for boolean attributes
- if ( rboolean.test( name ) && (propName = jQuery.propFix[ name ] || name) in elem ) {
- elem[ propName ] = false;
- }
- }
- },
-
- attrHooks: {
- type: {
- set: function( elem, value ) {
- // We can't allow the type property to be changed (since it causes problems in IE)
- if ( rtype.test( elem.nodeName ) && elem.parentNode ) {
- jQuery.error( "type property can't be changed" );
- } else if ( !jQuery.support.radioValue && value === "radio" && jQuery.nodeName(elem, "input") ) {
- // Setting the type on a radio button after the value resets the value in IE6-9
- // Reset value to it's default in case type is set after value
- // This is for element creation
- var val = elem.value;
- elem.setAttribute( "type", value );
- if ( val ) {
- elem.value = val;
- }
- return value;
- }
- }
- },
- // Use the value property for back compat
- // Use the nodeHook for button elements in IE6/7 (#1954)
- value: {
- get: function( elem, name ) {
- if ( nodeHook && jQuery.nodeName( elem, "button" ) ) {
- return nodeHook.get( elem, name );
- }
- return name in elem ?
- elem.value :
- null;
- },
- set: function( elem, value, name ) {
- if ( nodeHook && jQuery.nodeName( elem, "button" ) ) {
- return nodeHook.set( elem, value, name );
- }
- // Does not return so that setAttribute is also used
- elem.value = value;
- }
- }
- },
-
- propFix: {
- tabindex: "tabIndex",
- readonly: "readOnly",
- "for": "htmlFor",
- "class": "className",
- maxlength: "maxLength",
- cellspacing: "cellSpacing",
- cellpadding: "cellPadding",
- rowspan: "rowSpan",
- colspan: "colSpan",
- usemap: "useMap",
- frameborder: "frameBorder",
- contenteditable: "contentEditable"
- },
-
- prop: function( elem, name, value ) {
- var nType = elem.nodeType;
-
- // don't get/set properties on text, comment and attribute nodes
- if ( !elem || nType === 3 || nType === 8 || nType === 2 ) {
- return undefined;
- }
-
- var ret, hooks,
- notxml = nType !== 1 || !jQuery.isXMLDoc( elem );
-
- if ( notxml ) {
- // Fix name and attach hooks
- name = jQuery.propFix[ name ] || name;
- hooks = jQuery.propHooks[ name ];
- }
-
- if ( value !== undefined ) {
- if ( hooks && "set" in hooks && (ret = hooks.set( elem, value, name )) !== undefined ) {
- return ret;
-
- } else {
- return (elem[ name ] = value);
- }
-
- } else {
- if ( hooks && "get" in hooks && (ret = hooks.get( elem, name )) !== null ) {
- return ret;
-
- } else {
- return elem[ name ];
- }
- }
- },
-
- propHooks: {
- tabIndex: {
- get: function( elem ) {
- // elem.tabIndex doesn't always return the correct value when it hasn't been explicitly set
- // http://fluidproject.org/blog/2008/01/09/getting-setting-and-removing-tabindex-values-with-javascript/
- var attributeNode = elem.getAttributeNode("tabindex");
-
- return attributeNode && attributeNode.specified ?
- parseInt( attributeNode.value, 10 ) :
- rfocusable.test( elem.nodeName ) || rclickable.test( elem.nodeName ) && elem.href ?
- 0 :
- undefined;
- }
- }
- }
-});
-
-// Add the tabindex propHook to attrHooks for back-compat
-jQuery.attrHooks.tabIndex = jQuery.propHooks.tabIndex;
-
-// Hook for boolean attributes
-boolHook = {
- get: function( elem, name ) {
- // Align boolean attributes with corresponding properties
- // Fall back to attribute presence where some booleans are not supported
- var attrNode;
- return jQuery.prop( elem, name ) === true || ( attrNode = elem.getAttributeNode( name ) ) && attrNode.nodeValue !== false ?
- name.toLowerCase() :
- undefined;
- },
- set: function( elem, value, name ) {
- var propName;
- if ( value === false ) {
- // Remove boolean attributes when set to false
- jQuery.removeAttr( elem, name );
- } else {
- // value is true since we know at this point it's type boolean and not false
- // Set boolean attributes to the same name and set the DOM property
- propName = jQuery.propFix[ name ] || name;
- if ( propName in elem ) {
- // Only set the IDL specifically if it already exists on the element
- elem[ propName ] = true;
- }
-
- elem.setAttribute( name, name.toLowerCase() );
- }
- return name;
- }
-};
-
-// IE6/7 do not support getting/setting some attributes with get/setAttribute
-if ( !jQuery.support.getSetAttribute ) {
-
- // Use this for any attribute in IE6/7
- // This fixes almost every IE6/7 issue
- nodeHook = jQuery.valHooks.button = {
- get: function( elem, name ) {
- var ret;
- ret = elem.getAttributeNode( name );
- // Return undefined if nodeValue is empty string
- return ret && ret.nodeValue !== "" ?
- ret.nodeValue :
- undefined;
- },
- set: function( elem, value, name ) {
- // Set the existing or create a new attribute node
- var ret = elem.getAttributeNode( name );
- if ( !ret ) {
- ret = document.createAttribute( name );
- elem.setAttributeNode( ret );
- }
- return (ret.nodeValue = value + "");
- }
- };
-
- // Set width and height to auto instead of 0 on empty string( Bug #8150 )
- // This is for removals
- jQuery.each([ "width", "height" ], function( i, name ) {
- jQuery.attrHooks[ name ] = jQuery.extend( jQuery.attrHooks[ name ], {
- set: function( elem, value ) {
- if ( value === "" ) {
- elem.setAttribute( name, "auto" );
- return value;
- }
- }
- });
- });
-}
-
-
-// Some attributes require a special call on IE
-if ( !jQuery.support.hrefNormalized ) {
- jQuery.each([ "href", "src", "width", "height" ], function( i, name ) {
- jQuery.attrHooks[ name ] = jQuery.extend( jQuery.attrHooks[ name ], {
- get: function( elem ) {
- var ret = elem.getAttribute( name, 2 );
- return ret === null ? undefined : ret;
- }
- });
- });
-}
-
-if ( !jQuery.support.style ) {
- jQuery.attrHooks.style = {
- get: function( elem ) {
- // Return undefined in the case of empty string
- // Normalize to lowercase since IE uppercases css property names
- return elem.style.cssText.toLowerCase() || undefined;
- },
- set: function( elem, value ) {
- return (elem.style.cssText = "" + value);
- }
- };
-}
-
-// Safari mis-reports the default selected property of an option
-// Accessing the parent's selectedIndex property fixes it
-if ( !jQuery.support.optSelected ) {
- jQuery.propHooks.selected = jQuery.extend( jQuery.propHooks.selected, {
- get: function( elem ) {
- var parent = elem.parentNode;
-
- if ( parent ) {
- parent.selectedIndex;
-
- // Make sure that it also works with optgroups, see #5701
- if ( parent.parentNode ) {
- parent.parentNode.selectedIndex;
- }
- }
- return null;
- }
- });
-}
-
-// Radios and checkboxes getter/setter
-if ( !jQuery.support.checkOn ) {
- jQuery.each([ "radio", "checkbox" ], function() {
- jQuery.valHooks[ this ] = {
- get: function( elem ) {
- // Handle the case where in Webkit "" is returned instead of "on" if a value isn't specified
- return elem.getAttribute("value") === null ? "on" : elem.value;
- }
- };
- });
-}
-jQuery.each([ "radio", "checkbox" ], function() {
- jQuery.valHooks[ this ] = jQuery.extend( jQuery.valHooks[ this ], {
- set: function( elem, value ) {
- if ( jQuery.isArray( value ) ) {
- return (elem.checked = jQuery.inArray( jQuery(elem).val(), value ) >= 0);
- }
- }
- });
-});
-
-
-
-
-var rnamespaces = /\.(.*)$/,
- rformElems = /^(?:textarea|input|select)$/i,
- rperiod = /\./g,
- rspaces = / /g,
- rescape = /[^\w\s.|`]/g,
- fcleanup = function( nm ) {
- return nm.replace(rescape, "\\$&");
- };
-
-/*
- * A number of helper functions used for managing events.
- * Many of the ideas behind this code originated from
- * Dean Edwards' addEvent library.
- */
-jQuery.event = {
-
- // Bind an event to an element
- // Original by Dean Edwards
- add: function( elem, types, handler, data ) {
- if ( elem.nodeType === 3 || elem.nodeType === 8 ) {
- return;
- }
-
- if ( handler === false ) {
- handler = returnFalse;
- } else if ( !handler ) {
- // Fixes bug #7229. Fix recommended by jdalton
- return;
- }
-
- var handleObjIn, handleObj;
-
- if ( handler.handler ) {
- handleObjIn = handler;
- handler = handleObjIn.handler;
- }
-
- // Make sure that the function being executed has a unique ID
- if ( !handler.guid ) {
- handler.guid = jQuery.guid++;
- }
-
- // Init the element's event structure
- var elemData = jQuery._data( elem );
-
- // If no elemData is found then we must be trying to bind to one of the
- // banned noData elements
- if ( !elemData ) {
- return;
- }
-
- var events = elemData.events,
- eventHandle = elemData.handle;
-
- if ( !events ) {
- elemData.events = events = {};
- }
-
- if ( !eventHandle ) {
- elemData.handle = eventHandle = function( e ) {
- // Discard the second event of a jQuery.event.trigger() and
- // when an event is called after a page has unloaded
- return typeof jQuery !== "undefined" && (!e || jQuery.event.triggered !== e.type) ?
- jQuery.event.handle.apply( eventHandle.elem, arguments ) :
- undefined;
- };
- }
-
- // Add elem as a property of the handle function
- // This is to prevent a memory leak with non-native events in IE.
- eventHandle.elem = elem;
-
- // Handle multiple events separated by a space
- // jQuery(...).bind("mouseover mouseout", fn);
- types = types.split(" ");
-
- var type, i = 0, namespaces;
-
- while ( (type = types[ i++ ]) ) {
- handleObj = handleObjIn ?
- jQuery.extend({}, handleObjIn) :
- { handler: handler, data: data };
-
- // Namespaced event handlers
- if ( type.indexOf(".") > -1 ) {
- namespaces = type.split(".");
- type = namespaces.shift();
- handleObj.namespace = namespaces.slice(0).sort().join(".");
-
- } else {
- namespaces = [];
- handleObj.namespace = "";
- }
-
- handleObj.type = type;
- if ( !handleObj.guid ) {
- handleObj.guid = handler.guid;
- }
-
- // Get the current list of functions bound to this event
- var handlers = events[ type ],
- special = jQuery.event.special[ type ] || {};
-
- // Init the event handler queue
- if ( !handlers ) {
- handlers = events[ type ] = [];
-
- // Check for a special event handler
- // Only use addEventListener/attachEvent if the special
- // events handler returns false
- if ( !special.setup || special.setup.call( elem, data, namespaces, eventHandle ) === false ) {
- // Bind the global event handler to the element
- if ( elem.addEventListener ) {
- elem.addEventListener( type, eventHandle, false );
-
- } else if ( elem.attachEvent ) {
- elem.attachEvent( "on" + type, eventHandle );
- }
- }
- }
-
- if ( special.add ) {
- special.add.call( elem, handleObj );
-
- if ( !handleObj.handler.guid ) {
- handleObj.handler.guid = handler.guid;
- }
- }
-
- // Add the function to the element's handler list
- handlers.push( handleObj );
-
- // Keep track of which events have been used, for event optimization
- jQuery.event.global[ type ] = true;
- }
-
- // Nullify elem to prevent memory leaks in IE
- elem = null;
- },
-
- global: {},
-
- // Detach an event or set of events from an element
- remove: function( elem, types, handler, pos ) {
- // don't do events on text and comment nodes
- if ( elem.nodeType === 3 || elem.nodeType === 8 ) {
- return;
- }
-
- if ( handler === false ) {
- handler = returnFalse;
- }
-
- var ret, type, fn, j, i = 0, all, namespaces, namespace, special, eventType, handleObj, origType,
- elemData = jQuery.hasData( elem ) && jQuery._data( elem ),
- events = elemData && elemData.events;
-
- if ( !elemData || !events ) {
- return;
- }
-
- // types is actually an event object here
- if ( types && types.type ) {
- handler = types.handler;
- types = types.type;
- }
-
- // Unbind all events for the element
- if ( !types || typeof types === "string" && types.charAt(0) === "." ) {
- types = types || "";
-
- for ( type in events ) {
- jQuery.event.remove( elem, type + types );
- }
-
- return;
- }
-
- // Handle multiple events separated by a space
- // jQuery(...).unbind("mouseover mouseout", fn);
- types = types.split(" ");
-
- while ( (type = types[ i++ ]) ) {
- origType = type;
- handleObj = null;
- all = type.indexOf(".") < 0;
- namespaces = [];
-
- if ( !all ) {
- // Namespaced event handlers
- namespaces = type.split(".");
- type = namespaces.shift();
-
- namespace = new RegExp("(^|\\.)" +
- jQuery.map( namespaces.slice(0).sort(), fcleanup ).join("\\.(?:.*\\.)?") + "(\\.|$)");
- }
-
- eventType = events[ type ];
-
- if ( !eventType ) {
- continue;
- }
-
- if ( !handler ) {
- for ( j = 0; j < eventType.length; j++ ) {
- handleObj = eventType[ j ];
-
- if ( all || namespace.test( handleObj.namespace ) ) {
- jQuery.event.remove( elem, origType, handleObj.handler, j );
- eventType.splice( j--, 1 );
- }
- }
-
- continue;
- }
-
- special = jQuery.event.special[ type ] || {};
-
- for ( j = pos || 0; j < eventType.length; j++ ) {
- handleObj = eventType[ j ];
-
- if ( handler.guid === handleObj.guid ) {
- // remove the given handler for the given type
- if ( all || namespace.test( handleObj.namespace ) ) {
- if ( pos == null ) {
- eventType.splice( j--, 1 );
- }
-
- if ( special.remove ) {
- special.remove.call( elem, handleObj );
- }
- }
-
- if ( pos != null ) {
- break;
- }
- }
- }
-
- // remove generic event handler if no more handlers exist
- if ( eventType.length === 0 || pos != null && eventType.length === 1 ) {
- if ( !special.teardown || special.teardown.call( elem, namespaces ) === false ) {
- jQuery.removeEvent( elem, type, elemData.handle );
- }
-
- ret = null;
- delete events[ type ];
- }
- }
-
- // Remove the expando if it's no longer used
- if ( jQuery.isEmptyObject( events ) ) {
- var handle = elemData.handle;
- if ( handle ) {
- handle.elem = null;
- }
-
- delete elemData.events;
- delete elemData.handle;
-
- if ( jQuery.isEmptyObject( elemData ) ) {
- jQuery.removeData( elem, undefined, true );
- }
- }
- },
-
- // Events that are safe to short-circuit if no handlers are attached.
- // Native DOM events should not be added, they may have inline handlers.
- customEvent: {
- "getData": true,
- "setData": true,
- "changeData": true
- },
-
- trigger: function( event, data, elem, onlyHandlers ) {
- // Event object or event type
- var type = event.type || event,
- namespaces = [],
- exclusive;
-
- if ( type.indexOf("!") >= 0 ) {
- // Exclusive events trigger only for the exact event (no namespaces)
- type = type.slice(0, -1);
- exclusive = true;
- }
-
- if ( type.indexOf(".") >= 0 ) {
- // Namespaced trigger; create a regexp to match event type in handle()
- namespaces = type.split(".");
- type = namespaces.shift();
- namespaces.sort();
- }
-
- if ( (!elem || jQuery.event.customEvent[ type ]) && !jQuery.event.global[ type ] ) {
- // No jQuery handlers for this event type, and it can't have inline handlers
- return;
- }
-
- // Caller can pass in an Event, Object, or just an event type string
- event = typeof event === "object" ?
- // jQuery.Event object
- event[ jQuery.expando ] ? event :
- // Object literal
- new jQuery.Event( type, event ) :
- // Just the event type (string)
- new jQuery.Event( type );
-
- event.type = type;
- event.exclusive = exclusive;
- event.namespace = namespaces.join(".");
- event.namespace_re = new RegExp("(^|\\.)" + namespaces.join("\\.(?:.*\\.)?") + "(\\.|$)");
-
- // triggerHandler() and global events don't bubble or run the default action
- if ( onlyHandlers || !elem ) {
- event.preventDefault();
- event.stopPropagation();
- }
-
- // Handle a global trigger
- if ( !elem ) {
- // TODO: Stop taunting the data cache; remove global events and always attach to document
- jQuery.each( jQuery.cache, function() {
- // internalKey variable is just used to make it easier to find
- // and potentially change this stuff later; currently it just
- // points to jQuery.expando
- var internalKey = jQuery.expando,
- internalCache = this[ internalKey ];
- if ( internalCache && internalCache.events && internalCache.events[ type ] ) {
- jQuery.event.trigger( event, data, internalCache.handle.elem );
- }
- });
- return;
- }
-
- // Don't do events on text and comment nodes
- if ( elem.nodeType === 3 || elem.nodeType === 8 ) {
- return;
- }
-
- // Clean up the event in case it is being reused
- event.result = undefined;
- event.target = elem;
-
- // Clone any incoming data and prepend the event, creating the handler arg list
- data = data != null ? jQuery.makeArray( data ) : [];
- data.unshift( event );
-
- var cur = elem,
- // IE doesn't like method names with a colon (#3533, #8272)
- ontype = type.indexOf(":") < 0 ? "on" + type : "";
-
- // Fire event on the current element, then bubble up the DOM tree
- do {
- var handle = jQuery._data( cur, "handle" );
-
- event.currentTarget = cur;
- if ( handle ) {
- handle.apply( cur, data );
- }
-
- // Trigger an inline bound script
- if ( ontype && jQuery.acceptData( cur ) && cur[ ontype ] && cur[ ontype ].apply( cur, data ) === false ) {
- event.result = false;
- event.preventDefault();
- }
-
- // Bubble up to document, then to window
- cur = cur.parentNode || cur.ownerDocument || cur === event.target.ownerDocument && window;
- } while ( cur && !event.isPropagationStopped() );
-
- // If nobody prevented the default action, do it now
- if ( !event.isDefaultPrevented() ) {
- var old,
- special = jQuery.event.special[ type ] || {};
-
- if ( (!special._default || special._default.call( elem.ownerDocument, event ) === false) &&
- !(type === "click" && jQuery.nodeName( elem, "a" )) && jQuery.acceptData( elem ) ) {
-
- // Call a native DOM method on the target with the same name name as the event.
- // Can't use an .isFunction)() check here because IE6/7 fails that test.
- // IE<9 dies on focus to hidden element (#1486), may want to revisit a try/catch.
- try {
- if ( ontype && elem[ type ] ) {
- // Don't re-trigger an onFOO event when we call its FOO() method
- old = elem[ ontype ];
-
- if ( old ) {
- elem[ ontype ] = null;
- }
-
- jQuery.event.triggered = type;
- elem[ type ]();
- }
- } catch ( ieError ) {}
-
- if ( old ) {
- elem[ ontype ] = old;
- }
-
- jQuery.event.triggered = undefined;
- }
- }
-
- return event.result;
- },
-
- handle: function( event ) {
- event = jQuery.event.fix( event || window.event );
- // Snapshot the handlers list since a called handler may add/remove events.
- var handlers = ((jQuery._data( this, "events" ) || {})[ event.type ] || []).slice(0),
- run_all = !event.exclusive && !event.namespace,
- args = Array.prototype.slice.call( arguments, 0 );
-
- // Use the fix-ed Event rather than the (read-only) native event
- args[0] = event;
- event.currentTarget = this;
-
- for ( var j = 0, l = handlers.length; j < l; j++ ) {
- var handleObj = handlers[ j ];
-
- // Triggered event must 1) be non-exclusive and have no namespace, or
- // 2) have namespace(s) a subset or equal to those in the bound event.
- if ( run_all || event.namespace_re.test( handleObj.namespace ) ) {
- // Pass in a reference to the handler function itself
- // So that we can later remove it
- event.handler = handleObj.handler;
- event.data = handleObj.data;
- event.handleObj = handleObj;
-
- var ret = handleObj.handler.apply( this, args );
-
- if ( ret !== undefined ) {
- event.result = ret;
- if ( ret === false ) {
- event.preventDefault();
- event.stopPropagation();
- }
- }
-
- if ( event.isImmediatePropagationStopped() ) {
- break;
- }
- }
- }
- return event.result;
- },
-
- props: "altKey attrChange attrName bubbles button cancelable charCode clientX clientY ctrlKey currentTarget data detail eventPhase fromElement handler keyCode layerX layerY metaKey newValue offsetX offsetY pageX pageY prevValue relatedNode relatedTarget screenX screenY shiftKey srcElement target toElement view wheelDelta which".split(" "),
-
- fix: function( event ) {
- if ( event[ jQuery.expando ] ) {
- return event;
- }
-
- // store a copy of the original event object
- // and "clone" to set read-only properties
- var originalEvent = event;
- event = jQuery.Event( originalEvent );
-
- for ( var i = this.props.length, prop; i; ) {
- prop = this.props[ --i ];
- event[ prop ] = originalEvent[ prop ];
- }
-
- // Fix target property, if necessary
- if ( !event.target ) {
- // Fixes #1925 where srcElement might not be defined either
- event.target = event.srcElement || document;
- }
-
- // check if target is a textnode (safari)
- if ( event.target.nodeType === 3 ) {
- event.target = event.target.parentNode;
- }
-
- // Add relatedTarget, if necessary
- if ( !event.relatedTarget && event.fromElement ) {
- event.relatedTarget = event.fromElement === event.target ? event.toElement : event.fromElement;
- }
-
- // Calculate pageX/Y if missing and clientX/Y available
- if ( event.pageX == null && event.clientX != null ) {
- var eventDocument = event.target.ownerDocument || document,
- doc = eventDocument.documentElement,
- body = eventDocument.body;
-
- event.pageX = event.clientX + (doc && doc.scrollLeft || body && body.scrollLeft || 0) - (doc && doc.clientLeft || body && body.clientLeft || 0);
- event.pageY = event.clientY + (doc && doc.scrollTop || body && body.scrollTop || 0) - (doc && doc.clientTop || body && body.clientTop || 0);
- }
-
- // Add which for key events
- if ( event.which == null && (event.charCode != null || event.keyCode != null) ) {
- event.which = event.charCode != null ? event.charCode : event.keyCode;
- }
-
- // Add metaKey to non-Mac browsers (use ctrl for PC's and Meta for Macs)
- if ( !event.metaKey && event.ctrlKey ) {
- event.metaKey = event.ctrlKey;
- }
-
- // Add which for click: 1 === left; 2 === middle; 3 === right
- // Note: button is not normalized, so don't use it
- if ( !event.which && event.button !== undefined ) {
- event.which = (event.button & 1 ? 1 : ( event.button & 2 ? 3 : ( event.button & 4 ? 2 : 0 ) ));
- }
-
- return event;
- },
-
- // Deprecated, use jQuery.guid instead
- guid: 1E8,
-
- // Deprecated, use jQuery.proxy instead
- proxy: jQuery.proxy,
-
- special: {
- ready: {
- // Make sure the ready event is setup
- setup: jQuery.bindReady,
- teardown: jQuery.noop
- },
-
- live: {
- add: function( handleObj ) {
- jQuery.event.add( this,
- liveConvert( handleObj.origType, handleObj.selector ),
- jQuery.extend({}, handleObj, {handler: liveHandler, guid: handleObj.handler.guid}) );
- },
-
- remove: function( handleObj ) {
- jQuery.event.remove( this, liveConvert( handleObj.origType, handleObj.selector ), handleObj );
- }
- },
-
- beforeunload: {
- setup: function( data, namespaces, eventHandle ) {
- // We only want to do this special case on windows
- if ( jQuery.isWindow( this ) ) {
- this.onbeforeunload = eventHandle;
- }
- },
-
- teardown: function( namespaces, eventHandle ) {
- if ( this.onbeforeunload === eventHandle ) {
- this.onbeforeunload = null;
- }
- }
- }
- }
-};
-
-jQuery.removeEvent = document.removeEventListener ?
- function( elem, type, handle ) {
- if ( elem.removeEventListener ) {
- elem.removeEventListener( type, handle, false );
- }
- } :
- function( elem, type, handle ) {
- if ( elem.detachEvent ) {
- elem.detachEvent( "on" + type, handle );
- }
- };
-
-jQuery.Event = function( src, props ) {
- // Allow instantiation without the 'new' keyword
- if ( !this.preventDefault ) {
- return new jQuery.Event( src, props );
- }
-
- // Event object
- if ( src && src.type ) {
- this.originalEvent = src;
- this.type = src.type;
-
- // Events bubbling up the document may have been marked as prevented
- // by a handler lower down the tree; reflect the correct value.
- this.isDefaultPrevented = (src.defaultPrevented || src.returnValue === false ||
- src.getPreventDefault && src.getPreventDefault()) ? returnTrue : returnFalse;
-
- // Event type
- } else {
- this.type = src;
- }
-
- // Put explicitly provided properties onto the event object
- if ( props ) {
- jQuery.extend( this, props );
- }
-
- // timeStamp is buggy for some events on Firefox(#3843)
- // So we won't rely on the native value
- this.timeStamp = jQuery.now();
-
- // Mark it as fixed
- this[ jQuery.expando ] = true;
-};
-
-function returnFalse() {
- return false;
-}
-function returnTrue() {
- return true;
-}
-
-// jQuery.Event is based on DOM3 Events as specified by the ECMAScript Language Binding
-// http://www.w3.org/TR/2003/WD-DOM-Level-3-Events-20030331/ecma-script-binding.html
-jQuery.Event.prototype = {
- preventDefault: function() {
- this.isDefaultPrevented = returnTrue;
-
- var e = this.originalEvent;
- if ( !e ) {
- return;
- }
-
- // if preventDefault exists run it on the original event
- if ( e.preventDefault ) {
- e.preventDefault();
-
- // otherwise set the returnValue property of the original event to false (IE)
- } else {
- e.returnValue = false;
- }
- },
- stopPropagation: function() {
- this.isPropagationStopped = returnTrue;
-
- var e = this.originalEvent;
- if ( !e ) {
- return;
- }
- // if stopPropagation exists run it on the original event
- if ( e.stopPropagation ) {
- e.stopPropagation();
- }
- // otherwise set the cancelBubble property of the original event to true (IE)
- e.cancelBubble = true;
- },
- stopImmediatePropagation: function() {
- this.isImmediatePropagationStopped = returnTrue;
- this.stopPropagation();
- },
- isDefaultPrevented: returnFalse,
- isPropagationStopped: returnFalse,
- isImmediatePropagationStopped: returnFalse
-};
-
-// Checks if an event happened on an element within another element
-// Used in jQuery.event.special.mouseenter and mouseleave handlers
-var withinElement = function( event ) {
-
- // Check if mouse(over|out) are still within the same parent element
- var related = event.relatedTarget,
- inside = false,
- eventType = event.type;
-
- event.type = event.data;
-
- if ( related !== this ) {
-
- if ( related ) {
- inside = jQuery.contains( this, related );
- }
-
- if ( !inside ) {
-
- jQuery.event.handle.apply( this, arguments );
-
- event.type = eventType;
- }
- }
-},
-
-// In case of event delegation, we only need to rename the event.type,
-// liveHandler will take care of the rest.
-delegate = function( event ) {
- event.type = event.data;
- jQuery.event.handle.apply( this, arguments );
-};
-
-// Create mouseenter and mouseleave events
-jQuery.each({
- mouseenter: "mouseover",
- mouseleave: "mouseout"
-}, function( orig, fix ) {
- jQuery.event.special[ orig ] = {
- setup: function( data ) {
- jQuery.event.add( this, fix, data && data.selector ? delegate : withinElement, orig );
- },
- teardown: function( data ) {
- jQuery.event.remove( this, fix, data && data.selector ? delegate : withinElement );
- }
- };
-});
-
-// submit delegation
-if ( !jQuery.support.submitBubbles ) {
-
- jQuery.event.special.submit = {
- setup: function( data, namespaces ) {
- if ( !jQuery.nodeName( this, "form" ) ) {
- jQuery.event.add(this, "click.specialSubmit", function( e ) {
- // Avoid triggering error on non-existent type attribute in IE VML (#7071)
- var elem = e.target,
- type = jQuery.nodeName( elem, "input" ) || jQuery.nodeName( elem, "button" ) ? elem.type : "";
-
- if ( (type === "submit" || type === "image") && jQuery( elem ).closest("form").length ) {
- trigger( "submit", this, arguments );
- }
- });
-
- jQuery.event.add(this, "keypress.specialSubmit", function( e ) {
- var elem = e.target,
- type = jQuery.nodeName( elem, "input" ) || jQuery.nodeName( elem, "button" ) ? elem.type : "";
-
- if ( (type === "text" || type === "password") && jQuery( elem ).closest("form").length && e.keyCode === 13 ) {
- trigger( "submit", this, arguments );
- }
- });
-
- } else {
- return false;
- }
- },
-
- teardown: function( namespaces ) {
- jQuery.event.remove( this, ".specialSubmit" );
- }
- };
-
-}
-
-// change delegation, happens here so we have bind.
-if ( !jQuery.support.changeBubbles ) {
-
- var changeFilters,
-
- getVal = function( elem ) {
- var type = jQuery.nodeName( elem, "input" ) ? elem.type : "",
- val = elem.value;
-
- if ( type === "radio" || type === "checkbox" ) {
- val = elem.checked;
-
- } else if ( type === "select-multiple" ) {
- val = elem.selectedIndex > -1 ?
- jQuery.map( elem.options, function( elem ) {
- return elem.selected;
- }).join("-") :
- "";
-
- } else if ( jQuery.nodeName( elem, "select" ) ) {
- val = elem.selectedIndex;
- }
-
- return val;
- },
-
- testChange = function testChange( e ) {
- var elem = e.target, data, val;
-
- if ( !rformElems.test( elem.nodeName ) || elem.readOnly ) {
- return;
- }
-
- data = jQuery._data( elem, "_change_data" );
- val = getVal(elem);
-
- // the current data will be also retrieved by beforeactivate
- if ( e.type !== "focusout" || elem.type !== "radio" ) {
- jQuery._data( elem, "_change_data", val );
- }
-
- if ( data === undefined || val === data ) {
- return;
- }
-
- if ( data != null || val ) {
- e.type = "change";
- e.liveFired = undefined;
- jQuery.event.trigger( e, arguments[1], elem );
- }
- };
-
- jQuery.event.special.change = {
- filters: {
- focusout: testChange,
-
- beforedeactivate: testChange,
-
- click: function( e ) {
- var elem = e.target, type = jQuery.nodeName( elem, "input" ) ? elem.type : "";
-
- if ( type === "radio" || type === "checkbox" || jQuery.nodeName( elem, "select" ) ) {
- testChange.call( this, e );
- }
- },
-
- // Change has to be called before submit
- // Keydown will be called before keypress, which is used in submit-event delegation
- keydown: function( e ) {
- var elem = e.target, type = jQuery.nodeName( elem, "input" ) ? elem.type : "";
-
- if ( (e.keyCode === 13 && !jQuery.nodeName( elem, "textarea" ) ) ||
- (e.keyCode === 32 && (type === "checkbox" || type === "radio")) ||
- type === "select-multiple" ) {
- testChange.call( this, e );
- }
- },
-
- // Beforeactivate happens also before the previous element is blurred
- // with this event you can't trigger a change event, but you can store
- // information
- beforeactivate: function( e ) {
- var elem = e.target;
- jQuery._data( elem, "_change_data", getVal(elem) );
- }
- },
-
- setup: function( data, namespaces ) {
- if ( this.type === "file" ) {
- return false;
- }
-
- for ( var type in changeFilters ) {
- jQuery.event.add( this, type + ".specialChange", changeFilters[type] );
- }
-
- return rformElems.test( this.nodeName );
- },
-
- teardown: function( namespaces ) {
- jQuery.event.remove( this, ".specialChange" );
-
- return rformElems.test( this.nodeName );
- }
- };
-
- changeFilters = jQuery.event.special.change.filters;
-
- // Handle when the input is .focus()'d
- changeFilters.focus = changeFilters.beforeactivate;
-}
-
-function trigger( type, elem, args ) {
- // Piggyback on a donor event to simulate a different one.
- // Fake originalEvent to avoid donor's stopPropagation, but if the
- // simulated event prevents default then we do the same on the donor.
- // Don't pass args or remember liveFired; they apply to the donor event.
- var event = jQuery.extend( {}, args[ 0 ] );
- event.type = type;
- event.originalEvent = {};
- event.liveFired = undefined;
- jQuery.event.handle.call( elem, event );
- if ( event.isDefaultPrevented() ) {
- args[ 0 ].preventDefault();
- }
-}
-
-// Create "bubbling" focus and blur events
-if ( !jQuery.support.focusinBubbles ) {
- jQuery.each({ focus: "focusin", blur: "focusout" }, function( orig, fix ) {
-
- // Attach a single capturing handler while someone wants focusin/focusout
- var attaches = 0;
-
- jQuery.event.special[ fix ] = {
- setup: function() {
- if ( attaches++ === 0 ) {
- document.addEventListener( orig, handler, true );
- }
- },
- teardown: function() {
- if ( --attaches === 0 ) {
- document.removeEventListener( orig, handler, true );
- }
- }
- };
-
- function handler( donor ) {
- // Donor event is always a native one; fix it and switch its type.
- // Let focusin/out handler cancel the donor focus/blur event.
- var e = jQuery.event.fix( donor );
- e.type = fix;
- e.originalEvent = {};
- jQuery.event.trigger( e, null, e.target );
- if ( e.isDefaultPrevented() ) {
- donor.preventDefault();
- }
- }
- });
-}
-
-jQuery.each(["bind", "one"], function( i, name ) {
- jQuery.fn[ name ] = function( type, data, fn ) {
- var handler;
-
- // Handle object literals
- if ( typeof type === "object" ) {
- for ( var key in type ) {
- this[ name ](key, data, type[key], fn);
- }
- return this;
- }
-
- if ( arguments.length === 2 || data === false ) {
- fn = data;
- data = undefined;
- }
-
- if ( name === "one" ) {
- handler = function( event ) {
- jQuery( this ).unbind( event, handler );
- return fn.apply( this, arguments );
- };
- handler.guid = fn.guid || jQuery.guid++;
- } else {
- handler = fn;
- }
-
- if ( type === "unload" && name !== "one" ) {
- this.one( type, data, fn );
-
- } else {
- for ( var i = 0, l = this.length; i < l; i++ ) {
- jQuery.event.add( this[i], type, handler, data );
- }
- }
-
- return this;
- };
-});
-
-jQuery.fn.extend({
- unbind: function( type, fn ) {
- // Handle object literals
- if ( typeof type === "object" && !type.preventDefault ) {
- for ( var key in type ) {
- this.unbind(key, type[key]);
- }
-
- } else {
- for ( var i = 0, l = this.length; i < l; i++ ) {
- jQuery.event.remove( this[i], type, fn );
- }
- }
-
- return this;
- },
-
- delegate: function( selector, types, data, fn ) {
- return this.live( types, data, fn, selector );
- },
-
- undelegate: function( selector, types, fn ) {
- if ( arguments.length === 0 ) {
- return this.unbind( "live" );
-
- } else {
- return this.die( types, null, fn, selector );
- }
- },
-
- trigger: function( type, data ) {
- return this.each(function() {
- jQuery.event.trigger( type, data, this );
- });
- },
-
- triggerHandler: function( type, data ) {
- if ( this[0] ) {
- return jQuery.event.trigger( type, data, this[0], true );
- }
- },
-
- toggle: function( fn ) {
- // Save reference to arguments for access in closure
- var args = arguments,
- guid = fn.guid || jQuery.guid++,
- i = 0,
- toggler = function( event ) {
- // Figure out which function to execute
- var lastToggle = ( jQuery.data( this, "lastToggle" + fn.guid ) || 0 ) % i;
- jQuery.data( this, "lastToggle" + fn.guid, lastToggle + 1 );
-
- // Make sure that clicks stop
- event.preventDefault();
-
- // and execute the function
- return args[ lastToggle ].apply( this, arguments ) || false;
- };
-
- // link all the functions, so any of them can unbind this click handler
- toggler.guid = guid;
- while ( i < args.length ) {
- args[ i++ ].guid = guid;
- }
-
- return this.click( toggler );
- },
-
- hover: function( fnOver, fnOut ) {
- return this.mouseenter( fnOver ).mouseleave( fnOut || fnOver );
- }
-});
-
-var liveMap = {
- focus: "focusin",
- blur: "focusout",
- mouseenter: "mouseover",
- mouseleave: "mouseout"
-};
-
-jQuery.each(["live", "die"], function( i, name ) {
- jQuery.fn[ name ] = function( types, data, fn, origSelector /* Internal Use Only */ ) {
- var type, i = 0, match, namespaces, preType,
- selector = origSelector || this.selector,
- context = origSelector ? this : jQuery( this.context );
-
- if ( typeof types === "object" && !types.preventDefault ) {
- for ( var key in types ) {
- context[ name ]( key, data, types[key], selector );
- }
-
- return this;
- }
-
- if ( name === "die" && !types &&
- origSelector && origSelector.charAt(0) === "." ) {
-
- context.unbind( origSelector );
-
- return this;
- }
-
- if ( data === false || jQuery.isFunction( data ) ) {
- fn = data || returnFalse;
- data = undefined;
- }
-
- types = (types || "").split(" ");
-
- while ( (type = types[ i++ ]) != null ) {
- match = rnamespaces.exec( type );
- namespaces = "";
-
- if ( match ) {
- namespaces = match[0];
- type = type.replace( rnamespaces, "" );
- }
-
- if ( type === "hover" ) {
- types.push( "mouseenter" + namespaces, "mouseleave" + namespaces );
- continue;
- }
-
- preType = type;
-
- if ( liveMap[ type ] ) {
- types.push( liveMap[ type ] + namespaces );
- type = type + namespaces;
-
- } else {
- type = (liveMap[ type ] || type) + namespaces;
- }
-
- if ( name === "live" ) {
- // bind live handler
- for ( var j = 0, l = context.length; j < l; j++ ) {
- jQuery.event.add( context[j], "live." + liveConvert( type, selector ),
- { data: data, selector: selector, handler: fn, origType: type, origHandler: fn, preType: preType } );
- }
-
- } else {
- // unbind live handler
- context.unbind( "live." + liveConvert( type, selector ), fn );
- }
- }
-
- return this;
- };
-});
-
-function liveHandler( event ) {
- var stop, maxLevel, related, match, handleObj, elem, j, i, l, data, close, namespace, ret,
- elems = [],
- selectors = [],
- events = jQuery._data( this, "events" );
-
- // Make sure we avoid non-left-click bubbling in Firefox (#3861) and disabled elements in IE (#6911)
- if ( event.liveFired === this || !events || !events.live || event.target.disabled || event.button && event.type === "click" ) {
- return;
- }
-
- if ( event.namespace ) {
- namespace = new RegExp("(^|\\.)" + event.namespace.split(".").join("\\.(?:.*\\.)?") + "(\\.|$)");
- }
-
- event.liveFired = this;
-
- var live = events.live.slice(0);
-
- for ( j = 0; j < live.length; j++ ) {
- handleObj = live[j];
-
- if ( handleObj.origType.replace( rnamespaces, "" ) === event.type ) {
- selectors.push( handleObj.selector );
-
- } else {
- live.splice( j--, 1 );
- }
- }
-
- match = jQuery( event.target ).closest( selectors, event.currentTarget );
-
- for ( i = 0, l = match.length; i < l; i++ ) {
- close = match[i];
-
- for ( j = 0; j < live.length; j++ ) {
- handleObj = live[j];
-
- if ( close.selector === handleObj.selector && (!namespace || namespace.test( handleObj.namespace )) && !close.elem.disabled ) {
- elem = close.elem;
- related = null;
-
- // Those two events require additional checking
- if ( handleObj.preType === "mouseenter" || handleObj.preType === "mouseleave" ) {
- event.type = handleObj.preType;
- related = jQuery( event.relatedTarget ).closest( handleObj.selector )[0];
-
- // Make sure not to accidentally match a child element with the same selector
- if ( related && jQuery.contains( elem, related ) ) {
- related = elem;
- }
- }
-
- if ( !related || related !== elem ) {
- elems.push({ elem: elem, handleObj: handleObj, level: close.level });
- }
- }
- }
- }
-
- for ( i = 0, l = elems.length; i < l; i++ ) {
- match = elems[i];
-
- if ( maxLevel && match.level > maxLevel ) {
- break;
- }
-
- event.currentTarget = match.elem;
- event.data = match.handleObj.data;
- event.handleObj = match.handleObj;
-
- ret = match.handleObj.origHandler.apply( match.elem, arguments );
-
- if ( ret === false || event.isPropagationStopped() ) {
- maxLevel = match.level;
-
- if ( ret === false ) {
- stop = false;
- }
- if ( event.isImmediatePropagationStopped() ) {
- break;
- }
- }
- }
-
- return stop;
-}
-
-function liveConvert( type, selector ) {
- return (type && type !== "*" ? type + "." : "") + selector.replace(rperiod, "`").replace(rspaces, "&");
-}
-
-jQuery.each( ("blur focus focusin focusout load resize scroll unload click dblclick " +
- "mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave " +
- "change select submit keydown keypress keyup error").split(" "), function( i, name ) {
-
- // Handle event binding
- jQuery.fn[ name ] = function( data, fn ) {
- if ( fn == null ) {
- fn = data;
- data = null;
- }
-
- return arguments.length > 0 ?
- this.bind( name, data, fn ) :
- this.trigger( name );
- };
-
- if ( jQuery.attrFn ) {
- jQuery.attrFn[ name ] = true;
- }
-});
-
-
-
-/*!
- * Sizzle CSS Selector Engine
- * Copyright 2011, The Dojo Foundation
- * Released under the MIT, BSD, and GPL Licenses.
- * More information: http://sizzlejs.com/
- */
-(function(){
-
-var chunker = /((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^\[\]]*\]|['"][^'"]*['"]|[^\[\]'"]+)+\]|\\.|[^ >+~,(\[\\]+)+|[>+~])(\s*,\s*)?((?:.|\r|\n)*)/g,
- done = 0,
- toString = Object.prototype.toString,
- hasDuplicate = false,
- baseHasDuplicate = true,
- rBackslash = /\\/g,
- rNonWord = /\W/;
-
-// Here we check if the JavaScript engine is using some sort of
-// optimization where it does not always call our comparision
-// function. If that is the case, discard the hasDuplicate value.
-// Thus far that includes Google Chrome.
-[0, 0].sort(function() {
- baseHasDuplicate = false;
- return 0;
-});
-
-var Sizzle = function( selector, context, results, seed ) {
- results = results || [];
- context = context || document;
-
- var origContext = context;
-
- if ( context.nodeType !== 1 && context.nodeType !== 9 ) {
- return [];
- }
-
- if ( !selector || typeof selector !== "string" ) {
- return results;
- }
-
- var m, set, checkSet, extra, ret, cur, pop, i,
- prune = true,
- contextXML = Sizzle.isXML( context ),
- parts = [],
- soFar = selector;
-
- // Reset the position of the chunker regexp (start from head)
- do {
- chunker.exec( "" );
- m = chunker.exec( soFar );
-
- if ( m ) {
- soFar = m[3];
-
- parts.push( m[1] );
-
- if ( m[2] ) {
- extra = m[3];
- break;
- }
- }
- } while ( m );
-
- if ( parts.length > 1 && origPOS.exec( selector ) ) {
-
- if ( parts.length === 2 && Expr.relative[ parts[0] ] ) {
- set = posProcess( parts[0] + parts[1], context );
-
- } else {
- set = Expr.relative[ parts[0] ] ?
- [ context ] :
- Sizzle( parts.shift(), context );
-
- while ( parts.length ) {
- selector = parts.shift();
-
- if ( Expr.relative[ selector ] ) {
- selector += parts.shift();
- }
-
- set = posProcess( selector, set );
- }
- }
-
- } else {
- // Take a shortcut and set the context if the root selector is an ID
- // (but not if it'll be faster if the inner selector is an ID)
- if ( !seed && parts.length > 1 && context.nodeType === 9 && !contextXML &&
- Expr.match.ID.test(parts[0]) && !Expr.match.ID.test(parts[parts.length - 1]) ) {
-
- ret = Sizzle.find( parts.shift(), context, contextXML );
- context = ret.expr ?
- Sizzle.filter( ret.expr, ret.set )[0] :
- ret.set[0];
- }
-
- if ( context ) {
- ret = seed ?
- { expr: parts.pop(), set: makeArray(seed) } :
- Sizzle.find( parts.pop(), parts.length === 1 && (parts[0] === "~" || parts[0] === "+") && context.parentNode ? context.parentNode : context, contextXML );
-
- set = ret.expr ?
- Sizzle.filter( ret.expr, ret.set ) :
- ret.set;
-
- if ( parts.length > 0 ) {
- checkSet = makeArray( set );
-
- } else {
- prune = false;
- }
-
- while ( parts.length ) {
- cur = parts.pop();
- pop = cur;
-
- if ( !Expr.relative[ cur ] ) {
- cur = "";
- } else {
- pop = parts.pop();
- }
-
- if ( pop == null ) {
- pop = context;
- }
-
- Expr.relative[ cur ]( checkSet, pop, contextXML );
- }
-
- } else {
- checkSet = parts = [];
- }
- }
-
- if ( !checkSet ) {
- checkSet = set;
- }
-
- if ( !checkSet ) {
- Sizzle.error( cur || selector );
- }
-
- if ( toString.call(checkSet) === "[object Array]" ) {
- if ( !prune ) {
- results.push.apply( results, checkSet );
-
- } else if ( context && context.nodeType === 1 ) {
- for ( i = 0; checkSet[i] != null; i++ ) {
- if ( checkSet[i] && (checkSet[i] === true || checkSet[i].nodeType === 1 && Sizzle.contains(context, checkSet[i])) ) {
- results.push( set[i] );
- }
- }
-
- } else {
- for ( i = 0; checkSet[i] != null; i++ ) {
- if ( checkSet[i] && checkSet[i].nodeType === 1 ) {
- results.push( set[i] );
- }
- }
- }
-
- } else {
- makeArray( checkSet, results );
- }
-
- if ( extra ) {
- Sizzle( extra, origContext, results, seed );
- Sizzle.uniqueSort( results );
- }
-
- return results;
-};
-
-Sizzle.uniqueSort = function( results ) {
- if ( sortOrder ) {
- hasDuplicate = baseHasDuplicate;
- results.sort( sortOrder );
-
- if ( hasDuplicate ) {
- for ( var i = 1; i < results.length; i++ ) {
- if ( results[i] === results[ i - 1 ] ) {
- results.splice( i--, 1 );
- }
- }
- }
- }
-
- return results;
-};
-
-Sizzle.matches = function( expr, set ) {
- return Sizzle( expr, null, null, set );
-};
-
-Sizzle.matchesSelector = function( node, expr ) {
- return Sizzle( expr, null, null, [node] ).length > 0;
-};
-
-Sizzle.find = function( expr, context, isXML ) {
- var set;
-
- if ( !expr ) {
- return [];
- }
-
- for ( var i = 0, l = Expr.order.length; i < l; i++ ) {
- var match,
- type = Expr.order[i];
-
- if ( (match = Expr.leftMatch[ type ].exec( expr )) ) {
- var left = match[1];
- match.splice( 1, 1 );
-
- if ( left.substr( left.length - 1 ) !== "\\" ) {
- match[1] = (match[1] || "").replace( rBackslash, "" );
- set = Expr.find[ type ]( match, context, isXML );
-
- if ( set != null ) {
- expr = expr.replace( Expr.match[ type ], "" );
- break;
- }
- }
- }
- }
-
- if ( !set ) {
- set = typeof context.getElementsByTagName !== "undefined" ?
- context.getElementsByTagName( "*" ) :
- [];
- }
-
- return { set: set, expr: expr };
-};
-
-Sizzle.filter = function( expr, set, inplace, not ) {
- var match, anyFound,
- old = expr,
- result = [],
- curLoop = set,
- isXMLFilter = set && set[0] && Sizzle.isXML( set[0] );
-
- while ( expr && set.length ) {
- for ( var type in Expr.filter ) {
- if ( (match = Expr.leftMatch[ type ].exec( expr )) != null && match[2] ) {
- var found, item,
- filter = Expr.filter[ type ],
- left = match[1];
-
- anyFound = false;
-
- match.splice(1,1);
-
- if ( left.substr( left.length - 1 ) === "\\" ) {
- continue;
- }
-
- if ( curLoop === result ) {
- result = [];
- }
-
- if ( Expr.preFilter[ type ] ) {
- match = Expr.preFilter[ type ]( match, curLoop, inplace, result, not, isXMLFilter );
-
- if ( !match ) {
- anyFound = found = true;
-
- } else if ( match === true ) {
- continue;
- }
- }
-
- if ( match ) {
- for ( var i = 0; (item = curLoop[i]) != null; i++ ) {
- if ( item ) {
- found = filter( item, match, i, curLoop );
- var pass = not ^ !!found;
-
- if ( inplace && found != null ) {
- if ( pass ) {
- anyFound = true;
-
- } else {
- curLoop[i] = false;
- }
-
- } else if ( pass ) {
- result.push( item );
- anyFound = true;
- }
- }
- }
- }
-
- if ( found !== undefined ) {
- if ( !inplace ) {
- curLoop = result;
- }
-
- expr = expr.replace( Expr.match[ type ], "" );
-
- if ( !anyFound ) {
- return [];
- }
-
- break;
- }
- }
- }
-
- // Improper expression
- if ( expr === old ) {
- if ( anyFound == null ) {
- Sizzle.error( expr );
-
- } else {
- break;
- }
- }
-
- old = expr;
- }
-
- return curLoop;
-};
-
-Sizzle.error = function( msg ) {
- throw "Syntax error, unrecognized expression: " + msg;
-};
-
-var Expr = Sizzle.selectors = {
- order: [ "ID", "NAME", "TAG" ],
-
- match: {
- ID: /#((?:[\w\u00c0-\uFFFF\-]|\\.)+)/,
- CLASS: /\.((?:[\w\u00c0-\uFFFF\-]|\\.)+)/,
- NAME: /\[name=['"]*((?:[\w\u00c0-\uFFFF\-]|\\.)+)['"]*\]/,
- ATTR: /\[\s*((?:[\w\u00c0-\uFFFF\-]|\\.)+)\s*(?:(\S?=)\s*(?:(['"])(.*?)\3|(#?(?:[\w\u00c0-\uFFFF\-]|\\.)*)|)|)\s*\]/,
- TAG: /^((?:[\w\u00c0-\uFFFF\*\-]|\\.)+)/,
- CHILD: /:(only|nth|last|first)-child(?:\(\s*(even|odd|(?:[+\-]?\d+|(?:[+\-]?\d*)?n\s*(?:[+\-]\s*\d+)?))\s*\))?/,
- POS: /:(nth|eq|gt|lt|first|last|even|odd)(?:\((\d*)\))?(?=[^\-]|$)/,
- PSEUDO: /:((?:[\w\u00c0-\uFFFF\-]|\\.)+)(?:\((['"]?)((?:\([^\)]+\)|[^\(\)]*)+)\2\))?/
- },
-
- leftMatch: {},
-
- attrMap: {
- "class": "className",
- "for": "htmlFor"
- },
-
- attrHandle: {
- href: function( elem ) {
- return elem.getAttribute( "href" );
- },
- type: function( elem ) {
- return elem.getAttribute( "type" );
- }
- },
-
- relative: {
- "+": function(checkSet, part){
- var isPartStr = typeof part === "string",
- isTag = isPartStr && !rNonWord.test( part ),
- isPartStrNotTag = isPartStr && !isTag;
-
- if ( isTag ) {
- part = part.toLowerCase();
- }
-
- for ( var i = 0, l = checkSet.length, elem; i < l; i++ ) {
- if ( (elem = checkSet[i]) ) {
- while ( (elem = elem.previousSibling) && elem.nodeType !== 1 ) {}
-
- checkSet[i] = isPartStrNotTag || elem && elem.nodeName.toLowerCase() === part ?
- elem || false :
- elem === part;
- }
- }
-
- if ( isPartStrNotTag ) {
- Sizzle.filter( part, checkSet, true );
- }
- },
-
- ">": function( checkSet, part ) {
- var elem,
- isPartStr = typeof part === "string",
- i = 0,
- l = checkSet.length;
-
- if ( isPartStr && !rNonWord.test( part ) ) {
- part = part.toLowerCase();
-
- for ( ; i < l; i++ ) {
- elem = checkSet[i];
-
- if ( elem ) {
- var parent = elem.parentNode;
- checkSet[i] = parent.nodeName.toLowerCase() === part ? parent : false;
- }
- }
-
- } else {
- for ( ; i < l; i++ ) {
- elem = checkSet[i];
-
- if ( elem ) {
- checkSet[i] = isPartStr ?
- elem.parentNode :
- elem.parentNode === part;
- }
- }
-
- if ( isPartStr ) {
- Sizzle.filter( part, checkSet, true );
- }
- }
- },
-
- "": function(checkSet, part, isXML){
- var nodeCheck,
- doneName = done++,
- checkFn = dirCheck;
-
- if ( typeof part === "string" && !rNonWord.test( part ) ) {
- part = part.toLowerCase();
- nodeCheck = part;
- checkFn = dirNodeCheck;
- }
-
- checkFn( "parentNode", part, doneName, checkSet, nodeCheck, isXML );
- },
-
- "~": function( checkSet, part, isXML ) {
- var nodeCheck,
- doneName = done++,
- checkFn = dirCheck;
-
- if ( typeof part === "string" && !rNonWord.test( part ) ) {
- part = part.toLowerCase();
- nodeCheck = part;
- checkFn = dirNodeCheck;
- }
-
- checkFn( "previousSibling", part, doneName, checkSet, nodeCheck, isXML );
- }
- },
-
- find: {
- ID: function( match, context, isXML ) {
- if ( typeof context.getElementById !== "undefined" && !isXML ) {
- var m = context.getElementById(match[1]);
- // Check parentNode to catch when Blackberry 4.6 returns
- // nodes that are no longer in the document #6963
- return m && m.parentNode ? [m] : [];
- }
- },
-
- NAME: function( match, context ) {
- if ( typeof context.getElementsByName !== "undefined" ) {
- var ret = [],
- results = context.getElementsByName( match[1] );
-
- for ( var i = 0, l = results.length; i < l; i++ ) {
- if ( results[i].getAttribute("name") === match[1] ) {
- ret.push( results[i] );
- }
- }
-
- return ret.length === 0 ? null : ret;
- }
- },
-
- TAG: function( match, context ) {
- if ( typeof context.getElementsByTagName !== "undefined" ) {
- return context.getElementsByTagName( match[1] );
- }
- }
- },
- preFilter: {
- CLASS: function( match, curLoop, inplace, result, not, isXML ) {
- match = " " + match[1].replace( rBackslash, "" ) + " ";
-
- if ( isXML ) {
- return match;
- }
-
- for ( var i = 0, elem; (elem = curLoop[i]) != null; i++ ) {
- if ( elem ) {
- if ( not ^ (elem.className && (" " + elem.className + " ").replace(/[\t\n\r]/g, " ").indexOf(match) >= 0) ) {
- if ( !inplace ) {
- result.push( elem );
- }
-
- } else if ( inplace ) {
- curLoop[i] = false;
- }
- }
- }
-
- return false;
- },
-
- ID: function( match ) {
- return match[1].replace( rBackslash, "" );
- },
-
- TAG: function( match, curLoop ) {
- return match[1].replace( rBackslash, "" ).toLowerCase();
- },
-
- CHILD: function( match ) {
- if ( match[1] === "nth" ) {
- if ( !match[2] ) {
- Sizzle.error( match[0] );
- }
-
- match[2] = match[2].replace(/^\+|\s*/g, '');
-
- // parse equations like 'even', 'odd', '5', '2n', '3n+2', '4n-1', '-n+6'
- var test = /(-?)(\d*)(?:n([+\-]?\d*))?/.exec(
- match[2] === "even" && "2n" || match[2] === "odd" && "2n+1" ||
- !/\D/.test( match[2] ) && "0n+" + match[2] || match[2]);
-
- // calculate the numbers (first)n+(last) including if they are negative
- match[2] = (test[1] + (test[2] || 1)) - 0;
- match[3] = test[3] - 0;
- }
- else if ( match[2] ) {
- Sizzle.error( match[0] );
- }
-
- // TODO: Move to normal caching system
- match[0] = done++;
-
- return match;
- },
-
- ATTR: function( match, curLoop, inplace, result, not, isXML ) {
- var name = match[1] = match[1].replace( rBackslash, "" );
-
- if ( !isXML && Expr.attrMap[name] ) {
- match[1] = Expr.attrMap[name];
- }
-
- // Handle if an un-quoted value was used
- match[4] = ( match[4] || match[5] || "" ).replace( rBackslash, "" );
-
- if ( match[2] === "~=" ) {
- match[4] = " " + match[4] + " ";
- }
-
- return match;
- },
-
- PSEUDO: function( match, curLoop, inplace, result, not ) {
- if ( match[1] === "not" ) {
- // If we're dealing with a complex expression, or a simple one
- if ( ( chunker.exec(match[3]) || "" ).length > 1 || /^\w/.test(match[3]) ) {
- match[3] = Sizzle(match[3], null, null, curLoop);
-
- } else {
- var ret = Sizzle.filter(match[3], curLoop, inplace, true ^ not);
-
- if ( !inplace ) {
- result.push.apply( result, ret );
- }
-
- return false;
- }
-
- } else if ( Expr.match.POS.test( match[0] ) || Expr.match.CHILD.test( match[0] ) ) {
- return true;
- }
-
- return match;
- },
-
- POS: function( match ) {
- match.unshift( true );
-
- return match;
- }
- },
-
- filters: {
- enabled: function( elem ) {
- return elem.disabled === false && elem.type !== "hidden";
- },
-
- disabled: function( elem ) {
- return elem.disabled === true;
- },
-
- checked: function( elem ) {
- return elem.checked === true;
- },
-
- selected: function( elem ) {
- // Accessing this property makes selected-by-default
- // options in Safari work properly
- if ( elem.parentNode ) {
- elem.parentNode.selectedIndex;
- }
-
- return elem.selected === true;
- },
-
- parent: function( elem ) {
- return !!elem.firstChild;
- },
-
- empty: function( elem ) {
- return !elem.firstChild;
- },
-
- has: function( elem, i, match ) {
- return !!Sizzle( match[3], elem ).length;
- },
-
- header: function( elem ) {
- return (/h\d/i).test( elem.nodeName );
- },
-
- text: function( elem ) {
- var attr = elem.getAttribute( "type" ), type = elem.type;
- // IE6 and 7 will map elem.type to 'text' for new HTML5 types (search, etc)
- // use getAttribute instead to test this case
- return elem.nodeName.toLowerCase() === "input" && "text" === type && ( attr === type || attr === null );
- },
-
- radio: function( elem ) {
- return elem.nodeName.toLowerCase() === "input" && "radio" === elem.type;
- },
-
- checkbox: function( elem ) {
- return elem.nodeName.toLowerCase() === "input" && "checkbox" === elem.type;
- },
-
- file: function( elem ) {
- return elem.nodeName.toLowerCase() === "input" && "file" === elem.type;
- },
-
- password: function( elem ) {
- return elem.nodeName.toLowerCase() === "input" && "password" === elem.type;
- },
-
- submit: function( elem ) {
- var name = elem.nodeName.toLowerCase();
- return (name === "input" || name === "button") && "submit" === elem.type;
- },
-
- image: function( elem ) {
- return elem.nodeName.toLowerCase() === "input" && "image" === elem.type;
- },
-
- reset: function( elem ) {
- var name = elem.nodeName.toLowerCase();
- return (name === "input" || name === "button") && "reset" === elem.type;
- },
-
- button: function( elem ) {
- var name = elem.nodeName.toLowerCase();
- return name === "input" && "button" === elem.type || name === "button";
- },
-
- input: function( elem ) {
- return (/input|select|textarea|button/i).test( elem.nodeName );
- },
-
- focus: function( elem ) {
- return elem === elem.ownerDocument.activeElement;
- }
- },
- setFilters: {
- first: function( elem, i ) {
- return i === 0;
- },
-
- last: function( elem, i, match, array ) {
- return i === array.length - 1;
- },
-
- even: function( elem, i ) {
- return i % 2 === 0;
- },
-
- odd: function( elem, i ) {
- return i % 2 === 1;
- },
-
- lt: function( elem, i, match ) {
- return i < match[3] - 0;
- },
-
- gt: function( elem, i, match ) {
- return i > match[3] - 0;
- },
-
- nth: function( elem, i, match ) {
- return match[3] - 0 === i;
- },
-
- eq: function( elem, i, match ) {
- return match[3] - 0 === i;
- }
- },
- filter: {
- PSEUDO: function( elem, match, i, array ) {
- var name = match[1],
- filter = Expr.filters[ name ];
-
- if ( filter ) {
- return filter( elem, i, match, array );
-
- } else if ( name === "contains" ) {
- return (elem.textContent || elem.innerText || Sizzle.getText([ elem ]) || "").indexOf(match[3]) >= 0;
-
- } else if ( name === "not" ) {
- var not = match[3];
-
- for ( var j = 0, l = not.length; j < l; j++ ) {
- if ( not[j] === elem ) {
- return false;
- }
- }
-
- return true;
-
- } else {
- Sizzle.error( name );
- }
- },
-
- CHILD: function( elem, match ) {
- var type = match[1],
- node = elem;
-
- switch ( type ) {
- case "only":
- case "first":
- while ( (node = node.previousSibling) ) {
- if ( node.nodeType === 1 ) {
- return false;
- }
- }
-
- if ( type === "first" ) {
- return true;
- }
-
- node = elem;
-
- case "last":
- while ( (node = node.nextSibling) ) {
- if ( node.nodeType === 1 ) {
- return false;
- }
- }
-
- return true;
-
- case "nth":
- var first = match[2],
- last = match[3];
-
- if ( first === 1 && last === 0 ) {
- return true;
- }
-
- var doneName = match[0],
- parent = elem.parentNode;
-
- if ( parent && (parent.sizcache !== doneName || !elem.nodeIndex) ) {
- var count = 0;
-
- for ( node = parent.firstChild; node; node = node.nextSibling ) {
- if ( node.nodeType === 1 ) {
- node.nodeIndex = ++count;
- }
- }
-
- parent.sizcache = doneName;
- }
-
- var diff = elem.nodeIndex - last;
-
- if ( first === 0 ) {
- return diff === 0;
-
- } else {
- return ( diff % first === 0 && diff / first >= 0 );
- }
- }
- },
-
- ID: function( elem, match ) {
- return elem.nodeType === 1 && elem.getAttribute("id") === match;
- },
-
- TAG: function( elem, match ) {
- return (match === "*" && elem.nodeType === 1) || elem.nodeName.toLowerCase() === match;
- },
-
- CLASS: function( elem, match ) {
- return (" " + (elem.className || elem.getAttribute("class")) + " ")
- .indexOf( match ) > -1;
- },
-
- ATTR: function( elem, match ) {
- var name = match[1],
- result = Expr.attrHandle[ name ] ?
- Expr.attrHandle[ name ]( elem ) :
- elem[ name ] != null ?
- elem[ name ] :
- elem.getAttribute( name ),
- value = result + "",
- type = match[2],
- check = match[4];
-
- return result == null ?
- type === "!=" :
- type === "=" ?
- value === check :
- type === "*=" ?
- value.indexOf(check) >= 0 :
- type === "~=" ?
- (" " + value + " ").indexOf(check) >= 0 :
- !check ?
- value && result !== false :
- type === "!=" ?
- value !== check :
- type === "^=" ?
- value.indexOf(check) === 0 :
- type === "$=" ?
- value.substr(value.length - check.length) === check :
- type === "|=" ?
- value === check || value.substr(0, check.length + 1) === check + "-" :
- false;
- },
-
- POS: function( elem, match, i, array ) {
- var name = match[2],
- filter = Expr.setFilters[ name ];
-
- if ( filter ) {
- return filter( elem, i, match, array );
- }
- }
- }
-};
-
-var origPOS = Expr.match.POS,
- fescape = function(all, num){
- return "\\" + (num - 0 + 1);
- };
-
-for ( var type in Expr.match ) {
- Expr.match[ type ] = new RegExp( Expr.match[ type ].source + (/(?![^\[]*\])(?![^\(]*\))/.source) );
- Expr.leftMatch[ type ] = new RegExp( /(^(?:.|\r|\n)*?)/.source + Expr.match[ type ].source.replace(/\\(\d+)/g, fescape) );
-}
-
-var makeArray = function( array, results ) {
- array = Array.prototype.slice.call( array, 0 );
-
- if ( results ) {
- results.push.apply( results, array );
- return results;
- }
-
- return array;
-};
-
-// Perform a simple check to determine if the browser is capable of
-// converting a NodeList to an array using builtin methods.
-// Also verifies that the returned array holds DOM nodes
-// (which is not the case in the Blackberry browser)
-try {
- Array.prototype.slice.call( document.documentElement.childNodes, 0 )[0].nodeType;
-
-// Provide a fallback method if it does not work
-} catch( e ) {
- makeArray = function( array, results ) {
- var i = 0,
- ret = results || [];
-
- if ( toString.call(array) === "[object Array]" ) {
- Array.prototype.push.apply( ret, array );
-
- } else {
- if ( typeof array.length === "number" ) {
- for ( var l = array.length; i < l; i++ ) {
- ret.push( array[i] );
- }
-
- } else {
- for ( ; array[i]; i++ ) {
- ret.push( array[i] );
- }
- }
- }
-
- return ret;
- };
-}
-
-var sortOrder, siblingCheck;
-
-if ( document.documentElement.compareDocumentPosition ) {
- sortOrder = function( a, b ) {
- if ( a === b ) {
- hasDuplicate = true;
- return 0;
- }
-
- if ( !a.compareDocumentPosition || !b.compareDocumentPosition ) {
- return a.compareDocumentPosition ? -1 : 1;
- }
-
- return a.compareDocumentPosition(b) & 4 ? -1 : 1;
- };
-
-} else {
- sortOrder = function( a, b ) {
- // The nodes are identical, we can exit early
- if ( a === b ) {
- hasDuplicate = true;
- return 0;
-
- // Fallback to using sourceIndex (in IE) if it's available on both nodes
- } else if ( a.sourceIndex && b.sourceIndex ) {
- return a.sourceIndex - b.sourceIndex;
- }
-
- var al, bl,
- ap = [],
- bp = [],
- aup = a.parentNode,
- bup = b.parentNode,
- cur = aup;
-
- // If the nodes are siblings (or identical) we can do a quick check
- if ( aup === bup ) {
- return siblingCheck( a, b );
-
- // If no parents were found then the nodes are disconnected
- } else if ( !aup ) {
- return -1;
-
- } else if ( !bup ) {
- return 1;
- }
-
- // Otherwise they're somewhere else in the tree so we need
- // to build up a full list of the parentNodes for comparison
- while ( cur ) {
- ap.unshift( cur );
- cur = cur.parentNode;
- }
-
- cur = bup;
-
- while ( cur ) {
- bp.unshift( cur );
- cur = cur.parentNode;
- }
-
- al = ap.length;
- bl = bp.length;
-
- // Start walking down the tree looking for a discrepancy
- for ( var i = 0; i < al && i < bl; i++ ) {
- if ( ap[i] !== bp[i] ) {
- return siblingCheck( ap[i], bp[i] );
- }
- }
-
- // We ended someplace up the tree so do a sibling check
- return i === al ?
- siblingCheck( a, bp[i], -1 ) :
- siblingCheck( ap[i], b, 1 );
- };
-
- siblingCheck = function( a, b, ret ) {
- if ( a === b ) {
- return ret;
- }
-
- var cur = a.nextSibling;
-
- while ( cur ) {
- if ( cur === b ) {
- return -1;
- }
-
- cur = cur.nextSibling;
- }
-
- return 1;
- };
-}
-
-// Utility function for retreiving the text value of an array of DOM nodes
-Sizzle.getText = function( elems ) {
- var ret = "", elem;
-
- for ( var i = 0; elems[i]; i++ ) {
- elem = elems[i];
-
- // Get the text from text nodes and CDATA nodes
- if ( elem.nodeType === 3 || elem.nodeType === 4 ) {
- ret += elem.nodeValue;
-
- // Traverse everything else, except comment nodes
- } else if ( elem.nodeType !== 8 ) {
- ret += Sizzle.getText( elem.childNodes );
- }
- }
-
- return ret;
-};
-
-// Check to see if the browser returns elements by name when
-// querying by getElementById (and provide a workaround)
-(function(){
- // We're going to inject a fake input element with a specified name
- var form = document.createElement("div"),
- id = "script" + (new Date()).getTime(),
- root = document.documentElement;
-
- form.innerHTML = " ";
-
- // Inject it into the root element, check its status, and remove it quickly
- root.insertBefore( form, root.firstChild );
-
- // The workaround has to do additional checks after a getElementById
- // Which slows things down for other browsers (hence the branching)
- if ( document.getElementById( id ) ) {
- Expr.find.ID = function( match, context, isXML ) {
- if ( typeof context.getElementById !== "undefined" && !isXML ) {
- var m = context.getElementById(match[1]);
-
- return m ?
- m.id === match[1] || typeof m.getAttributeNode !== "undefined" && m.getAttributeNode("id").nodeValue === match[1] ?
- [m] :
- undefined :
- [];
- }
- };
-
- Expr.filter.ID = function( elem, match ) {
- var node = typeof elem.getAttributeNode !== "undefined" && elem.getAttributeNode("id");
-
- return elem.nodeType === 1 && node && node.nodeValue === match;
- };
- }
-
- root.removeChild( form );
-
- // release memory in IE
- root = form = null;
-})();
-
-(function(){
- // Check to see if the browser returns only elements
- // when doing getElementsByTagName("*")
-
- // Create a fake element
- var div = document.createElement("div");
- div.appendChild( document.createComment("") );
-
- // Make sure no comments are found
- if ( div.getElementsByTagName("*").length > 0 ) {
- Expr.find.TAG = function( match, context ) {
- var results = context.getElementsByTagName( match[1] );
-
- // Filter out possible comments
- if ( match[1] === "*" ) {
- var tmp = [];
-
- for ( var i = 0; results[i]; i++ ) {
- if ( results[i].nodeType === 1 ) {
- tmp.push( results[i] );
- }
- }
-
- results = tmp;
- }
-
- return results;
- };
- }
-
- // Check to see if an attribute returns normalized href attributes
- div.innerHTML = " ";
-
- if ( div.firstChild && typeof div.firstChild.getAttribute !== "undefined" &&
- div.firstChild.getAttribute("href") !== "#" ) {
-
- Expr.attrHandle.href = function( elem ) {
- return elem.getAttribute( "href", 2 );
- };
- }
-
- // release memory in IE
- div = null;
-})();
-
-if ( document.querySelectorAll ) {
- (function(){
- var oldSizzle = Sizzle,
- div = document.createElement("div"),
- id = "__sizzle__";
-
- div.innerHTML = "
";
-
- // Safari can't handle uppercase or unicode characters when
- // in quirks mode.
- if ( div.querySelectorAll && div.querySelectorAll(".TEST").length === 0 ) {
- return;
- }
-
- Sizzle = function( query, context, extra, seed ) {
- context = context || document;
-
- // Only use querySelectorAll on non-XML documents
- // (ID selectors don't work in non-HTML documents)
- if ( !seed && !Sizzle.isXML(context) ) {
- // See if we find a selector to speed up
- var match = /^(\w+$)|^\.([\w\-]+$)|^#([\w\-]+$)/.exec( query );
-
- if ( match && (context.nodeType === 1 || context.nodeType === 9) ) {
- // Speed-up: Sizzle("TAG")
- if ( match[1] ) {
- return makeArray( context.getElementsByTagName( query ), extra );
-
- // Speed-up: Sizzle(".CLASS")
- } else if ( match[2] && Expr.find.CLASS && context.getElementsByClassName ) {
- return makeArray( context.getElementsByClassName( match[2] ), extra );
- }
- }
-
- if ( context.nodeType === 9 ) {
- // Speed-up: Sizzle("body")
- // The body element only exists once, optimize finding it
- if ( query === "body" && context.body ) {
- return makeArray( [ context.body ], extra );
-
- // Speed-up: Sizzle("#ID")
- } else if ( match && match[3] ) {
- var elem = context.getElementById( match[3] );
-
- // Check parentNode to catch when Blackberry 4.6 returns
- // nodes that are no longer in the document #6963
- if ( elem && elem.parentNode ) {
- // Handle the case where IE and Opera return items
- // by name instead of ID
- if ( elem.id === match[3] ) {
- return makeArray( [ elem ], extra );
- }
-
- } else {
- return makeArray( [], extra );
- }
- }
-
- try {
- return makeArray( context.querySelectorAll(query), extra );
- } catch(qsaError) {}
-
- // qSA works strangely on Element-rooted queries
- // We can work around this by specifying an extra ID on the root
- // and working up from there (Thanks to Andrew Dupont for the technique)
- // IE 8 doesn't work on object elements
- } else if ( context.nodeType === 1 && context.nodeName.toLowerCase() !== "object" ) {
- var oldContext = context,
- old = context.getAttribute( "id" ),
- nid = old || id,
- hasParent = context.parentNode,
- relativeHierarchySelector = /^\s*[+~]/.test( query );
-
- if ( !old ) {
- context.setAttribute( "id", nid );
- } else {
- nid = nid.replace( /'/g, "\\$&" );
- }
- if ( relativeHierarchySelector && hasParent ) {
- context = context.parentNode;
- }
-
- try {
- if ( !relativeHierarchySelector || hasParent ) {
- return makeArray( context.querySelectorAll( "[id='" + nid + "'] " + query ), extra );
- }
-
- } catch(pseudoError) {
- } finally {
- if ( !old ) {
- oldContext.removeAttribute( "id" );
- }
- }
- }
- }
-
- return oldSizzle(query, context, extra, seed);
- };
-
- for ( var prop in oldSizzle ) {
- Sizzle[ prop ] = oldSizzle[ prop ];
- }
-
- // release memory in IE
- div = null;
- })();
-}
-
-(function(){
- var html = document.documentElement,
- matches = html.matchesSelector || html.mozMatchesSelector || html.webkitMatchesSelector || html.msMatchesSelector;
-
- if ( matches ) {
- // Check to see if it's possible to do matchesSelector
- // on a disconnected node (IE 9 fails this)
- var disconnectedMatch = !matches.call( document.createElement( "div" ), "div" ),
- pseudoWorks = false;
-
- try {
- // This should fail with an exception
- // Gecko does not error, returns false instead
- matches.call( document.documentElement, "[test!='']:sizzle" );
-
- } catch( pseudoError ) {
- pseudoWorks = true;
- }
-
- Sizzle.matchesSelector = function( node, expr ) {
- // Make sure that attribute selectors are quoted
- expr = expr.replace(/\=\s*([^'"\]]*)\s*\]/g, "='$1']");
-
- if ( !Sizzle.isXML( node ) ) {
- try {
- if ( pseudoWorks || !Expr.match.PSEUDO.test( expr ) && !/!=/.test( expr ) ) {
- var ret = matches.call( node, expr );
-
- // IE 9's matchesSelector returns false on disconnected nodes
- if ( ret || !disconnectedMatch ||
- // As well, disconnected nodes are said to be in a document
- // fragment in IE 9, so check for that
- node.document && node.document.nodeType !== 11 ) {
- return ret;
- }
- }
- } catch(e) {}
- }
-
- return Sizzle(expr, null, null, [node]).length > 0;
- };
- }
-})();
-
-(function(){
- var div = document.createElement("div");
-
- div.innerHTML = "
";
-
- // Opera can't find a second classname (in 9.6)
- // Also, make sure that getElementsByClassName actually exists
- if ( !div.getElementsByClassName || div.getElementsByClassName("e").length === 0 ) {
- return;
- }
-
- // Safari caches class attributes, doesn't catch changes (in 3.2)
- div.lastChild.className = "e";
-
- if ( div.getElementsByClassName("e").length === 1 ) {
- return;
- }
-
- Expr.order.splice(1, 0, "CLASS");
- Expr.find.CLASS = function( match, context, isXML ) {
- if ( typeof context.getElementsByClassName !== "undefined" && !isXML ) {
- return context.getElementsByClassName(match[1]);
- }
- };
-
- // release memory in IE
- div = null;
-})();
-
-function dirNodeCheck( dir, cur, doneName, checkSet, nodeCheck, isXML ) {
- for ( var i = 0, l = checkSet.length; i < l; i++ ) {
- var elem = checkSet[i];
-
- if ( elem ) {
- var match = false;
-
- elem = elem[dir];
-
- while ( elem ) {
- if ( elem.sizcache === doneName ) {
- match = checkSet[elem.sizset];
- break;
- }
-
- if ( elem.nodeType === 1 && !isXML ){
- elem.sizcache = doneName;
- elem.sizset = i;
- }
-
- if ( elem.nodeName.toLowerCase() === cur ) {
- match = elem;
- break;
- }
-
- elem = elem[dir];
- }
-
- checkSet[i] = match;
- }
- }
-}
-
-function dirCheck( dir, cur, doneName, checkSet, nodeCheck, isXML ) {
- for ( var i = 0, l = checkSet.length; i < l; i++ ) {
- var elem = checkSet[i];
-
- if ( elem ) {
- var match = false;
-
- elem = elem[dir];
-
- while ( elem ) {
- if ( elem.sizcache === doneName ) {
- match = checkSet[elem.sizset];
- break;
- }
-
- if ( elem.nodeType === 1 ) {
- if ( !isXML ) {
- elem.sizcache = doneName;
- elem.sizset = i;
- }
-
- if ( typeof cur !== "string" ) {
- if ( elem === cur ) {
- match = true;
- break;
- }
-
- } else if ( Sizzle.filter( cur, [elem] ).length > 0 ) {
- match = elem;
- break;
- }
- }
-
- elem = elem[dir];
- }
-
- checkSet[i] = match;
- }
- }
-}
-
-if ( document.documentElement.contains ) {
- Sizzle.contains = function( a, b ) {
- return a !== b && (a.contains ? a.contains(b) : true);
- };
-
-} else if ( document.documentElement.compareDocumentPosition ) {
- Sizzle.contains = function( a, b ) {
- return !!(a.compareDocumentPosition(b) & 16);
- };
-
-} else {
- Sizzle.contains = function() {
- return false;
- };
-}
-
-Sizzle.isXML = function( elem ) {
- // documentElement is verified for cases where it doesn't yet exist
- // (such as loading iframes in IE - #4833)
- var documentElement = (elem ? elem.ownerDocument || elem : 0).documentElement;
-
- return documentElement ? documentElement.nodeName !== "HTML" : false;
-};
-
-var posProcess = function( selector, context ) {
- var match,
- tmpSet = [],
- later = "",
- root = context.nodeType ? [context] : context;
-
- // Position selectors must be done after the filter
- // And so must :not(positional) so we move all PSEUDOs to the end
- while ( (match = Expr.match.PSEUDO.exec( selector )) ) {
- later += match[0];
- selector = selector.replace( Expr.match.PSEUDO, "" );
- }
-
- selector = Expr.relative[selector] ? selector + "*" : selector;
-
- for ( var i = 0, l = root.length; i < l; i++ ) {
- Sizzle( selector, root[i], tmpSet );
- }
-
- return Sizzle.filter( later, tmpSet );
-};
-
-// EXPOSE
-jQuery.find = Sizzle;
-jQuery.expr = Sizzle.selectors;
-jQuery.expr[":"] = jQuery.expr.filters;
-jQuery.unique = Sizzle.uniqueSort;
-jQuery.text = Sizzle.getText;
-jQuery.isXMLDoc = Sizzle.isXML;
-jQuery.contains = Sizzle.contains;
-
-
-})();
-
-
-var runtil = /Until$/,
- rparentsprev = /^(?:parents|prevUntil|prevAll)/,
- // Note: This RegExp should be improved, or likely pulled from Sizzle
- rmultiselector = /,/,
- isSimple = /^.[^:#\[\.,]*$/,
- slice = Array.prototype.slice,
- POS = jQuery.expr.match.POS,
- // methods guaranteed to produce a unique set when starting from a unique set
- guaranteedUnique = {
- children: true,
- contents: true,
- next: true,
- prev: true
- };
-
-jQuery.fn.extend({
- find: function( selector ) {
- var self = this,
- i, l;
-
- if ( typeof selector !== "string" ) {
- return jQuery( selector ).filter(function() {
- for ( i = 0, l = self.length; i < l; i++ ) {
- if ( jQuery.contains( self[ i ], this ) ) {
- return true;
- }
- }
- });
- }
-
- var ret = this.pushStack( "", "find", selector ),
- length, n, r;
-
- for ( i = 0, l = this.length; i < l; i++ ) {
- length = ret.length;
- jQuery.find( selector, this[i], ret );
-
- if ( i > 0 ) {
- // Make sure that the results are unique
- for ( n = length; n < ret.length; n++ ) {
- for ( r = 0; r < length; r++ ) {
- if ( ret[r] === ret[n] ) {
- ret.splice(n--, 1);
- break;
- }
- }
- }
- }
- }
-
- return ret;
- },
-
- has: function( target ) {
- var targets = jQuery( target );
- return this.filter(function() {
- for ( var i = 0, l = targets.length; i < l; i++ ) {
- if ( jQuery.contains( this, targets[i] ) ) {
- return true;
- }
- }
- });
- },
-
- not: function( selector ) {
- return this.pushStack( winnow(this, selector, false), "not", selector);
- },
-
- filter: function( selector ) {
- return this.pushStack( winnow(this, selector, true), "filter", selector );
- },
-
- is: function( selector ) {
- return !!selector && ( typeof selector === "string" ?
- jQuery.filter( selector, this ).length > 0 :
- this.filter( selector ).length > 0 );
- },
-
- closest: function( selectors, context ) {
- var ret = [], i, l, cur = this[0];
-
- // Array
- if ( jQuery.isArray( selectors ) ) {
- var match, selector,
- matches = {},
- level = 1;
-
- if ( cur && selectors.length ) {
- for ( i = 0, l = selectors.length; i < l; i++ ) {
- selector = selectors[i];
-
- if ( !matches[ selector ] ) {
- matches[ selector ] = POS.test( selector ) ?
- jQuery( selector, context || this.context ) :
- selector;
- }
- }
-
- while ( cur && cur.ownerDocument && cur !== context ) {
- for ( selector in matches ) {
- match = matches[ selector ];
-
- if ( match.jquery ? match.index( cur ) > -1 : jQuery( cur ).is( match ) ) {
- ret.push({ selector: selector, elem: cur, level: level });
- }
- }
-
- cur = cur.parentNode;
- level++;
- }
- }
-
- return ret;
- }
-
- // String
- var pos = POS.test( selectors ) || typeof selectors !== "string" ?
- jQuery( selectors, context || this.context ) :
- 0;
-
- for ( i = 0, l = this.length; i < l; i++ ) {
- cur = this[i];
-
- while ( cur ) {
- if ( pos ? pos.index(cur) > -1 : jQuery.find.matchesSelector(cur, selectors) ) {
- ret.push( cur );
- break;
-
- } else {
- cur = cur.parentNode;
- if ( !cur || !cur.ownerDocument || cur === context || cur.nodeType === 11 ) {
- break;
- }
- }
- }
- }
-
- ret = ret.length > 1 ? jQuery.unique( ret ) : ret;
-
- return this.pushStack( ret, "closest", selectors );
- },
-
- // Determine the position of an element within
- // the matched set of elements
- index: function( elem ) {
-
- // No argument, return index in parent
- if ( !elem ) {
- return ( this[0] && this[0].parentNode ) ? this.prevAll().length : -1;
- }
-
- // index in selector
- if ( typeof elem === "string" ) {
- return jQuery.inArray( this[0], jQuery( elem ) );
- }
-
- // Locate the position of the desired element
- return jQuery.inArray(
- // If it receives a jQuery object, the first element is used
- elem.jquery ? elem[0] : elem, this );
- },
-
- add: function( selector, context ) {
- var set = typeof selector === "string" ?
- jQuery( selector, context ) :
- jQuery.makeArray( selector && selector.nodeType ? [ selector ] : selector ),
- all = jQuery.merge( this.get(), set );
-
- return this.pushStack( isDisconnected( set[0] ) || isDisconnected( all[0] ) ?
- all :
- jQuery.unique( all ) );
- },
-
- andSelf: function() {
- return this.add( this.prevObject );
- }
-});
-
-// A painfully simple check to see if an element is disconnected
-// from a document (should be improved, where feasible).
-function isDisconnected( node ) {
- return !node || !node.parentNode || node.parentNode.nodeType === 11;
-}
-
-jQuery.each({
- parent: function( elem ) {
- var parent = elem.parentNode;
- return parent && parent.nodeType !== 11 ? parent : null;
- },
- parents: function( elem ) {
- return jQuery.dir( elem, "parentNode" );
- },
- parentsUntil: function( elem, i, until ) {
- return jQuery.dir( elem, "parentNode", until );
- },
- next: function( elem ) {
- return jQuery.nth( elem, 2, "nextSibling" );
- },
- prev: function( elem ) {
- return jQuery.nth( elem, 2, "previousSibling" );
- },
- nextAll: function( elem ) {
- return jQuery.dir( elem, "nextSibling" );
- },
- prevAll: function( elem ) {
- return jQuery.dir( elem, "previousSibling" );
- },
- nextUntil: function( elem, i, until ) {
- return jQuery.dir( elem, "nextSibling", until );
- },
- prevUntil: function( elem, i, until ) {
- return jQuery.dir( elem, "previousSibling", until );
- },
- siblings: function( elem ) {
- return jQuery.sibling( elem.parentNode.firstChild, elem );
- },
- children: function( elem ) {
- return jQuery.sibling( elem.firstChild );
- },
- contents: function( elem ) {
- return jQuery.nodeName( elem, "iframe" ) ?
- elem.contentDocument || elem.contentWindow.document :
- jQuery.makeArray( elem.childNodes );
- }
-}, function( name, fn ) {
- jQuery.fn[ name ] = function( until, selector ) {
- var ret = jQuery.map( this, fn, until ),
- // The variable 'args' was introduced in
- // https://github.com/jquery/jquery/commit/52a0238
- // to work around a bug in Chrome 10 (Dev) and should be removed when the bug is fixed.
- // http://code.google.com/p/v8/issues/detail?id=1050
- args = slice.call(arguments);
-
- if ( !runtil.test( name ) ) {
- selector = until;
- }
-
- if ( selector && typeof selector === "string" ) {
- ret = jQuery.filter( selector, ret );
- }
-
- ret = this.length > 1 && !guaranteedUnique[ name ] ? jQuery.unique( ret ) : ret;
-
- if ( (this.length > 1 || rmultiselector.test( selector )) && rparentsprev.test( name ) ) {
- ret = ret.reverse();
- }
-
- return this.pushStack( ret, name, args.join(",") );
- };
-});
-
-jQuery.extend({
- filter: function( expr, elems, not ) {
- if ( not ) {
- expr = ":not(" + expr + ")";
- }
-
- return elems.length === 1 ?
- jQuery.find.matchesSelector(elems[0], expr) ? [ elems[0] ] : [] :
- jQuery.find.matches(expr, elems);
- },
-
- dir: function( elem, dir, until ) {
- var matched = [],
- cur = elem[ dir ];
-
- while ( cur && cur.nodeType !== 9 && (until === undefined || cur.nodeType !== 1 || !jQuery( cur ).is( until )) ) {
- if ( cur.nodeType === 1 ) {
- matched.push( cur );
- }
- cur = cur[dir];
- }
- return matched;
- },
-
- nth: function( cur, result, dir, elem ) {
- result = result || 1;
- var num = 0;
-
- for ( ; cur; cur = cur[dir] ) {
- if ( cur.nodeType === 1 && ++num === result ) {
- break;
- }
- }
-
- return cur;
- },
-
- sibling: function( n, elem ) {
- var r = [];
-
- for ( ; n; n = n.nextSibling ) {
- if ( n.nodeType === 1 && n !== elem ) {
- r.push( n );
- }
- }
-
- return r;
- }
-});
-
-// Implement the identical functionality for filter and not
-function winnow( elements, qualifier, keep ) {
-
- // Can't pass null or undefined to indexOf in Firefox 4
- // Set to 0 to skip string check
- qualifier = qualifier || 0;
-
- if ( jQuery.isFunction( qualifier ) ) {
- return jQuery.grep(elements, function( elem, i ) {
- var retVal = !!qualifier.call( elem, i, elem );
- return retVal === keep;
- });
-
- } else if ( qualifier.nodeType ) {
- return jQuery.grep(elements, function( elem, i ) {
- return (elem === qualifier) === keep;
- });
-
- } else if ( typeof qualifier === "string" ) {
- var filtered = jQuery.grep(elements, function( elem ) {
- return elem.nodeType === 1;
- });
-
- if ( isSimple.test( qualifier ) ) {
- return jQuery.filter(qualifier, filtered, !keep);
- } else {
- qualifier = jQuery.filter( qualifier, filtered );
- }
- }
-
- return jQuery.grep(elements, function( elem, i ) {
- return (jQuery.inArray( elem, qualifier ) >= 0) === keep;
- });
-}
-
-
-
-
-var rinlinejQuery = / jQuery\d+="(?:\d+|null)"/g,
- rleadingWhitespace = /^\s+/,
- rxhtmlTag = /<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/ig,
- rtagName = /<([\w:]+)/,
- rtbody = /", "" ],
- legend: [ 1, "", " " ],
- thead: [ 1, "" ],
- tr: [ 2, "" ],
- td: [ 3, "" ],
- col: [ 2, "" ],
- area: [ 1, "", " " ],
- _default: [ 0, "", "" ]
- };
-
-wrapMap.optgroup = wrapMap.option;
-wrapMap.tbody = wrapMap.tfoot = wrapMap.colgroup = wrapMap.caption = wrapMap.thead;
-wrapMap.th = wrapMap.td;
-
-// IE can't serialize and
- *
- * Data must be supplied in
- * the form:
- *
- * > [[x1, y1, r1, ], ...]
- *
- * where the label or options
- * object is optional.
- *
- * Note that all bubble colors will be the same
- * unless the "varyBubbleColors" option is set to true. Colors can be specified in the data array
- * or in the seriesColors array option on the series. If no colors are defined, the default jqPlot
- * series of 16 colors are used. Colors are automatically cycled around again if there are more
- * bubbles than colors.
- *
- * Bubbles are autoscaled by default to fit within the chart area while maintaining
- * relative sizes. If the "autoscaleBubbles" option is set to false, the r(adius) values
- * in the data array a treated as literal pixel values for the radii of the bubbles.
- *
- * Properties are passed into the bubble renderer in the rendererOptions object of
- * the series options like:
- *
- * > seriesDefaults: {
- * > renderer: $.jqplot.BubbleRenderer,
- * > rendererOptions: {
- * > bubbleAlpha: 0.7,
- * > varyBubbleColors: false
- * > }
- * > }
- *
- */
- $.jqplot.BubbleRenderer = function(){
- $.jqplot.LineRenderer.call(this);
- };
-
- $.jqplot.BubbleRenderer.prototype = new $.jqplot.LineRenderer();
- $.jqplot.BubbleRenderer.prototype.constructor = $.jqplot.BubbleRenderer;
-
- // called with scope of a series
- $.jqplot.BubbleRenderer.prototype.init = function(options, plot) {
- // Group: Properties
- //
- // prop: varyBubbleColors
- // True to vary the color of each bubble in this series according to
- // the seriesColors array. False to set each bubble to the color
- // specified on this series. This has no effect if a css background color
- // option is specified in the renderer css options.
- this.varyBubbleColors = true;
- // prop: autoscaleBubbles
- // True to scale the bubble radius based on plot size.
- // False will use the radius value as provided as a raw pixel value for
- // bubble radius.
- this.autoscaleBubbles = true;
- // prop: autoscaleMultiplier
- // Multiplier the bubble size if autoscaleBubbles is true.
- this.autoscaleMultiplier = 1.0;
- // prop: autoscalePointsFactor
- // Factor which decreases bubble size based on how many bubbles on on the chart.
- // 0 means no adjustment for number of bubbles. Negative values will decrease
- // size of bubbles as more bubbles are added. Values between 0 and -0.2
- // should work well.
- this.autoscalePointsFactor = -0.07;
- // prop: escapeHtml
- // True to escape html in bubble label text.
- this.escapeHtml = true;
- // prop: highlightMouseOver
- // True to highlight bubbles when moused over.
- // This must be false to enable highlightMouseDown to highlight when clicking on a slice.
- this.highlightMouseOver = true;
- // prop: highlightMouseDown
- // True to highlight when a mouse button is pressed over a bubble.
- // This will be disabled if highlightMouseOver is true.
- this.highlightMouseDown = false;
- // prop: highlightColors
- // An array of colors to use when highlighting a slice. Calculated automatically
- // if not supplied.
- this.highlightColors = [];
- // prop: bubbleAlpha
- // Alpha transparency to apply to all bubbles in this series.
- this.bubbleAlpha = 1.0;
- // prop: highlightAlpha
- // Alpha transparency to apply when highlighting bubble.
- // Set to value of bubbleAlpha by default.
- this.highlightAlpha = null;
- // prop: bubbleGradients
- // True to color the bubbles with gradient fills instead of flat colors.
- // NOT AVAILABLE IN IE due to lack of excanvas support for radial gradient fills.
- // will be ignored in IE.
- this.bubbleGradients = false;
- // prop: showLabels
- // True to show labels on bubbles (if any), false to not show.
- this.showLabels = true;
- // array of [point index, radius] which will be sorted in descending order to plot
- // largest points below smaller points.
- this.radii = [];
- this.maxRadius = 0;
- // index of the currenty highlighted point, if any
- this._highlightedPoint = null;
- // array of jQuery labels.
- this.labels = [];
- this.bubbleCanvases = [];
- this._type = 'bubble';
-
- // if user has passed in highlightMouseDown option and not set highlightMouseOver, disable highlightMouseOver
- if (options.highlightMouseDown && options.highlightMouseOver == null) {
- options.highlightMouseOver = false;
- }
-
- $.extend(true, this, options);
-
- if (this.highlightAlpha == null) {
- this.highlightAlpha = this.bubbleAlpha;
- if (this.bubbleGradients) {
- this.highlightAlpha = 0.35;
- }
- }
-
- this.autoscaleMultiplier = this.autoscaleMultiplier * Math.pow(this.data.length, this.autoscalePointsFactor);
-
- // index of the currenty highlighted point, if any
- this._highlightedPoint = null;
-
- // adjust the series colors for options colors passed in with data or for alpha.
- // note, this can leave undefined holes in the seriesColors array.
- var comps;
- for (var i=0; i 570) ? newrgb[j] * 0.8 : newrgb[j] + 0.3 * (255 - newrgb[j]);
- newrgb[j] = parseInt(newrgb[j], 10);
- }
- this.highlightColors.push('rgba('+newrgb[0]+','+newrgb[1]+','+newrgb[2]+', '+this.highlightAlpha+')');
- }
- }
-
- this.highlightColorGenerator = new $.jqplot.ColorGenerator(this.highlightColors);
-
- var sopts = {fill:true, isarc:true, angle:this.shadowAngle, alpha:this.shadowAlpha, closePath:true};
-
- this.renderer.shadowRenderer.init(sopts);
-
- this.canvas = new $.jqplot.DivCanvas();
- this.canvas._plotDimensions = this._plotDimensions;
-
- plot.eventListenerHooks.addOnce('jqplotMouseMove', handleMove);
- plot.eventListenerHooks.addOnce('jqplotMouseDown', handleMouseDown);
- plot.eventListenerHooks.addOnce('jqplotMouseUp', handleMouseUp);
- plot.eventListenerHooks.addOnce('jqplotClick', handleClick);
- plot.eventListenerHooks.addOnce('jqplotRightClick', handleRightClick);
- plot.postDrawHooks.addOnce(postPlotDraw);
-
- };
-
-
- // converts the user data values to grid coordinates and stores them
- // in the gridData array.
- // Called with scope of a series.
- $.jqplot.BubbleRenderer.prototype.setGridData = function(plot) {
- // recalculate the grid data
- var xp = this._xaxis.series_u2p;
- var yp = this._yaxis.series_u2p;
- var data = this._plotData;
- this.gridData = [];
- var radii = [];
- this.radii = [];
- var dim = Math.min(plot._height, plot._width);
- for (var i=0; i');
- if (this.escapeHtml) {
- tel.text(t);
- }
- else {
- tel.html(t);
- }
- this.canvas._elem.append(tel);
- var h = $(tel).outerHeight();
- var w = $(tel).outerWidth();
- var top = gd[1] - 0.5*h;
- var left = gd[0] - 0.5*w;
- tel.css({top: top, left: left});
- this.labels[idx] = $(tel);
- }
- }
- };
-
-
- $.jqplot.DivCanvas = function() {
- $.jqplot.ElemContainer.call(this);
- this._ctx;
- };
-
- $.jqplot.DivCanvas.prototype = new $.jqplot.ElemContainer();
- $.jqplot.DivCanvas.prototype.constructor = $.jqplot.DivCanvas;
-
- $.jqplot.DivCanvas.prototype.createElement = function(offsets, clss, plotDimensions) {
- this._offsets = offsets;
- var klass = 'jqplot-DivCanvas';
- if (clss != undefined) {
- klass = clss;
- }
- var elem;
- // if this canvas already has a dom element, don't make a new one.
- if (this._elem) {
- elem = this._elem.get(0);
- }
- else {
- elem = document.createElement('div');
- }
- // if new plotDimensions supplied, use them.
- if (plotDimensions != undefined) {
- this._plotDimensions = plotDimensions;
- }
-
- var w = this._plotDimensions.width - this._offsets.left - this._offsets.right + 'px';
- var h = this._plotDimensions.height - this._offsets.top - this._offsets.bottom + 'px';
- this._elem = $(elem);
- this._elem.css({ position: 'absolute', width:w, height:h, left: this._offsets.left, top: this._offsets.top });
-
- this._elem.addClass(klass);
- return this._elem;
- };
-
- $.jqplot.DivCanvas.prototype.setContext = function() {
- this._ctx = {
- canvas:{
- width:0,
- height:0
- },
- clearRect:function(){return null;}
- };
- return this._ctx;
- };
-
- $.jqplot.BubbleCanvas = function() {
- $.jqplot.ElemContainer.call(this);
- this._ctx;
- };
-
- $.jqplot.BubbleCanvas.prototype = new $.jqplot.ElemContainer();
- $.jqplot.BubbleCanvas.prototype.constructor = $.jqplot.BubbleCanvas;
-
- // initialize with the x,y pont of bubble center and the bubble radius.
- $.jqplot.BubbleCanvas.prototype.createElement = function(x, y, r) {
- var klass = 'jqplot-bubble-point';
-
- var elem;
- // if this canvas already has a dom element, don't make a new one.
- if (this._elem) {
- elem = this._elem.get(0);
- }
- else {
- elem = document.createElement('canvas');
- }
-
- elem.width = (r != null) ? 2*r : elem.width;
- elem.height = (r != null) ? 2*r : elem.height;
- this._elem = $(elem);
- var l = (x != null && r != null) ? x - r : this._elem.css('left');
- var t = (y != null && r != null) ? y - r : this._elem.css('top');
- this._elem.css({ position: 'absolute', left: l, top: t });
-
- this._elem.addClass(klass);
- if ($.jqplot.use_excanvas) {
- window.G_vmlCanvasManager.init_(document);
- elem = window.G_vmlCanvasManager.initElement(elem);
- }
-
- return this._elem;
- };
-
- $.jqplot.BubbleCanvas.prototype.draw = function(r, color, gradients, angle) {
- var ctx = this._ctx;
- // r = Math.floor(r*1.04);
- // var x = Math.round(ctx.canvas.width/2);
- // var y = Math.round(ctx.canvas.height/2);
- var x = ctx.canvas.width/2;
- var y = ctx.canvas.height/2;
- ctx.save();
- if (gradients && !$.jqplot.use_excanvas) {
- r = r*1.04;
- var comps = $.jqplot.getColorComponents(color);
- var colorinner = 'rgba('+Math.round(comps[0]+0.8*(255-comps[0]))+', '+Math.round(comps[1]+0.8*(255-comps[1]))+', '+Math.round(comps[2]+0.8*(255-comps[2]))+', '+comps[3]+')';
- var colorend = 'rgba('+comps[0]+', '+comps[1]+', '+comps[2]+', 0)';
- // var rinner = Math.round(0.35 * r);
- // var xinner = Math.round(x - Math.cos(angle) * 0.33 * r);
- // var yinner = Math.round(y - Math.sin(angle) * 0.33 * r);
- var rinner = 0.35 * r;
- var xinner = x - Math.cos(angle) * 0.33 * r;
- var yinner = y - Math.sin(angle) * 0.33 * r;
- var radgrad = ctx.createRadialGradient(xinner, yinner, rinner, x, y, r);
- radgrad.addColorStop(0, colorinner);
- radgrad.addColorStop(0.93, color);
- radgrad.addColorStop(0.96, colorend);
- radgrad.addColorStop(1, colorend);
- // radgrad.addColorStop(.98, colorend);
- ctx.fillStyle = radgrad;
- ctx.fillRect(0,0, ctx.canvas.width, ctx.canvas.height);
- }
- else {
- ctx.fillStyle = color;
- ctx.strokeStyle = color;
- ctx.lineWidth = 1;
- ctx.beginPath();
- var ang = 2*Math.PI;
- ctx.arc(x, y, r, 0, ang, 0);
- ctx.closePath();
- ctx.fill();
- }
- ctx.restore();
- };
-
- $.jqplot.BubbleCanvas.prototype.setContext = function() {
- this._ctx = this._elem.get(0).getContext("2d");
- return this._ctx;
- };
-
- $.jqplot.BubbleAxisRenderer = function() {
- $.jqplot.LinearAxisRenderer.call(this);
- };
-
- $.jqplot.BubbleAxisRenderer.prototype = new $.jqplot.LinearAxisRenderer();
- $.jqplot.BubbleAxisRenderer.prototype.constructor = $.jqplot.BubbleAxisRenderer;
-
- // called with scope of axis object.
- $.jqplot.BubbleAxisRenderer.prototype.init = function(options){
- $.extend(true, this, options);
- var db = this._dataBounds;
- var minsidx = 0,
- minpidx = 0,
- maxsidx = 0,
- maxpidx = 0,
- maxr = 0,
- minr = 0,
- minMaxRadius = 0,
- maxMaxRadius = 0,
- maxMult = 0,
- minMult = 0;
- // Go through all the series attached to this axis and find
- // the min/max bounds for this axis.
- for (var i=0; i db.max || db.max == null) {
- db.max = d[j][0];
- maxsidx=i;
- maxpidx=j;
- maxr = d[j][2];
- maxMaxRadius = s.maxRadius;
- maxMult = s.autoscaleMultiplier;
- }
- }
- else {
- if (d[j][1] < db.min || db.min == null) {
- db.min = d[j][1];
- minsidx=i;
- minpidx=j;
- minr = d[j][2];
- minMaxRadius = s.maxRadius;
- minMult = s.autoscaleMultiplier;
- }
- if (d[j][1] > db.max || db.max == null) {
- db.max = d[j][1];
- maxsidx=i;
- maxpidx=j;
- maxr = d[j][2];
- maxMaxRadius = s.maxRadius;
- maxMult = s.autoscaleMultiplier;
- }
- }
- }
- }
-
- var minRatio = minr/minMaxRadius;
- var maxRatio = maxr/maxMaxRadius;
-
- // need to estimate the effect of the radius on total axis span and adjust axis accordingly.
- var span = db.max - db.min;
- // var dim = (this.name == 'xaxis' || this.name == 'x2axis') ? this._plotDimensions.width : this._plotDimensions.height;
- var dim = Math.min(this._plotDimensions.width, this._plotDimensions.height);
-
- var minfact = minRatio * minMult/3 * span;
- var maxfact = maxRatio * maxMult/3 * span;
- db.max += maxfact;
- db.min -= minfact;
- };
-
- function highlight (plot, sidx, pidx) {
- plot.plugins.bubbleRenderer.highlightLabelCanvas.empty();
- var s = plot.series[sidx];
- var canvas = plot.plugins.bubbleRenderer.highlightCanvas;
- var ctx = canvas._ctx;
- ctx.clearRect(0,0,ctx.canvas.width, ctx.canvas.height);
- s._highlightedPoint = pidx;
- plot.plugins.bubbleRenderer.highlightedSeriesIndex = sidx;
-
- var color = s.highlightColorGenerator.get(pidx);
- var x = s.gridData[pidx][0],
- y = s.gridData[pidx][1],
- r = s.gridData[pidx][2];
- ctx.save();
- ctx.fillStyle = color;
- ctx.strokeStyle = color;
- ctx.lineWidth = 1;
- ctx.beginPath();
- ctx.arc(x, y, r, 0, 2*Math.PI, 0);
- ctx.closePath();
- ctx.fill();
- ctx.restore();
- // bring label to front
- if (s.labels[pidx]) {
- plot.plugins.bubbleRenderer.highlightLabel = s.labels[pidx].clone();
- plot.plugins.bubbleRenderer.highlightLabel.appendTo(plot.plugins.bubbleRenderer.highlightLabelCanvas);
- plot.plugins.bubbleRenderer.highlightLabel.addClass('jqplot-bubble-label-highlight');
- }
- }
-
- function unhighlight (plot) {
- var canvas = plot.plugins.bubbleRenderer.highlightCanvas;
- var sidx = plot.plugins.bubbleRenderer.highlightedSeriesIndex;
- plot.plugins.bubbleRenderer.highlightLabelCanvas.empty();
- canvas._ctx.clearRect(0,0, canvas._ctx.canvas.width, canvas._ctx.canvas.height);
- for (var i=0; i');
- var top = this._gridPadding.top;
- var left = this._gridPadding.left;
- var width = this._plotDimensions.width - this._gridPadding.left - this._gridPadding.right;
- var height = this._plotDimensions.height - this._gridPadding.top - this._gridPadding.bottom;
- this.plugins.bubbleRenderer.highlightLabelCanvas.css({top:top, left:left, width:width+'px', height:height+'px'});
-
- this.eventCanvas._elem.before(this.plugins.bubbleRenderer.highlightCanvas.createElement(this._gridPadding, 'jqplot-bubbleRenderer-highlight-canvas', this._plotDimensions, this));
- this.eventCanvas._elem.before(this.plugins.bubbleRenderer.highlightLabelCanvas);
-
- var hctx = this.plugins.bubbleRenderer.highlightCanvas.setContext();
- }
-
-
- // setup default renderers for axes and legend so user doesn't have to
- // called with scope of plot
- function preInit(target, data, options) {
- options = options || {};
- options.axesDefaults = options.axesDefaults || {};
- options.seriesDefaults = options.seriesDefaults || {};
- // only set these if there is a Bubble series
- var setopts = false;
- if (options.seriesDefaults.renderer == $.jqplot.BubbleRenderer) {
- setopts = true;
- }
- else if (options.series) {
- for (var i=0; i < options.series.length; i++) {
- if (options.series[i].renderer == $.jqplot.BubbleRenderer) {
- setopts = true;
- }
- }
- }
-
- if (setopts) {
- options.axesDefaults.renderer = $.jqplot.BubbleAxisRenderer;
- options.sortData = false;
- }
- }
-
- $.jqplot.preInitHooks.push(preInit);
-
-})(jQuery);
-
-
\ No newline at end of file
diff --git a/libreplan-webapp/src/main/webapp/jqplot/plugins/jqplot.bubbleRenderer.min.js b/libreplan-webapp/src/main/webapp/jqplot/plugins/jqplot.bubbleRenderer.min.js
deleted file mode 100644
index 1678ee5f4..000000000
--- a/libreplan-webapp/src/main/webapp/jqplot/plugins/jqplot.bubbleRenderer.min.js
+++ /dev/null
@@ -1,57 +0,0 @@
-/**
- * jqPlot
- * Pure JavaScript plotting plugin using jQuery
- *
- * Version: 1.0.0b2_r1012
- *
- * Copyright (c) 2009-2011 Chris Leonello
- * jqPlot is currently available for use in all personal or commercial projects
- * under both the MIT (http://www.opensource.org/licenses/mit-license.php) and GPL
- * version 2.0 (http://www.gnu.org/licenses/gpl-2.0.html) licenses. This means that you can
- * choose the license that best suits your project and use it accordingly.
- *
- * Although not required, the author would appreciate an email letting him
- * know of any substantial use of jqPlot. You can reach the author at:
- * chris at jqplot dot com or see http://www.jqplot.com/info.php .
- *
- * If you are feeling kind and generous, consider supporting the project by
- * making a donation at: http://www.jqplot.com/donate.php .
- *
- * sprintf functions contained in jqplot.sprintf.js by Ash Searle:
- *
- * version 2007.04.27
- * author Ash Searle
- * http://hexmen.com/blog/2007/03/printf-sprintf/
- * http://hexmen.com/js/sprintf.js
- * The author (Ash Searle) has placed this code in the public domain:
- * "This code is unrestricted: you are free to use it however you like."
- *
- * included jsDate library by Chris Leonello:
- *
- * Copyright (c) 2010-2011 Chris Leonello
- *
- * jsDate is currently available for use in all personal or commercial projects
- * under both the MIT and GPL version 2.0 licenses. This means that you can
- * choose the license that best suits your project and use it accordingly.
- *
- * jsDate borrows many concepts and ideas from the Date Instance
- * Methods by Ken Snyder along with some parts of Ken's actual code.
- *
- * Ken's origianl Date Instance Methods and copyright notice:
- *
- * Ken Snyder (ken d snyder at gmail dot com)
- * 2008-09-10
- * version 2.0.2 (http://kendsnyder.com/sandbox/date/)
- * Creative Commons Attribution License 3.0 (http://creativecommons.org/licenses/by/3.0/)
- *
- * jqplotToImage function based on Larry Siden's export-jqplot-to-png.js.
- * Larry has generously given permission to adapt his code for inclusion
- * into jqPlot.
- *
- * Larry's original code can be found here:
- *
- * https://github.com/lsiden/export-jqplot-to-png
- *
- *
- */
-(function(f){var d=function(m){return Math.max.apply(Math,m)};var j=function(m){return Math.min.apply(Math,m)};f.jqplot.BubbleRenderer=function(){f.jqplot.LineRenderer.call(this)};f.jqplot.BubbleRenderer.prototype=new f.jqplot.LineRenderer();f.jqplot.BubbleRenderer.prototype.constructor=f.jqplot.BubbleRenderer;f.jqplot.BubbleRenderer.prototype.init=function(w,t){this.varyBubbleColors=true;this.autoscaleBubbles=true;this.autoscaleMultiplier=1;this.autoscalePointsFactor=-0.07;this.escapeHtml=true;this.highlightMouseOver=true;this.highlightMouseDown=false;this.highlightColors=[];this.bubbleAlpha=1;this.highlightAlpha=null;this.bubbleGradients=false;this.showLabels=true;this.radii=[];this.maxRadius=0;this._highlightedPoint=null;this.labels=[];this.bubbleCanvases=[];this._type="bubble";if(w.highlightMouseDown&&w.highlightMouseOver==null){w.highlightMouseOver=false}f.extend(true,this,w);if(this.highlightAlpha==null){this.highlightAlpha=this.bubbleAlpha;if(this.bubbleGradients){this.highlightAlpha=0.35}}this.autoscaleMultiplier=this.autoscaleMultiplier*Math.pow(this.data.length,this.autoscalePointsFactor);this._highlightedPoint=null;var n;for(var r=0;r570)?u[q]*0.8:u[q]+0.3*(255-u[q]);u[q]=parseInt(u[q],10)}this.highlightColors.push("rgba("+u[0]+","+u[1]+","+u[2]+", "+this.highlightAlpha+")")}}this.highlightColorGenerator=new f.jqplot.ColorGenerator(this.highlightColors);var m={fill:true,isarc:true,angle:this.shadowAngle,alpha:this.shadowAlpha,closePath:true};this.renderer.shadowRenderer.init(m);this.canvas=new f.jqplot.DivCanvas();this.canvas._plotDimensions=this._plotDimensions;t.eventListenerHooks.addOnce("jqplotMouseMove",a);t.eventListenerHooks.addOnce("jqplotMouseDown",b);t.eventListenerHooks.addOnce("jqplotMouseUp",k);t.eventListenerHooks.addOnce("jqplotClick",g);t.eventListenerHooks.addOnce("jqplotRightClick",l);t.postDrawHooks.addOnce(h)};f.jqplot.BubbleRenderer.prototype.setGridData=function(w){var q=this._xaxis.series_u2p;var m=this._yaxis.series_u2p;var t=this._plotData;this.gridData=[];var s=[];this.radii=[];var v=Math.min(w._height,w._width);for(var u=0;u');if(this.escapeHtml){p.text(z)}else{p.html(z)}this.canvas._elem.append(p);var H=f(p).outerHeight();var v=f(p).outerWidth();var B=J[1]-0.5*H;var o=J[0]-0.5*v;p.css({top:B,left:o});this.labels[C]=f(p)}}};f.jqplot.DivCanvas=function(){f.jqplot.ElemContainer.call(this);this._ctx};f.jqplot.DivCanvas.prototype=new f.jqplot.ElemContainer();f.jqplot.DivCanvas.prototype.constructor=f.jqplot.DivCanvas;f.jqplot.DivCanvas.prototype.createElement=function(s,p,n){this._offsets=s;var m="jqplot-DivCanvas";if(p!=undefined){m=p}var r;if(this._elem){r=this._elem.get(0)}else{r=document.createElement("div")}if(n!=undefined){this._plotDimensions=n}var o=this._plotDimensions.width-this._offsets.left-this._offsets.right+"px";var q=this._plotDimensions.height-this._offsets.top-this._offsets.bottom+"px";this._elem=f(r);this._elem.css({position:"absolute",width:o,height:q,left:this._offsets.left,top:this._offsets.top});this._elem.addClass(m);return this._elem};f.jqplot.DivCanvas.prototype.setContext=function(){this._ctx={canvas:{width:0,height:0},clearRect:function(){return null}};return this._ctx};f.jqplot.BubbleCanvas=function(){f.jqplot.ElemContainer.call(this);this._ctx};f.jqplot.BubbleCanvas.prototype=new f.jqplot.ElemContainer();f.jqplot.BubbleCanvas.prototype.constructor=f.jqplot.BubbleCanvas;f.jqplot.BubbleCanvas.prototype.createElement=function(n,u,s){var m="jqplot-bubble-point";var q;if(this._elem){q=this._elem.get(0)}else{q=document.createElement("canvas")}q.width=(s!=null)?2*s:q.width;q.height=(s!=null)?2*s:q.height;this._elem=f(q);var o=(n!=null&&s!=null)?n-s:this._elem.css("left");var p=(u!=null&&s!=null)?u-s:this._elem.css("top");this._elem.css({position:"absolute",left:o,top:p});this._elem.addClass(m);if(f.jqplot.use_excanvas){window.G_vmlCanvasManager.init_(document);q=window.G_vmlCanvasManager.initElement(q)}return this._elem};f.jqplot.BubbleCanvas.prototype.draw=function(m,s,v,p){var D=this._ctx;var B=D.canvas.width/2;var z=D.canvas.height/2;D.save();if(v&&!f.jqplot.use_excanvas){m=m*1.04;var o=f.jqplot.getColorComponents(s);var u="rgba("+Math.round(o[0]+0.8*(255-o[0]))+", "+Math.round(o[1]+0.8*(255-o[1]))+", "+Math.round(o[2]+0.8*(255-o[2]))+", "+o[3]+")";var t="rgba("+o[0]+", "+o[1]+", "+o[2]+", 0)";var C=0.35*m;var A=B-Math.cos(p)*0.33*m;var n=z-Math.sin(p)*0.33*m;var w=D.createRadialGradient(A,n,C,B,z,m);w.addColorStop(0,u);w.addColorStop(0.93,s);w.addColorStop(0.96,t);w.addColorStop(1,t);D.fillStyle=w;D.fillRect(0,0,D.canvas.width,D.canvas.height)}else{D.fillStyle=s;D.strokeStyle=s;D.lineWidth=1;D.beginPath();var q=2*Math.PI;D.arc(B,z,m,0,q,0);D.closePath();D.fill()}D.restore()};f.jqplot.BubbleCanvas.prototype.setContext=function(){this._ctx=this._elem.get(0).getContext("2d");return this._ctx};f.jqplot.BubbleAxisRenderer=function(){f.jqplot.LinearAxisRenderer.call(this)};f.jqplot.BubbleAxisRenderer.prototype=new f.jqplot.LinearAxisRenderer();f.jqplot.BubbleAxisRenderer.prototype.constructor=f.jqplot.BubbleAxisRenderer;f.jqplot.BubbleAxisRenderer.prototype.init=function(n){f.extend(true,this,n);var I=this._dataBounds;var H=0,v=0,m=0,y=0,q=0,r=0,D=0,t=0,F=0,z=0;for(var E=0;EI.max||I.max==null){I.max=G[B][0];m=E;y=B;q=G[B][2];t=x.maxRadius;F=x.autoscaleMultiplier}}else{if(G[B][1]I.max||I.max==null){I.max=G[B][1];m=E;y=B;q=G[B][2];t=x.maxRadius;F=x.autoscaleMultiplier}}}}var o=r/D;var w=q/t;var C=I.max-I.min;var A=Math.min(this._plotDimensions.width,this._plotDimensions.height);var p=o*z/3*C;var u=w*F/3*C;I.max+=u;I.min-=p};function e(p,v,q){p.plugins.bubbleRenderer.highlightLabelCanvas.empty();var z=p.series[v];var n=p.plugins.bubbleRenderer.highlightCanvas;var w=n._ctx;w.clearRect(0,0,w.canvas.width,w.canvas.height);z._highlightedPoint=q;p.plugins.bubbleRenderer.highlightedSeriesIndex=v;var o=z.highlightColorGenerator.get(q);var u=z.gridData[q][0],t=z.gridData[q][1],m=z.gridData[q][2];w.save();w.fillStyle=o;w.strokeStyle=o;w.lineWidth=1;w.beginPath();w.arc(u,t,m,0,2*Math.PI,0);w.closePath();w.fill();w.restore();if(z.labels[q]){p.plugins.bubbleRenderer.highlightLabel=z.labels[q].clone();p.plugins.bubbleRenderer.highlightLabel.appendTo(p.plugins.bubbleRenderer.highlightLabelCanvas);p.plugins.bubbleRenderer.highlightLabel.addClass("jqplot-bubble-label-highlight")}}function i(p){var m=p.plugins.bubbleRenderer.highlightCanvas;var o=p.plugins.bubbleRenderer.highlightedSeriesIndex;p.plugins.bubbleRenderer.highlightLabelCanvas.empty();m._ctx.clearRect(0,0,m._ctx.canvas.width,m._ctx.canvas.height);for(var n=0;n');var q=this._gridPadding.top;var p=this._gridPadding.left;var n=this._plotDimensions.width-this._gridPadding.left-this._gridPadding.right;var m=this._plotDimensions.height-this._gridPadding.top-this._gridPadding.bottom;this.plugins.bubbleRenderer.highlightLabelCanvas.css({top:q,left:p,width:n+"px",height:m+"px"});this.eventCanvas._elem.before(this.plugins.bubbleRenderer.highlightCanvas.createElement(this._gridPadding,"jqplot-bubbleRenderer-highlight-canvas",this._plotDimensions,this));this.eventCanvas._elem.before(this.plugins.bubbleRenderer.highlightLabelCanvas);var o=this.plugins.bubbleRenderer.highlightCanvas.setContext()}function c(q,p,n){n=n||{};n.axesDefaults=n.axesDefaults||{};n.seriesDefaults=n.seriesDefaults||{};var m=false;if(n.seriesDefaults.renderer==f.jqplot.BubbleRenderer){m=true}else{if(n.series){for(var o=0;o -1) {
- return n/this.pt2px;
- }
- else if (sz.indexOf('pt') > -1) {
- return n;
- }
- else if (sz.indexOf('em') > -1) {
- return n*12;
- }
- else if (sz.indexOf('%') > -1) {
- return n*12/100;
- }
- // default to pixels;
- else {
- return n/this.pt2px;
- }
- };
-
-
- $.jqplot.CanvasTextRenderer.prototype.fontWeight2Float = function(w) {
- // w = normal | bold | bolder | lighter | 100 | 200 | 300 | 400 | 500 | 600 | 700 | 800 | 900
- // return values adjusted for Hershey font.
- if (Number(w)) {
- return w/400;
- }
- else {
- switch (w) {
- case 'normal':
- return 1;
- break;
- case 'bold':
- return 1.75;
- break;
- case 'bolder':
- return 2.25;
- break;
- case 'lighter':
- return 0.75;
- break;
- default:
- return 1;
- break;
- }
- }
- };
-
- $.jqplot.CanvasTextRenderer.prototype.getText = function() {
- return this.text;
- };
-
- $.jqplot.CanvasTextRenderer.prototype.setText = function(t, ctx) {
- this.text = t;
- this.setWidth(ctx);
- return this;
- };
-
- $.jqplot.CanvasTextRenderer.prototype.getWidth = function(ctx) {
- return this.width;
- };
-
- $.jqplot.CanvasTextRenderer.prototype.setWidth = function(ctx, w) {
- if (!w) {
- this.width = this.measure(ctx, this.text);
- }
- else {
- this.width = w;
- }
- return this;
- };
-
- // return height in pixels.
- $.jqplot.CanvasTextRenderer.prototype.getHeight = function(ctx) {
- return this.height;
- };
-
- // w - height in pt
- // set heigh in px
- $.jqplot.CanvasTextRenderer.prototype.setHeight = function(w) {
- if (!w) {
- //height = this.fontSize /0.75;
- this.height = this.normalizedFontSize * this.pt2px;
- }
- else {
- this.height = w;
- }
- return this;
- };
-
- $.jqplot.CanvasTextRenderer.prototype.letter = function (ch)
- {
- return this.letters[ch];
- };
-
- $.jqplot.CanvasTextRenderer.prototype.ascent = function()
- {
- return this.normalizedFontSize;
- };
-
- $.jqplot.CanvasTextRenderer.prototype.descent = function()
- {
- return 7.0*this.normalizedFontSize/25.0;
- };
-
- $.jqplot.CanvasTextRenderer.prototype.measure = function(ctx, str)
- {
- var total = 0;
- var len = str.length;
-
- for (var i = 0; i < len; i++) {
- var c = this.letter(str.charAt(i));
- if (c) {
- total += c.width * this.normalizedFontSize / 25.0 * this.fontStretch;
- }
- }
- return total;
- };
-
- $.jqplot.CanvasTextRenderer.prototype.draw = function(ctx,str)
- {
- var x = 0;
- // leave room at bottom for descenders.
- var y = this.height*0.72;
- var total = 0;
- var len = str.length;
- var mag = this.normalizedFontSize / 25.0;
-
- ctx.save();
- var tx, ty;
-
- // 1st quadrant
- if ((-Math.PI/2 <= this.angle && this.angle <= 0) || (Math.PI*3/2 <= this.angle && this.angle <= Math.PI*2)) {
- tx = 0;
- ty = -Math.sin(this.angle) * this.width;
- }
- // 4th quadrant
- else if ((0 < this.angle && this.angle <= Math.PI/2) || (-Math.PI*2 <= this.angle && this.angle <= -Math.PI*3/2)) {
- tx = Math.sin(this.angle) * this.height;
- ty = 0;
- }
- // 2nd quadrant
- else if ((-Math.PI < this.angle && this.angle < -Math.PI/2) || (Math.PI <= this.angle && this.angle <= Math.PI*3/2)) {
- tx = -Math.cos(this.angle) * this.width;
- ty = -Math.sin(this.angle) * this.width - Math.cos(this.angle) * this.height;
- }
- // 3rd quadrant
- else if ((-Math.PI*3/2 < this.angle && this.angle < Math.PI) || (Math.PI/2 < this.angle && this.angle < Math.PI)) {
- tx = Math.sin(this.angle) * this.height - Math.cos(this.angle)*this.width;
- ty = -Math.cos(this.angle) * this.height;
- }
-
- ctx.strokeStyle = this.fillStyle;
- ctx.fillStyle = this.fillStyle;
- ctx.translate(tx, ty);
- ctx.rotate(this.angle);
- ctx.lineCap = "round";
- // multiplier was 2.0
- var fact = (this.normalizedFontSize > 30) ? 2.0 : 2 + (30 - this.normalizedFontSize)/20;
- ctx.lineWidth = fact * mag * this.fontWeight2Float(this.fontWeight);
-
- for ( var i = 0; i < len; i++) {
- var c = this.letter( str.charAt(i));
- if ( !c) {
- continue;
- }
-
- ctx.beginPath();
-
- var penUp = 1;
- var needStroke = 0;
- for ( var j = 0; j < c.points.length; j++) {
- var a = c.points[j];
- if ( a[0] == -1 && a[1] == -1) {
- penUp = 1;
- continue;
- }
- if ( penUp) {
- ctx.moveTo( x + a[0]*mag*this.fontStretch, y - a[1]*mag);
- penUp = false;
- } else {
- ctx.lineTo( x + a[0]*mag*this.fontStretch, y - a[1]*mag);
- }
- }
- ctx.stroke();
- x += c.width*mag*this.fontStretch;
- }
- ctx.restore();
- return total;
- };
-
- $.jqplot.CanvasTextRenderer.prototype.letters = {
- ' ': { width: 16, points: [] },
- '!': { width: 10, points: [[5,21],[5,7],[-1,-1],[5,2],[4,1],[5,0],[6,1],[5,2]] },
- '"': { width: 16, points: [[4,21],[4,14],[-1,-1],[12,21],[12,14]] },
- '#': { width: 21, points: [[11,25],[4,-7],[-1,-1],[17,25],[10,-7],[-1,-1],[4,12],[18,12],[-1,-1],[3,6],[17,6]] },
- '$': { width: 20, points: [[8,25],[8,-4],[-1,-1],[12,25],[12,-4],[-1,-1],[17,18],[15,20],[12,21],[8,21],[5,20],[3,18],[3,16],[4,14],[5,13],[7,12],[13,10],[15,9],[16,8],[17,6],[17,3],[15,1],[12,0],[8,0],[5,1],[3,3]] },
- '%': { width: 24, points: [[21,21],[3,0],[-1,-1],[8,21],[10,19],[10,17],[9,15],[7,14],[5,14],[3,16],[3,18],[4,20],[6,21],[8,21],[10,20],[13,19],[16,19],[19,20],[21,21],[-1,-1],[17,7],[15,6],[14,4],[14,2],[16,0],[18,0],[20,1],[21,3],[21,5],[19,7],[17,7]] },
- '&': { width: 26, points: [[23,12],[23,13],[22,14],[21,14],[20,13],[19,11],[17,6],[15,3],[13,1],[11,0],[7,0],[5,1],[4,2],[3,4],[3,6],[4,8],[5,9],[12,13],[13,14],[14,16],[14,18],[13,20],[11,21],[9,20],[8,18],[8,16],[9,13],[11,10],[16,3],[18,1],[20,0],[22,0],[23,1],[23,2]] },
- '\'': { width: 10, points: [[5,19],[4,20],[5,21],[6,20],[6,18],[5,16],[4,15]] },
- '(': { width: 14, points: [[11,25],[9,23],[7,20],[5,16],[4,11],[4,7],[5,2],[7,-2],[9,-5],[11,-7]] },
- ')': { width: 14, points: [[3,25],[5,23],[7,20],[9,16],[10,11],[10,7],[9,2],[7,-2],[5,-5],[3,-7]] },
- '*': { width: 16, points: [[8,21],[8,9],[-1,-1],[3,18],[13,12],[-1,-1],[13,18],[3,12]] },
- '+': { width: 26, points: [[13,18],[13,0],[-1,-1],[4,9],[22,9]] },
- ',': { width: 10, points: [[6,1],[5,0],[4,1],[5,2],[6,1],[6,-1],[5,-3],[4,-4]] },
- '-': { width: 18, points: [[6,9],[12,9]] },
- '.': { width: 10, points: [[5,2],[4,1],[5,0],[6,1],[5,2]] },
- '/': { width: 22, points: [[20,25],[2,-7]] },
- '0': { width: 20, points: [[9,21],[6,20],[4,17],[3,12],[3,9],[4,4],[6,1],[9,0],[11,0],[14,1],[16,4],[17,9],[17,12],[16,17],[14,20],[11,21],[9,21]] },
- '1': { width: 20, points: [[6,17],[8,18],[11,21],[11,0]] },
- '2': { width: 20, points: [[4,16],[4,17],[5,19],[6,20],[8,21],[12,21],[14,20],[15,19],[16,17],[16,15],[15,13],[13,10],[3,0],[17,0]] },
- '3': { width: 20, points: [[5,21],[16,21],[10,13],[13,13],[15,12],[16,11],[17,8],[17,6],[16,3],[14,1],[11,0],[8,0],[5,1],[4,2],[3,4]] },
- '4': { width: 20, points: [[13,21],[3,7],[18,7],[-1,-1],[13,21],[13,0]] },
- '5': { width: 20, points: [[15,21],[5,21],[4,12],[5,13],[8,14],[11,14],[14,13],[16,11],[17,8],[17,6],[16,3],[14,1],[11,0],[8,0],[5,1],[4,2],[3,4]] },
- '6': { width: 20, points: [[16,18],[15,20],[12,21],[10,21],[7,20],[5,17],[4,12],[4,7],[5,3],[7,1],[10,0],[11,0],[14,1],[16,3],[17,6],[17,7],[16,10],[14,12],[11,13],[10,13],[7,12],[5,10],[4,7]] },
- '7': { width: 20, points: [[17,21],[7,0],[-1,-1],[3,21],[17,21]] },
- '8': { width: 20, points: [[8,21],[5,20],[4,18],[4,16],[5,14],[7,13],[11,12],[14,11],[16,9],[17,7],[17,4],[16,2],[15,1],[12,0],[8,0],[5,1],[4,2],[3,4],[3,7],[4,9],[6,11],[9,12],[13,13],[15,14],[16,16],[16,18],[15,20],[12,21],[8,21]] },
- '9': { width: 20, points: [[16,14],[15,11],[13,9],[10,8],[9,8],[6,9],[4,11],[3,14],[3,15],[4,18],[6,20],[9,21],[10,21],[13,20],[15,18],[16,14],[16,9],[15,4],[13,1],[10,0],[8,0],[5,1],[4,3]] },
- ':': { width: 10, points: [[5,14],[4,13],[5,12],[6,13],[5,14],[-1,-1],[5,2],[4,1],[5,0],[6,1],[5,2]] },
- ';': { width: 10, points: [[5,14],[4,13],[5,12],[6,13],[5,14],[-1,-1],[6,1],[5,0],[4,1],[5,2],[6,1],[6,-1],[5,-3],[4,-4]] },
- '<': { width: 24, points: [[20,18],[4,9],[20,0]] },
- '=': { width: 26, points: [[4,12],[22,12],[-1,-1],[4,6],[22,6]] },
- '>': { width: 24, points: [[4,18],[20,9],[4,0]] },
- '?': { width: 18, points: [[3,16],[3,17],[4,19],[5,20],[7,21],[11,21],[13,20],[14,19],[15,17],[15,15],[14,13],[13,12],[9,10],[9,7],[-1,-1],[9,2],[8,1],[9,0],[10,1],[9,2]] },
- '@': { width: 27, points: [[18,13],[17,15],[15,16],[12,16],[10,15],[9,14],[8,11],[8,8],[9,6],[11,5],[14,5],[16,6],[17,8],[-1,-1],[12,16],[10,14],[9,11],[9,8],[10,6],[11,5],[-1,-1],[18,16],[17,8],[17,6],[19,5],[21,5],[23,7],[24,10],[24,12],[23,15],[22,17],[20,19],[18,20],[15,21],[12,21],[9,20],[7,19],[5,17],[4,15],[3,12],[3,9],[4,6],[5,4],[7,2],[9,1],[12,0],[15,0],[18,1],[20,2],[21,3],[-1,-1],[19,16],[18,8],[18,6],[19,5]] },
- 'A': { width: 18, points: [[9,21],[1,0],[-1,-1],[9,21],[17,0],[-1,-1],[4,7],[14,7]] },
- 'B': { width: 21, points: [[4,21],[4,0],[-1,-1],[4,21],[13,21],[16,20],[17,19],[18,17],[18,15],[17,13],[16,12],[13,11],[-1,-1],[4,11],[13,11],[16,10],[17,9],[18,7],[18,4],[17,2],[16,1],[13,0],[4,0]] },
- 'C': { width: 21, points: [[18,16],[17,18],[15,20],[13,21],[9,21],[7,20],[5,18],[4,16],[3,13],[3,8],[4,5],[5,3],[7,1],[9,0],[13,0],[15,1],[17,3],[18,5]] },
- 'D': { width: 21, points: [[4,21],[4,0],[-1,-1],[4,21],[11,21],[14,20],[16,18],[17,16],[18,13],[18,8],[17,5],[16,3],[14,1],[11,0],[4,0]] },
- 'E': { width: 19, points: [[4,21],[4,0],[-1,-1],[4,21],[17,21],[-1,-1],[4,11],[12,11],[-1,-1],[4,0],[17,0]] },
- 'F': { width: 18, points: [[4,21],[4,0],[-1,-1],[4,21],[17,21],[-1,-1],[4,11],[12,11]] },
- 'G': { width: 21, points: [[18,16],[17,18],[15,20],[13,21],[9,21],[7,20],[5,18],[4,16],[3,13],[3,8],[4,5],[5,3],[7,1],[9,0],[13,0],[15,1],[17,3],[18,5],[18,8],[-1,-1],[13,8],[18,8]] },
- 'H': { width: 22, points: [[4,21],[4,0],[-1,-1],[18,21],[18,0],[-1,-1],[4,11],[18,11]] },
- 'I': { width: 8, points: [[4,21],[4,0]] },
- 'J': { width: 16, points: [[12,21],[12,5],[11,2],[10,1],[8,0],[6,0],[4,1],[3,2],[2,5],[2,7]] },
- 'K': { width: 21, points: [[4,21],[4,0],[-1,-1],[18,21],[4,7],[-1,-1],[9,12],[18,0]] },
- 'L': { width: 17, points: [[4,21],[4,0],[-1,-1],[4,0],[16,0]] },
- 'M': { width: 24, points: [[4,21],[4,0],[-1,-1],[4,21],[12,0],[-1,-1],[20,21],[12,0],[-1,-1],[20,21],[20,0]] },
- 'N': { width: 22, points: [[4,21],[4,0],[-1,-1],[4,21],[18,0],[-1,-1],[18,21],[18,0]] },
- 'O': { width: 22, points: [[9,21],[7,20],[5,18],[4,16],[3,13],[3,8],[4,5],[5,3],[7,1],[9,0],[13,0],[15,1],[17,3],[18,5],[19,8],[19,13],[18,16],[17,18],[15,20],[13,21],[9,21]] },
- 'P': { width: 21, points: [[4,21],[4,0],[-1,-1],[4,21],[13,21],[16,20],[17,19],[18,17],[18,14],[17,12],[16,11],[13,10],[4,10]] },
- 'Q': { width: 22, points: [[9,21],[7,20],[5,18],[4,16],[3,13],[3,8],[4,5],[5,3],[7,1],[9,0],[13,0],[15,1],[17,3],[18,5],[19,8],[19,13],[18,16],[17,18],[15,20],[13,21],[9,21],[-1,-1],[12,4],[18,-2]] },
- 'R': { width: 21, points: [[4,21],[4,0],[-1,-1],[4,21],[13,21],[16,20],[17,19],[18,17],[18,15],[17,13],[16,12],[13,11],[4,11],[-1,-1],[11,11],[18,0]] },
- 'S': { width: 20, points: [[17,18],[15,20],[12,21],[8,21],[5,20],[3,18],[3,16],[4,14],[5,13],[7,12],[13,10],[15,9],[16,8],[17,6],[17,3],[15,1],[12,0],[8,0],[5,1],[3,3]] },
- 'T': { width: 16, points: [[8,21],[8,0],[-1,-1],[1,21],[15,21]] },
- 'U': { width: 22, points: [[4,21],[4,6],[5,3],[7,1],[10,0],[12,0],[15,1],[17,3],[18,6],[18,21]] },
- 'V': { width: 18, points: [[1,21],[9,0],[-1,-1],[17,21],[9,0]] },
- 'W': { width: 24, points: [[2,21],[7,0],[-1,-1],[12,21],[7,0],[-1,-1],[12,21],[17,0],[-1,-1],[22,21],[17,0]] },
- 'X': { width: 20, points: [[3,21],[17,0],[-1,-1],[17,21],[3,0]] },
- 'Y': { width: 18, points: [[1,21],[9,11],[9,0],[-1,-1],[17,21],[9,11]] },
- 'Z': { width: 20, points: [[17,21],[3,0],[-1,-1],[3,21],[17,21],[-1,-1],[3,0],[17,0]] },
- '[': { width: 14, points: [[4,25],[4,-7],[-1,-1],[5,25],[5,-7],[-1,-1],[4,25],[11,25],[-1,-1],[4,-7],[11,-7]] },
- '\\': { width: 14, points: [[0,21],[14,-3]] },
- ']': { width: 14, points: [[9,25],[9,-7],[-1,-1],[10,25],[10,-7],[-1,-1],[3,25],[10,25],[-1,-1],[3,-7],[10,-7]] },
- '^': { width: 16, points: [[6,15],[8,18],[10,15],[-1,-1],[3,12],[8,17],[13,12],[-1,-1],[8,17],[8,0]] },
- '_': { width: 16, points: [[0,-2],[16,-2]] },
- '`': { width: 10, points: [[6,21],[5,20],[4,18],[4,16],[5,15],[6,16],[5,17]] },
- 'a': { width: 19, points: [[15,14],[15,0],[-1,-1],[15,11],[13,13],[11,14],[8,14],[6,13],[4,11],[3,8],[3,6],[4,3],[6,1],[8,0],[11,0],[13,1],[15,3]] },
- 'b': { width: 19, points: [[4,21],[4,0],[-1,-1],[4,11],[6,13],[8,14],[11,14],[13,13],[15,11],[16,8],[16,6],[15,3],[13,1],[11,0],[8,0],[6,1],[4,3]] },
- 'c': { width: 18, points: [[15,11],[13,13],[11,14],[8,14],[6,13],[4,11],[3,8],[3,6],[4,3],[6,1],[8,0],[11,0],[13,1],[15,3]] },
- 'd': { width: 19, points: [[15,21],[15,0],[-1,-1],[15,11],[13,13],[11,14],[8,14],[6,13],[4,11],[3,8],[3,6],[4,3],[6,1],[8,0],[11,0],[13,1],[15,3]] },
- 'e': { width: 18, points: [[3,8],[15,8],[15,10],[14,12],[13,13],[11,14],[8,14],[6,13],[4,11],[3,8],[3,6],[4,3],[6,1],[8,0],[11,0],[13,1],[15,3]] },
- 'f': { width: 12, points: [[10,21],[8,21],[6,20],[5,17],[5,0],[-1,-1],[2,14],[9,14]] },
- 'g': { width: 19, points: [[15,14],[15,-2],[14,-5],[13,-6],[11,-7],[8,-7],[6,-6],[-1,-1],[15,11],[13,13],[11,14],[8,14],[6,13],[4,11],[3,8],[3,6],[4,3],[6,1],[8,0],[11,0],[13,1],[15,3]] },
- 'h': { width: 19, points: [[4,21],[4,0],[-1,-1],[4,10],[7,13],[9,14],[12,14],[14,13],[15,10],[15,0]] },
- 'i': { width: 8, points: [[3,21],[4,20],[5,21],[4,22],[3,21],[-1,-1],[4,14],[4,0]] },
- 'j': { width: 10, points: [[5,21],[6,20],[7,21],[6,22],[5,21],[-1,-1],[6,14],[6,-3],[5,-6],[3,-7],[1,-7]] },
- 'k': { width: 17, points: [[4,21],[4,0],[-1,-1],[14,14],[4,4],[-1,-1],[8,8],[15,0]] },
- 'l': { width: 8, points: [[4,21],[4,0]] },
- 'm': { width: 30, points: [[4,14],[4,0],[-1,-1],[4,10],[7,13],[9,14],[12,14],[14,13],[15,10],[15,0],[-1,-1],[15,10],[18,13],[20,14],[23,14],[25,13],[26,10],[26,0]] },
- 'n': { width: 19, points: [[4,14],[4,0],[-1,-1],[4,10],[7,13],[9,14],[12,14],[14,13],[15,10],[15,0]] },
- 'o': { width: 19, points: [[8,14],[6,13],[4,11],[3,8],[3,6],[4,3],[6,1],[8,0],[11,0],[13,1],[15,3],[16,6],[16,8],[15,11],[13,13],[11,14],[8,14]] },
- 'p': { width: 19, points: [[4,14],[4,-7],[-1,-1],[4,11],[6,13],[8,14],[11,14],[13,13],[15,11],[16,8],[16,6],[15,3],[13,1],[11,0],[8,0],[6,1],[4,3]] },
- 'q': { width: 19, points: [[15,14],[15,-7],[-1,-1],[15,11],[13,13],[11,14],[8,14],[6,13],[4,11],[3,8],[3,6],[4,3],[6,1],[8,0],[11,0],[13,1],[15,3]] },
- 'r': { width: 13, points: [[4,14],[4,0],[-1,-1],[4,8],[5,11],[7,13],[9,14],[12,14]] },
- 's': { width: 17, points: [[14,11],[13,13],[10,14],[7,14],[4,13],[3,11],[4,9],[6,8],[11,7],[13,6],[14,4],[14,3],[13,1],[10,0],[7,0],[4,1],[3,3]] },
- 't': { width: 12, points: [[5,21],[5,4],[6,1],[8,0],[10,0],[-1,-1],[2,14],[9,14]] },
- 'u': { width: 19, points: [[4,14],[4,4],[5,1],[7,0],[10,0],[12,1],[15,4],[-1,-1],[15,14],[15,0]] },
- 'v': { width: 16, points: [[2,14],[8,0],[-1,-1],[14,14],[8,0]] },
- 'w': { width: 22, points: [[3,14],[7,0],[-1,-1],[11,14],[7,0],[-1,-1],[11,14],[15,0],[-1,-1],[19,14],[15,0]] },
- 'x': { width: 17, points: [[3,14],[14,0],[-1,-1],[14,14],[3,0]] },
- 'y': { width: 16, points: [[2,14],[8,0],[-1,-1],[14,14],[8,0],[6,-4],[4,-6],[2,-7],[1,-7]] },
- 'z': { width: 17, points: [[14,14],[3,0],[-1,-1],[3,14],[14,14],[-1,-1],[3,0],[14,0]] },
- '{': { width: 14, points: [[9,25],[7,24],[6,23],[5,21],[5,19],[6,17],[7,16],[8,14],[8,12],[6,10],[-1,-1],[7,24],[6,22],[6,20],[7,18],[8,17],[9,15],[9,13],[8,11],[4,9],[8,7],[9,5],[9,3],[8,1],[7,0],[6,-2],[6,-4],[7,-6],[-1,-1],[6,8],[8,6],[8,4],[7,2],[6,1],[5,-1],[5,-3],[6,-5],[7,-6],[9,-7]] },
- '|': { width: 8, points: [[4,25],[4,-7]] },
- '}': { width: 14, points: [[5,25],[7,24],[8,23],[9,21],[9,19],[8,17],[7,16],[6,14],[6,12],[8,10],[-1,-1],[7,24],[8,22],[8,20],[7,18],[6,17],[5,15],[5,13],[6,11],[10,9],[6,7],[5,5],[5,3],[6,1],[7,0],[8,-2],[8,-4],[7,-6],[-1,-1],[8,8],[6,6],[6,4],[7,2],[8,1],[9,-1],[9,-3],[8,-5],[7,-6],[5,-7]] },
- '~': { width: 24, points: [[3,6],[3,8],[4,11],[6,12],[8,12],[10,11],[14,8],[16,7],[18,7],[20,8],[21,10],[-1,-1],[3,8],[4,10],[6,11],[8,11],[10,10],[14,7],[16,6],[18,6],[20,7],[21,10],[21,12]] }
- };
-
- $.jqplot.CanvasFontRenderer = function(options) {
- options = options || {};
- if (!options.pt2px) {
- options.pt2px = 1.5;
- }
- $.jqplot.CanvasTextRenderer.call(this, options);
- };
-
- $.jqplot.CanvasFontRenderer.prototype = new $.jqplot.CanvasTextRenderer({});
- $.jqplot.CanvasFontRenderer.prototype.constructor = $.jqplot.CanvasFontRenderer;
-
- $.jqplot.CanvasFontRenderer.prototype.measure = function(ctx, str)
- {
- // var fstyle = this.fontStyle+' '+this.fontVariant+' '+this.fontWeight+' '+this.fontSize+' '+this.fontFamily;
- var fstyle = this.fontSize+' '+this.fontFamily;
- ctx.save();
- ctx.font = fstyle;
- var w = ctx.measureText(str).width;
- ctx.restore();
- return w;
- };
-
- $.jqplot.CanvasFontRenderer.prototype.draw = function(ctx, str)
- {
- var x = 0;
- // leave room at bottom for descenders.
- var y = this.height*0.72;
- //var y = 12;
-
- ctx.save();
- var tx, ty;
-
- // 1st quadrant
- if ((-Math.PI/2 <= this.angle && this.angle <= 0) || (Math.PI*3/2 <= this.angle && this.angle <= Math.PI*2)) {
- tx = 0;
- ty = -Math.sin(this.angle) * this.width;
- }
- // 4th quadrant
- else if ((0 < this.angle && this.angle <= Math.PI/2) || (-Math.PI*2 <= this.angle && this.angle <= -Math.PI*3/2)) {
- tx = Math.sin(this.angle) * this.height;
- ty = 0;
- }
- // 2nd quadrant
- else if ((-Math.PI < this.angle && this.angle < -Math.PI/2) || (Math.PI <= this.angle && this.angle <= Math.PI*3/2)) {
- tx = -Math.cos(this.angle) * this.width;
- ty = -Math.sin(this.angle) * this.width - Math.cos(this.angle) * this.height;
- }
- // 3rd quadrant
- else if ((-Math.PI*3/2 < this.angle && this.angle < Math.PI) || (Math.PI/2 < this.angle && this.angle < Math.PI)) {
- tx = Math.sin(this.angle) * this.height - Math.cos(this.angle)*this.width;
- ty = -Math.cos(this.angle) * this.height;
- }
- ctx.strokeStyle = this.fillStyle;
- ctx.fillStyle = this.fillStyle;
- // var fstyle = this.fontStyle+' '+this.fontVariant+' '+this.fontWeight+' '+this.fontSize+' '+this.fontFamily;
- var fstyle = this.fontSize+' '+this.fontFamily;
- ctx.font = fstyle;
- ctx.translate(tx, ty);
- ctx.rotate(this.angle);
- ctx.fillText(str, x, y);
- // ctx.strokeText(str, x, y);
-
- ctx.restore();
- };
-
-})(jQuery);
\ No newline at end of file
diff --git a/libreplan-webapp/src/main/webapp/jqplot/plugins/jqplot.categoryAxisRenderer.js b/libreplan-webapp/src/main/webapp/jqplot/plugins/jqplot.categoryAxisRenderer.js
deleted file mode 100644
index 742096c31..000000000
--- a/libreplan-webapp/src/main/webapp/jqplot/plugins/jqplot.categoryAxisRenderer.js
+++ /dev/null
@@ -1,636 +0,0 @@
-/**
- * jqPlot
- * Pure JavaScript plotting plugin using jQuery
- *
- * Version: 1.0.0b2_r1012
- *
- * Copyright (c) 2009-2011 Chris Leonello
- * jqPlot is currently available for use in all personal or commercial projects
- * under both the MIT (http://www.opensource.org/licenses/mit-license.php) and GPL
- * version 2.0 (http://www.gnu.org/licenses/gpl-2.0.html) licenses. This means that you can
- * choose the license that best suits your project and use it accordingly.
- *
- * Although not required, the author would appreciate an email letting him
- * know of any substantial use of jqPlot. You can reach the author at:
- * chris at jqplot dot com or see http://www.jqplot.com/info.php .
- *
- * If you are feeling kind and generous, consider supporting the project by
- * making a donation at: http://www.jqplot.com/donate.php .
- *
- * sprintf functions contained in jqplot.sprintf.js by Ash Searle:
- *
- * version 2007.04.27
- * author Ash Searle
- * http://hexmen.com/blog/2007/03/printf-sprintf/
- * http://hexmen.com/js/sprintf.js
- * The author (Ash Searle) has placed this code in the public domain:
- * "This code is unrestricted: you are free to use it however you like."
- *
- */
-(function($) {
- /**
- * class: $.jqplot.CategoryAxisRenderer
- * A plugin for jqPlot to render a category style axis, with equal pixel spacing between y data values of a series.
- *
- * To use this renderer, include the plugin in your source
- * >
- *
- * and supply the appropriate options to your plot
- *
- * > {axes:{xaxis:{renderer:$.jqplot.CategoryAxisRenderer}}}
- **/
- $.jqplot.CategoryAxisRenderer = function(options) {
- $.jqplot.LinearAxisRenderer.call(this);
- // prop: sortMergedLabels
- // True to sort tick labels when labels are created by merging
- // x axis values from multiple series. That is, say you have
- // two series like:
- // > line1 = [[2006, 4], [2008, 9], [2009, 16]];
- // > line2 = [[2006, 3], [2007, 7], [2008, 6]];
- // If no label array is specified, tick labels will be collected
- // from the x values of the series. With sortMergedLabels
- // set to true, tick labels will be:
- // > [2006, 2007, 2008, 2009]
- // With sortMergedLabels set to false, tick labels will be:
- // > [2006, 2008, 2009, 2007]
- //
- // Note, this property is specified on the renderOptions for the
- // axes when creating a plot:
- // > axes:{xaxis:{renderer:$.jqplot.CategoryAxisRenderer, rendererOptions:{sortMergedLabels:true}}}
- this.sortMergedLabels = false;
- };
-
- $.jqplot.CategoryAxisRenderer.prototype = new $.jqplot.LinearAxisRenderer();
- $.jqplot.CategoryAxisRenderer.prototype.constructor = $.jqplot.CategoryAxisRenderer;
-
- $.jqplot.CategoryAxisRenderer.prototype.init = function(options){
- this.groups = 1;
- this.groupLabels = [];
- this._groupLabels = [];
- this._grouped = false;
- this._barsPerGroup = null;
- // prop: tickRenderer
- // A class of a rendering engine for creating the ticks labels displayed on the plot,
- // See <$.jqplot.AxisTickRenderer>.
- // this.tickRenderer = $.jqplot.AxisTickRenderer;
- // this.labelRenderer = $.jqplot.AxisLabelRenderer;
- $.extend(true, this, {tickOptions:{formatString:'%d'}}, options);
- var db = this._dataBounds;
- // Go through all the series attached to this axis and find
- // the min/max bounds for this axis.
- for (var i=0; i db.max || db.max == null) {
- db.max = d[j][0];
- }
- }
- else {
- if (d[j][1] < db.min || db.min == null) {
- db.min = d[j][1];
- }
- if (d[j][1] > db.max || db.max == null) {
- db.max = d[j][1];
- }
- }
- }
- }
-
- if (this.groupLabels.length) {
- this.groups = this.groupLabels.length;
- }
- };
-
-
- $.jqplot.CategoryAxisRenderer.prototype.createTicks = function() {
- // we're are operating on an axis here
- var ticks = this._ticks;
- var userTicks = this.ticks;
- var name = this.name;
- // databounds were set on axis initialization.
- var db = this._dataBounds;
- var dim, interval;
- var min, max;
- var pos1, pos2;
- var tt, i;
-
- // if we already have ticks, use them.
- if (userTicks.length) {
- // adjust with blanks if we have groups
- if (this.groups > 1 && !this._grouped) {
- var l = userTicks.length;
- var skip = parseInt(l/this.groups, 10);
- var count = 0;
- for (var i=skip; i 1 && !this._grouped) {
- var l = labels.length;
- var skip = parseInt(l/this.groups, 10);
- var count = 0;
- for (var i=skip; i0 && track');
-
- if (this.name == 'xaxis' || this.name == 'x2axis') {
- this._elem.width(this._plotDimensions.width);
- }
- else {
- this._elem.height(this._plotDimensions.height);
- }
-
- // create a _label object.
- this.labelOptions.axis = this.name;
- this._label = new this.labelRenderer(this.labelOptions);
- if (this._label.show) {
- var elem = this._label.draw(ctx, plot);
- elem.appendTo(this._elem);
- }
-
- var t = this._ticks;
- for (var i=0; i');
- elem.html(this.groupLabels[i]);
- this._groupLabels.push(elem);
- elem.appendTo(this._elem);
- }
- }
- return this._elem;
- };
-
- // called with scope of axis
- $.jqplot.CategoryAxisRenderer.prototype.set = function() {
- var dim = 0;
- var temp;
- var w = 0;
- var h = 0;
- var lshow = (this._label == null) ? false : this._label.show;
- if (this.show) {
- var t = this._ticks;
- for (var i=0; i dim) {
- dim = temp;
- }
- }
- }
-
- var dim2 = 0;
- for (var i=0; i dim2) {
- dim2 = temp;
- }
- }
-
- if (lshow) {
- w = this._label._elem.outerWidth(true);
- h = this._label._elem.outerHeight(true);
- }
- if (this.name == 'xaxis') {
- dim += dim2 + h;
- this._elem.css({'height':dim+'px', left:'0px', bottom:'0px'});
- }
- else if (this.name == 'x2axis') {
- dim += dim2 + h;
- this._elem.css({'height':dim+'px', left:'0px', top:'0px'});
- }
- else if (this.name == 'yaxis') {
- dim += dim2 + w;
- this._elem.css({'width':dim+'px', left:'0px', top:'0px'});
- if (lshow && this._label.constructor == $.jqplot.AxisLabelRenderer) {
- this._label._elem.css('width', w+'px');
- }
- }
- else {
- dim += dim2 + w;
- this._elem.css({'width':dim+'px', right:'0px', top:'0px'});
- if (lshow && this._label.constructor == $.jqplot.AxisLabelRenderer) {
- this._label._elem.css('width', w+'px');
- }
- }
- }
- };
-
- // called with scope of axis
- $.jqplot.CategoryAxisRenderer.prototype.pack = function(pos, offsets) {
- var ticks = this._ticks;
- var max = this.max;
- var min = this.min;
- var offmax = offsets.max;
- var offmin = offsets.min;
- var lshow = (this._label == null) ? false : this._label.show;
- var i;
-
- for (var p in pos) {
- this._elem.css(p, pos[p]);
- }
-
- this._offsets = offsets;
- // pixellength will be + for x axes and - for y axes becasue pixels always measured from top left.
- var pixellength = offmax - offmin;
- var unitlength = max - min;
-
- // point to unit and unit to point conversions references to Plot DOM element top left corner.
- this.p2u = function(p){
- return (p - offmin) * unitlength / pixellength + min;
- };
-
- this.u2p = function(u){
- return (u - min) * pixellength / unitlength + offmin;
- };
-
- if (this.name == 'xaxis' || this.name == 'x2axis'){
- this.series_u2p = function(u){
- return (u - min) * pixellength / unitlength;
- };
- this.series_p2u = function(p){
- return p * unitlength / pixellength + min;
- };
- }
-
- else {
- this.series_u2p = function(u){
- return (u - max) * pixellength / unitlength;
- };
- this.series_p2u = function(p){
- return p * unitlength / pixellength + max;
- };
- }
-
- if (this.show) {
- if (this.name == 'xaxis' || this.name == 'x2axis') {
- for (i=0; i 0) {
- shim = -t._textRenderer.height * Math.cos(-t._textRenderer.angle) / 2;
- }
- else {
- shim = -t.getHeight() + t._textRenderer.height * Math.cos(t._textRenderer.angle) / 2;
- }
- break;
- case 'middle':
- // if (t.angle > 0) {
- // shim = -t.getHeight()/2 + t._textRenderer.height * Math.sin(-t._textRenderer.angle) / 2;
- // }
- // else {
- // shim = -t.getHeight()/2 - t._textRenderer.height * Math.sin(t._textRenderer.angle) / 2;
- // }
- shim = -t.getHeight()/2;
- break;
- default:
- shim = -t.getHeight()/2;
- break;
- }
- }
- else {
- shim = -t.getHeight()/2;
- }
-
- var val = this.u2p(t.value) + shim + 'px';
- t._elem.css('top', val);
- t.pack();
- }
- }
-
- var labeledge=['left', 0];
- if (lshow) {
- var h = this._label._elem.outerHeight(true);
- this._label._elem.css('top', offmax - pixellength/2 - h/2 + 'px');
- if (this.name == 'yaxis') {
- this._label._elem.css('left', '0px');
- labeledge = ['left', this._label._elem.outerWidth(true)];
- }
- else {
- this._label._elem.css('right', '0px');
- labeledge = ['right', this._label._elem.outerWidth(true)];
- }
- this._label.pack();
- }
-
- // draw the group labels, position top here, do left after label position.
- var step = parseInt(this._ticks.length/this.groups, 10);
- for (i=0; i plot = $.jqplot('mychart', [data], { dataRenderer: $.jqplot.ciParser, ... });
- *
- * Where data is an object in JSON format or a JSON encoded string conforming to the
- * City Index API spec.
- *
- * Note that calling the renderer function is handled internally by jqPlot. The
- * user does not have to call the function. The parameters described below will
- * automatically be passed to the ciParser function.
- *
- * Parameters:
- * data - JSON encoded string or object.
- * plot - reference to jqPlot Plot object.
- *
- * Returns:
- * data array in jqPlot format.
- *
- */
- $.jqplot.ciParser = function (data, plot) {
- var ret = [],
- line,
- temp,
- i, j, k, kk;
-
- if (typeof(data) == "string") {
- data = $.jqplot.JSON.parse(data, handleStrings);
- }
-
- else if (typeof(data) == "object") {
- for (k in data) {
- for (i=0; i= 0) {
- //here we will try to extract the ticks from the Date string in the "value" fields of JSON returned data
- a = /^\/Date\((-?[0-9]+)\)\/$/.exec(value);
- if (a) {
- return parseInt(a[1], 10);
- }
- }
- return value;
- }
- }
-
- for (var prop in data) {
- line = [];
- temp = data[prop];
- switch (prop) {
- case "PriceTicks":
- for (i=0; i=0){i=/^\/Date\((-?[0-9]+)\)\/$/.exec(k);if(i){return parseInt(i[1],10)}}return k}}for(var b in g){o=[];n=g[b];switch(b){case"PriceTicks":for(h=0;h= 1 or will often miss point intersections.
- this.intersectionThreshold = 2;
- // prop: showCursorLegend
- // Replace the plot legend with an enhanced legend displaying intersection information.
- this.showCursorLegend = false;
- // prop: cursorLegendFormatString
- // Format string used in the cursor legend. If showTooltipDataPosition is true,
- // this will also be the default format string used by tooltipFormatString.
- this.cursorLegendFormatString = $.jqplot.Cursor.cursorLegendFormatString;
- // whether the cursor is over the grid or not.
- this._oldHandlers = {onselectstart: null, ondrag: null, onmousedown: null};
- // prop: constrainOutsideZoom
- // True to limit actual zoom area to edges of grid, even when zooming
- // outside of plot area. That is, can't zoom out by mousing outside plot.
- this.constrainOutsideZoom = true;
- // prop: showTooltipOutsideZoom
- // True will keep updating the tooltip when zooming of the grid.
- this.showTooltipOutsideZoom = false;
- // true if mouse is over grid, false if not.
- this.onGrid = false;
- $.extend(true, this, options);
- };
-
- $.jqplot.Cursor.cursorLegendFormatString = '%s x:%s, y:%s';
-
- // called with scope of plot
- $.jqplot.Cursor.init = function (target, data, opts){
- // add a cursor attribute to the plot
- var options = opts || {};
- this.plugins.cursor = new $.jqplot.Cursor(options.cursor);
- var c = this.plugins.cursor;
-
- if (c.show) {
- $.jqplot.eventListenerHooks.push(['jqplotMouseEnter', handleMouseEnter]);
- $.jqplot.eventListenerHooks.push(['jqplotMouseLeave', handleMouseLeave]);
- $.jqplot.eventListenerHooks.push(['jqplotMouseMove', handleMouseMove]);
-
- if (c.showCursorLegend) {
- opts.legend = opts.legend || {};
- opts.legend.renderer = $.jqplot.CursorLegendRenderer;
- opts.legend.formatString = this.plugins.cursor.cursorLegendFormatString;
- opts.legend.show = true;
- }
-
- if (c.zoom) {
- $.jqplot.eventListenerHooks.push(['jqplotMouseDown', handleMouseDown]);
-
- if (c.clickReset) {
- $.jqplot.eventListenerHooks.push(['jqplotClick', handleClick]);
- }
-
- if (c.dblClickReset) {
- $.jqplot.eventListenerHooks.push(['jqplotDblClick', handleDblClick]);
- }
- }
-
- this.resetZoom = function() {
- var axes = this.axes;
- if (!c.zoomProxy) {
- for (var ax in axes) {
- axes[ax].reset();
- axes[ax]._ticks = [];
- // fake out tick creation algorithm to make sure original auto
- // computed format string is used if _overrideFormatString is true
- if (c._zoom.axes[ax] !== undefined) {
- axes[ax]._autoFormatString = c._zoom.axes[ax].tickFormatString;
- }
- }
- this.redraw();
- }
- else {
- var ctx = this.plugins.cursor.zoomCanvas._ctx;
- ctx.clearRect(0,0,ctx.canvas.width, ctx.canvas.height);
- ctx = null;
- }
- this.plugins.cursor._zoom.isZoomed = false;
- this.target.trigger('jqplotResetZoom', [this, this.plugins.cursor]);
- };
-
-
- if (c.showTooltipDataPosition) {
- c.showTooltipUnitPosition = false;
- c.showTooltipGridPosition = false;
- if (options.cursor.tooltipFormatString == undefined) {
- c.tooltipFormatString = $.jqplot.Cursor.cursorLegendFormatString;
- }
- }
- }
- };
-
- // called with context of plot
- $.jqplot.Cursor.postDraw = function() {
- var c = this.plugins.cursor;
-
- // Memory Leaks patch
- if (c.zoomCanvas) {
- c.zoomCanvas.resetCanvas();
- c.zoomCanvas = null;
- }
-
- if (c.cursorCanvas) {
- c.cursorCanvas.resetCanvas();
- c.cursorCanvas = null;
- }
-
- if (c._tooltipElem) {
- c._tooltipElem.emptyForce();
- c._tooltipElem = null;
- }
-
-
- if (c.zoom) {
- c.zoomCanvas = new $.jqplot.GenericCanvas();
- this.eventCanvas._elem.before(c.zoomCanvas.createElement(this._gridPadding, 'jqplot-zoom-canvas', this._plotDimensions, this));
- c.zoomCanvas.setContext();
- }
-
- var elem = document.createElement('div');
- c._tooltipElem = $(elem);
- elem = null;
- c._tooltipElem.addClass('jqplot-cursor-tooltip');
- c._tooltipElem.css({position:'absolute', display:'none'});
-
-
- if (c.zoomCanvas) {
- c.zoomCanvas._elem.before(c._tooltipElem);
- }
-
- else {
- this.eventCanvas._elem.before(c._tooltipElem);
- }
-
- if (c.showVerticalLine || c.showHorizontalLine) {
- c.cursorCanvas = new $.jqplot.GenericCanvas();
- this.eventCanvas._elem.before(c.cursorCanvas.createElement(this._gridPadding, 'jqplot-cursor-canvas', this._plotDimensions, this));
- c.cursorCanvas.setContext();
- }
-
- // if we are showing the positions in unit coordinates, and no axes groups
- // were specified, create a default set.
- if (c.showTooltipUnitPosition){
- if (c.tooltipAxisGroups.length === 0) {
- var series = this.series;
- var s;
- var temp = [];
- for (var i=0; i 6 && Math.abs(gridpos.y - c._zoom.start[1]) > 6) || (c.constrainZoomTo == 'x' && Math.abs(gridpos.x - c._zoom.start[0]) > 6) || (c.constrainZoomTo == 'y' && Math.abs(gridpos.y - c._zoom.start[1]) > 6)) {
- if (!plot.plugins.cursor.zoomProxy) {
- for (var ax in datapos) {
- // make a copy of the original axes to revert back.
- if (c._zoom.axes[ax] == undefined) {
- c._zoom.axes[ax] = {};
- c._zoom.axes[ax].numberTicks = axes[ax].numberTicks;
- c._zoom.axes[ax].tickInterval = axes[ax].tickInterval;
- // for date axes...
- c._zoom.axes[ax].daTickInterval = axes[ax].daTickInterval;
- c._zoom.axes[ax].min = axes[ax].min;
- c._zoom.axes[ax].max = axes[ax].max;
- c._zoom.axes[ax].tickFormatString = (axes[ax].tickOptions != null) ? axes[ax].tickOptions.formatString : '';
- }
-
-
- if ((c.constrainZoomTo == 'none') || (c.constrainZoomTo == 'x' && ax.charAt(0) == 'x') || (c.constrainZoomTo == 'y' && ax.charAt(0) == 'y')) {
- dp = datapos[ax];
- if (dp != null) {
- if (dp > start[ax]) {
- newmin = start[ax];
- newmax = dp;
- }
- else {
- span = start[ax] - dp;
- newmin = dp;
- newmax = start[ax];
- }
-
- curax = axes[ax];
-
- _numberTicks = null;
-
- // if aligning this axis, use number of ticks from previous axis.
- // Do I need to reset somehow if alignTicks is changed and then graph is replotted??
- if (curax.alignTicks) {
- if (curax.name === 'x2axis' && plot.axes.xaxis.show) {
- _numberTicks = plot.axes.xaxis.numberTicks;
- }
- else if (curax.name.charAt(0) === 'y' && curax.name !== 'yaxis' && curax.name !== 'yMidAxis' && plot.axes.yaxis.show) {
- _numberTicks = plot.axes.yaxis.numberTicks;
- }
- }
-
- if (this.looseZoom && (axes[ax].renderer.constructor === $.jqplot.LinearAxisRenderer || axes[ax].renderer.constructor === $.jqplot.LogAxisRenderer )) { //} || axes[ax].renderer.constructor === $.jqplot.DateAxisRenderer)) {
-
- ret = $.jqplot.LinearTickGenerator(newmin, newmax, curax._scalefact, _numberTicks);
-
- // if new minimum is less than "true" minimum of axis display, adjust it
- if (axes[ax].tickInset && ret[0] < axes[ax].min + axes[ax].tickInset * axes[ax].tickInterval) {
- ret[0] += ret[4];
- ret[2] -= 1;
- }
-
- // if new maximum is greater than "true" max of axis display, adjust it
- if (axes[ax].tickInset && ret[1] > axes[ax].max - axes[ax].tickInset * axes[ax].tickInterval) {
- ret[1] -= ret[4];
- ret[2] -= 1;
- }
-
- // for log axes, don't fall below current minimum, this will look bad and can't have 0 in range anyway.
- if (axes[ax].renderer.constructor === $.jqplot.LogAxisRenderer && ret[0] < axes[ax].min) {
- // remove a tick and shift min up
- ret[0] += ret[4];
- ret[2] -= 1;
- }
-
- axes[ax].min = ret[0];
- axes[ax].max = ret[1];
- axes[ax]._autoFormatString = ret[3];
- axes[ax].numberTicks = ret[2];
- axes[ax].tickInterval = ret[4];
- // for date axes...
- axes[ax].daTickInterval = [ret[4]/1000, 'seconds'];
- }
- else {
- axes[ax].min = newmin;
- axes[ax].max = newmax;
- axes[ax].tickInterval = null;
- axes[ax].numberTicks = null;
- // for date axes...
- axes[ax].daTickInterval = null;
- }
-
- axes[ax]._ticks = [];
- }
- }
-
- // if ((c.constrainZoomTo == 'x' && ax.charAt(0) == 'y' && c.autoscaleConstraint) || (c.constrainZoomTo == 'y' && ax.charAt(0) == 'x' && c.autoscaleConstraint)) {
- // dp = datapos[ax];
- // if (dp != null) {
- // axes[ax].max == null;
- // axes[ax].min = null;
- // }
- // }
- }
- ctx.clearRect(0,0,ctx.canvas.width, ctx.canvas.height);
- plot.redraw();
- c._zoom.isZoomed = true;
- ctx = null;
- }
- plot.target.trigger('jqplotZoom', [gridpos, datapos, plot, cursor]);
- }
- };
-
- $.jqplot.preInitHooks.push($.jqplot.Cursor.init);
- $.jqplot.postDrawHooks.push($.jqplot.Cursor.postDraw);
-
- function updateTooltip(gridpos, datapos, plot) {
- var c = plot.plugins.cursor;
- var s = '';
- var addbr = false;
- if (c.showTooltipGridPosition) {
- s = gridpos.x+', '+gridpos.y;
- addbr = true;
- }
- if (c.showTooltipUnitPosition) {
- var g;
- for (var i=0; i ';
- }
- if (c.useAxesFormatters) {
- var xf = plot.axes[g[0]]._ticks[0].formatter;
- var yf = plot.axes[g[1]]._ticks[0].formatter;
- var xfstr = plot.axes[g[0]]._ticks[0].formatString;
- var yfstr = plot.axes[g[1]]._ticks[0].formatString;
- s += xf(xfstr, datapos[g[0]]) + ', '+ yf(yfstr, datapos[g[1]]);
- }
- else {
- s += $.jqplot.sprintf(c.tooltipFormatString, datapos[g[0]], datapos[g[1]]);
- }
- addbr = true;
- }
- }
-
- if (c.showTooltipDataPosition) {
- var series = plot.series;
- var ret = getIntersectingPoints(plot, gridpos.x, gridpos.y);
- var addbr = false;
-
- for (var i = 0; i< series.length; i++) {
- if (series[i].show) {
- var idx = series[i].index;
- var label = series[i].label.toString();
- var cellid = $.inArray(idx, ret.indices);
- var sx = undefined;
- var sy = undefined;
- if (cellid != -1) {
- var data = ret.data[cellid].data;
- if (c.useAxesFormatters) {
- var xf = series[i]._xaxis._ticks[0].formatter;
- var yf = series[i]._yaxis._ticks[0].formatter;
- var xfstr = series[i]._xaxis._ticks[0].formatString;
- var yfstr = series[i]._yaxis._ticks[0].formatString;
- sx = xf(xfstr, data[0]);
- sy = yf(yfstr, data[1]);
- }
- else {
- sx = data[0];
- sy = data[1];
- }
- if (addbr) {
- s += ' ';
- }
- s += $.jqplot.sprintf(c.tooltipFormatString, label, sx, sy);
- addbr = true;
- }
- }
- }
-
- }
- c._tooltipElem.html(s);
- }
-
- function moveLine(gridpos, plot) {
- var c = plot.plugins.cursor;
- var ctx = c.cursorCanvas._ctx;
- ctx.clearRect(0,0,ctx.canvas.width, ctx.canvas.height);
- if (c.showVerticalLine) {
- c.shapeRenderer.draw(ctx, [[gridpos.x, 0], [gridpos.x, ctx.canvas.height]]);
- }
- if (c.showHorizontalLine) {
- c.shapeRenderer.draw(ctx, [[0, gridpos.y], [ctx.canvas.width, gridpos.y]]);
- }
- var ret = getIntersectingPoints(plot, gridpos.x, gridpos.y);
- if (c.showCursorLegend) {
- var cells = $(plot.targetId + ' td.jqplot-cursor-legend-label');
- for (var i=0; i0; n--) {
- axis = an[n-1];
- if (ax[axis].show) {
- dataPos[axis] = ax[axis].series_p2u(gridPos[axis.charAt(0)]);
- }
- }
-
- return {offsets:go, gridPos:gridPos, dataPos:dataPos};
- }
-
- function handleZoomMove(ev) {
- var plot = ev.data.plot;
- var c = plot.plugins.cursor;
- // don't do anything if not on grid.
- if (c.show && c.zoom && c._zoom.started && !c.zoomTarget) {
- var ctx = c.zoomCanvas._ctx;
- var positions = getEventPosition(ev);
- var gridpos = positions.gridPos;
- var datapos = positions.dataPos;
- c._zoom.gridpos = gridpos;
- c._zoom.datapos = datapos;
- c._zoom.zooming = true;
- var xpos = gridpos.x;
- var ypos = gridpos.y;
- var height = ctx.canvas.height;
- var width = ctx.canvas.width;
- if (c.showTooltip && !c.onGrid && c.showTooltipOutsideZoom) {
- updateTooltip(gridpos, datapos, plot);
- if (c.followMouse) {
- moveTooltip(gridpos, plot);
- }
- }
- if (c.constrainZoomTo == 'x') {
- c._zoom.end = [xpos, height];
- }
- else if (c.constrainZoomTo == 'y') {
- c._zoom.end = [width, ypos];
- }
- else {
- c._zoom.end = [xpos, ypos];
- }
- var sel = window.getSelection;
- if (document.selection && document.selection.empty)
- {
- document.selection.empty();
- }
- else if (sel && !sel().isCollapsed) {
- sel().collapse();
- }
- drawZoomBox.call(c);
- ctx = null;
- }
- }
-
- function handleMouseDown(ev, gridpos, datapos, neighbor, plot) {
- var c = plot.plugins.cursor;
- $(document).one('mouseup.jqplot_cursor', {plot:plot}, handleMouseUp);
- var axes = plot.axes;
- if (document.onselectstart != undefined) {
- c._oldHandlers.onselectstart = document.onselectstart;
- document.onselectstart = function () { return false; };
- }
- if (document.ondrag != undefined) {
- c._oldHandlers.ondrag = document.ondrag;
- document.ondrag = function () { return false; };
- }
- if (document.onmousedown != undefined) {
- c._oldHandlers.onmousedown = document.onmousedown;
- document.onmousedown = function () { return false; };
- }
- if (c.zoom) {
- if (!c.zoomProxy) {
- var ctx = c.zoomCanvas._ctx;
- ctx.clearRect(0,0,ctx.canvas.width, ctx.canvas.height);
- ctx = null;
- }
- if (c.constrainZoomTo == 'x') {
- c._zoom.start = [gridpos.x, 0];
- }
- else if (c.constrainZoomTo == 'y') {
- c._zoom.start = [0, gridpos.y];
- }
- else {
- c._zoom.start = [gridpos.x, gridpos.y];
- }
- c._zoom.started = true;
- for (var ax in datapos) {
- // get zoom starting position.
- c._zoom.axes.start[ax] = datapos[ax];
- }
- $(document).bind('mousemove.jqplotCursor', {plot:plot}, handleZoomMove);
- }
- }
-
- function handleMouseUp(ev) {
- var plot = ev.data.plot;
- var c = plot.plugins.cursor;
- if (c.zoom && c._zoom.zooming && !c.zoomTarget) {
- var xpos = c._zoom.gridpos.x;
- var ypos = c._zoom.gridpos.y;
- var datapos = c._zoom.datapos;
- var height = c.zoomCanvas._ctx.canvas.height;
- var width = c.zoomCanvas._ctx.canvas.width;
- var axes = plot.axes;
-
- if (c.constrainOutsideZoom && !c.onGrid) {
- if (xpos < 0) { xpos = 0; }
- else if (xpos > width) { xpos = width; }
- if (ypos < 0) { ypos = 0; }
- else if (ypos > height) { ypos = height; }
-
- for (var axis in datapos) {
- if (datapos[axis]) {
- if (axis.charAt(0) == 'x') {
- datapos[axis] = axes[axis].series_p2u(xpos);
- }
- else {
- datapos[axis] = axes[axis].series_p2u(ypos);
- }
- }
- }
- }
-
- if (c.constrainZoomTo == 'x') {
- ypos = height;
- }
- else if (c.constrainZoomTo == 'y') {
- xpos = width;
- }
- c._zoom.end = [xpos, ypos];
- c._zoom.gridpos = {x:xpos, y:ypos};
-
- c.doZoom(c._zoom.gridpos, datapos, plot, c);
- }
- c._zoom.started = false;
- c._zoom.zooming = false;
-
- $(document).unbind('mousemove.jqplotCursor', handleZoomMove);
-
- if (document.onselectstart != undefined && c._oldHandlers.onselectstart != null){
- document.onselectstart = c._oldHandlers.onselectstart;
- c._oldHandlers.onselectstart = null;
- }
- if (document.ondrag != undefined && c._oldHandlers.ondrag != null){
- document.ondrag = c._oldHandlers.ondrag;
- c._oldHandlers.ondrag = null;
- }
- if (document.onmousedown != undefined && c._oldHandlers.onmousedown != null){
- document.onmousedown = c._oldHandlers.onmousedown;
- c._oldHandlers.onmousedown = null;
- }
-
- }
-
- function drawZoomBox() {
- var start = this._zoom.start;
- var end = this._zoom.end;
- var ctx = this.zoomCanvas._ctx;
- var l, t, h, w;
- if (end[0] > start[0]) {
- l = start[0];
- w = end[0] - start[0];
- }
- else {
- l = end[0];
- w = start[0] - end[0];
- }
- if (end[1] > start[1]) {
- t = start[1];
- h = end[1] - start[1];
- }
- else {
- t = end[1];
- h = start[1] - end[1];
- }
- ctx.fillStyle = 'rgba(0,0,0,0.2)';
- ctx.strokeStyle = '#999999';
- ctx.lineWidth = 1.0;
- ctx.clearRect(0,0,ctx.canvas.width, ctx.canvas.height);
- ctx.fillRect(0,0,ctx.canvas.width, ctx.canvas.height);
- ctx.clearRect(l, t, w, h);
- // IE won't show transparent fill rect, so stroke a rect also.
- ctx.strokeRect(l,t,w,h);
- ctx = null;
- }
-
- $.jqplot.CursorLegendRenderer = function(options) {
- $.jqplot.TableLegendRenderer.call(this, options);
- this.formatString = '%s';
- };
-
- $.jqplot.CursorLegendRenderer.prototype = new $.jqplot.TableLegendRenderer();
- $.jqplot.CursorLegendRenderer.prototype.constructor = $.jqplot.CursorLegendRenderer;
-
- // called in context of a Legend
- $.jqplot.CursorLegendRenderer.prototype.draw = function() {
- if (this._elem) {
- this._elem.emptyForce();
- this._elem = null;
- }
- if (this.show) {
- var series = this._series, s;
- // make a table. one line label per row.
- var elem = document.createElement('div');
- this._elem = $(elem);
- elem = null;
- this._elem.addClass('jqplot-legend jqplot-cursor-legend');
- this._elem.css('position', 'absolute');
-
- var pad = false;
- for (var i = 0; i< series.length; i++) {
- s = series[i];
- if (s.show && s.showLabel) {
- var lt = $.jqplot.sprintf(this.formatString, s.label.toString());
- if (lt) {
- var color = s.color;
- if (s._stack && !s.fill) {
- color = '';
- }
- addrow.call(this, lt, color, pad, i);
- pad = true;
- }
- // let plugins add more rows to legend. Used by trend line plugin.
- for (var j=0; j<$.jqplot.addLegendRowHooks.length; j++) {
- var item = $.jqplot.addLegendRowHooks[j].call(this, s);
- if (item) {
- addrow.call(this, item.label, item.color, pad);
- pad = true;
- }
- }
- }
- }
- series = s = null;
- delete series;
- delete s;
- }
-
- function addrow(label, color, pad, idx) {
- var rs = (pad) ? this.rowSpacing : '0';
- var tr = $(' ').appendTo(this._elem);
- tr.data('seriesIndex', idx);
- $(''+
- ' ').appendTo(tr);
- var td = $(' ');
- td.appendTo(tr);
- td.data('seriesIndex', idx);
- if (this.escapeHtml) {
- td.text(label);
- }
- else {
- td.html(label);
- }
- tr = null;
- td = null;
- }
- return this._elem;
- };
-
-})(jQuery);
\ No newline at end of file
diff --git a/libreplan-webapp/src/main/webapp/jqplot/plugins/jqplot.cursor.min.js b/libreplan-webapp/src/main/webapp/jqplot/plugins/jqplot.cursor.min.js
deleted file mode 100644
index ef71ea405..000000000
--- a/libreplan-webapp/src/main/webapp/jqplot/plugins/jqplot.cursor.min.js
+++ /dev/null
@@ -1,57 +0,0 @@
-/**
- * jqPlot
- * Pure JavaScript plotting plugin using jQuery
- *
- * Version: 1.0.0b2_r1012
- *
- * Copyright (c) 2009-2011 Chris Leonello
- * jqPlot is currently available for use in all personal or commercial projects
- * under both the MIT (http://www.opensource.org/licenses/mit-license.php) and GPL
- * version 2.0 (http://www.gnu.org/licenses/gpl-2.0.html) licenses. This means that you can
- * choose the license that best suits your project and use it accordingly.
- *
- * Although not required, the author would appreciate an email letting him
- * know of any substantial use of jqPlot. You can reach the author at:
- * chris at jqplot dot com or see http://www.jqplot.com/info.php .
- *
- * If you are feeling kind and generous, consider supporting the project by
- * making a donation at: http://www.jqplot.com/donate.php .
- *
- * sprintf functions contained in jqplot.sprintf.js by Ash Searle:
- *
- * version 2007.04.27
- * author Ash Searle
- * http://hexmen.com/blog/2007/03/printf-sprintf/
- * http://hexmen.com/js/sprintf.js
- * The author (Ash Searle) has placed this code in the public domain:
- * "This code is unrestricted: you are free to use it however you like."
- *
- * included jsDate library by Chris Leonello:
- *
- * Copyright (c) 2010-2011 Chris Leonello
- *
- * jsDate is currently available for use in all personal or commercial projects
- * under both the MIT and GPL version 2.0 licenses. This means that you can
- * choose the license that best suits your project and use it accordingly.
- *
- * jsDate borrows many concepts and ideas from the Date Instance
- * Methods by Ken Snyder along with some parts of Ken's actual code.
- *
- * Ken's origianl Date Instance Methods and copyright notice:
- *
- * Ken Snyder (ken d snyder at gmail dot com)
- * 2008-09-10
- * version 2.0.2 (http://kendsnyder.com/sandbox/date/)
- * Creative Commons Attribution License 3.0 (http://creativecommons.org/licenses/by/3.0/)
- *
- * jqplotToImage function based on Larry Siden's export-jqplot-to-png.js.
- * Larry has generously given permission to adapt his code for inclusion
- * into jqPlot.
- *
- * Larry's original code can be found here:
- *
- * https://github.com/lsiden/export-jqplot-to-png
- *
- *
- */
-(function(j){j.jqplot.Cursor=function(q){this.style="crosshair";this.previousCursor="auto";this.show=j.jqplot.config.enablePlugins;this.showTooltip=true;this.followMouse=false;this.tooltipLocation="se";this.tooltipOffset=6;this.showTooltipGridPosition=false;this.showTooltipUnitPosition=true;this.showTooltipDataPosition=false;this.tooltipFormatString="%.4P, %.4P";this.useAxesFormatters=true;this.tooltipAxisGroups=[];this.zoom=false;this.zoomProxy=false;this.zoomTarget=false;this.looseZoom=true;this.clickReset=false;this.dblClickReset=true;this.showVerticalLine=false;this.showHorizontalLine=false;this.constrainZoomTo="none";this.shapeRenderer=new j.jqplot.ShapeRenderer();this._zoom={start:[],end:[],started:false,zooming:false,isZoomed:false,axes:{start:{},end:{}},gridpos:{},datapos:{}};this._tooltipElem;this.zoomCanvas;this.cursorCanvas;this.intersectionThreshold=2;this.showCursorLegend=false;this.cursorLegendFormatString=j.jqplot.Cursor.cursorLegendFormatString;this._oldHandlers={onselectstart:null,ondrag:null,onmousedown:null};this.constrainOutsideZoom=true;this.showTooltipOutsideZoom=false;this.onGrid=false;j.extend(true,this,q)};j.jqplot.Cursor.cursorLegendFormatString="%s x:%s, y:%s";j.jqplot.Cursor.init=function(t,s,r){var q=r||{};this.plugins.cursor=new j.jqplot.Cursor(q.cursor);var u=this.plugins.cursor;if(u.show){j.jqplot.eventListenerHooks.push(["jqplotMouseEnter",b]);j.jqplot.eventListenerHooks.push(["jqplotMouseLeave",f]);j.jqplot.eventListenerHooks.push(["jqplotMouseMove",i]);if(u.showCursorLegend){r.legend=r.legend||{};r.legend.renderer=j.jqplot.CursorLegendRenderer;r.legend.formatString=this.plugins.cursor.cursorLegendFormatString;r.legend.show=true}if(u.zoom){j.jqplot.eventListenerHooks.push(["jqplotMouseDown",a]);if(u.clickReset){j.jqplot.eventListenerHooks.push(["jqplotClick",k])}if(u.dblClickReset){j.jqplot.eventListenerHooks.push(["jqplotDblClick",c])}}this.resetZoom=function(){var x=this.axes;if(!u.zoomProxy){for(var w in x){x[w].reset();x[w]._ticks=[];if(u._zoom.axes[w]!==undefined){x[w]._autoFormatString=u._zoom.axes[w].tickFormatString}}this.redraw()}else{var v=this.plugins.cursor.zoomCanvas._ctx;v.clearRect(0,0,v.canvas.width,v.canvas.height);v=null}this.plugins.cursor._zoom.isZoomed=false;this.target.trigger("jqplotResetZoom",[this,this.plugins.cursor])};if(u.showTooltipDataPosition){u.showTooltipUnitPosition=false;u.showTooltipGridPosition=false;if(q.cursor.tooltipFormatString==undefined){u.tooltipFormatString=j.jqplot.Cursor.cursorLegendFormatString}}}};j.jqplot.Cursor.postDraw=function(){var x=this.plugins.cursor;if(x.zoomCanvas){x.zoomCanvas.resetCanvas();x.zoomCanvas=null}if(x.cursorCanvas){x.cursorCanvas.resetCanvas();x.cursorCanvas=null}if(x._tooltipElem){x._tooltipElem.emptyForce();x._tooltipElem=null}if(x.zoom){x.zoomCanvas=new j.jqplot.GenericCanvas();this.eventCanvas._elem.before(x.zoomCanvas.createElement(this._gridPadding,"jqplot-zoom-canvas",this._plotDimensions,this));x.zoomCanvas.setContext()}var v=document.createElement("div");x._tooltipElem=j(v);v=null;x._tooltipElem.addClass("jqplot-cursor-tooltip");x._tooltipElem.css({position:"absolute",display:"none"});if(x.zoomCanvas){x.zoomCanvas._elem.before(x._tooltipElem)}else{this.eventCanvas._elem.before(x._tooltipElem)}if(x.showVerticalLine||x.showHorizontalLine){x.cursorCanvas=new j.jqplot.GenericCanvas();this.eventCanvas._elem.before(x.cursorCanvas.createElement(this._gridPadding,"jqplot-cursor-canvas",this._plotDimensions,this));x.cursorCanvas.setContext()}if(x.showTooltipUnitPosition){if(x.tooltipAxisGroups.length===0){var t=this.series;var u;var q=[];for(var r=0;r6&&Math.abs(G.y-I._zoom.start[1])>6)||(I.constrainZoomTo=="x"&&Math.abs(G.x-I._zoom.start[0])>6)||(I.constrainZoomTo=="y"&&Math.abs(G.y-I._zoom.start[1])>6)){if(!C.plugins.cursor.zoomProxy){for(var y in t){if(I._zoom.axes[y]==undefined){I._zoom.axes[y]={};I._zoom.axes[y].numberTicks=F[y].numberTicks;I._zoom.axes[y].tickInterval=F[y].tickInterval;I._zoom.axes[y].daTickInterval=F[y].daTickInterval;I._zoom.axes[y].min=F[y].min;I._zoom.axes[y].max=F[y].max;I._zoom.axes[y].tickFormatString=(F[y].tickOptions!=null)?F[y].tickOptions.formatString:""}if((I.constrainZoomTo=="none")||(I.constrainZoomTo=="x"&&y.charAt(0)=="x")||(I.constrainZoomTo=="y"&&y.charAt(0)=="y")){z=t[y];if(z!=null){if(z>w[y]){v=w[y];x=z}else{D=w[y]-z;v=z;x=w[y]}q=F[y];H=null;if(q.alignTicks){if(q.name==="x2axis"&&C.axes.xaxis.show){H=C.axes.xaxis.numberTicks}else{if(q.name.charAt(0)==="y"&&q.name!=="yaxis"&&q.name!=="yMidAxis"&&C.axes.yaxis.show){H=C.axes.yaxis.numberTicks}}}if(this.looseZoom&&(F[y].renderer.constructor===j.jqplot.LinearAxisRenderer||F[y].renderer.constructor===j.jqplot.LogAxisRenderer)){J=j.jqplot.LinearTickGenerator(v,x,q._scalefact,H);if(F[y].tickInset&&J[0]F[y].max-F[y].tickInset*F[y].tickInterval){J[1]-=J[4];J[2]-=1}if(F[y].renderer.constructor===j.jqplot.LogAxisRenderer&&J[0] "}if(G.useAxesFormatters){var A=B.axes[D[0]]._ticks[0].formatter;var q=B.axes[D[1]]._ticks[0].formatter;var H=B.axes[D[0]]._ticks[0].formatString;var v=B.axes[D[1]]._ticks[0].formatString;w+=A(H,r[D[0]])+", "+q(v,r[D[1]])}else{w+=j.jqplot.sprintf(G.tooltipFormatString,r[D[0]],r[D[1]])}K=true}}if(G.showTooltipDataPosition){var u=B.series;var J=d(B,E.x,E.y);var K=false;for(var C=0;C "}w+=j.jqplot.sprintf(G.tooltipFormatString,t,z,x);K=true}}}}G._tooltipElem.html(w)}function g(C,A){var E=A.plugins.cursor;var z=E.cursorCanvas._ctx;z.clearRect(0,0,z.canvas.width,z.canvas.height);if(E.showVerticalLine){E.shapeRenderer.draw(z,[[C.x,0],[C.x,z.canvas.height]])}if(E.showHorizontalLine){E.shapeRenderer.draw(z,[[0,C.y],[z.canvas.width,C.y]])}var G=d(A,C.x,C.y);if(E.showCursorLegend){var r=j(A.targetId+" td.jqplot-cursor-legend-label");for(var B=0;B0;r--){s=v[r-1];if(q[s].show){u[s]=q[s].series_p2u(w[s.charAt(0)])}}return{offsets:t,gridPos:w,dataPos:u}}function h(z){var x=z.data.plot;var y=x.plugins.cursor;if(y.show&&y.zoom&&y._zoom.started&&!y.zoomTarget){var B=y.zoomCanvas._ctx;var v=o(z);var w=v.gridPos;var t=v.dataPos;y._zoom.gridpos=w;y._zoom.datapos=t;y._zoom.zooming=true;var u=w.x;var s=w.y;var A=B.canvas.height;var q=B.canvas.width;if(y.showTooltip&&!y.onGrid&&y.showTooltipOutsideZoom){e(w,t,x);if(y.followMouse){n(w,x)}}if(y.constrainZoomTo=="x"){y._zoom.end=[u,A]}else{if(y.constrainZoomTo=="y"){y._zoom.end=[q,s]}else{y._zoom.end=[u,s]}}var r=window.getSelection;if(document.selection&&document.selection.empty){document.selection.empty()}else{if(r&&!r().isCollapsed){r().collapse()}}l.call(y);B=null}}function a(w,s,r,x,t){var v=t.plugins.cursor;j(document).one("mouseup.jqplot_cursor",{plot:t},p);var u=t.axes;if(document.onselectstart!=undefined){v._oldHandlers.onselectstart=document.onselectstart;document.onselectstart=function(){return false}}if(document.ondrag!=undefined){v._oldHandlers.ondrag=document.ondrag;document.ondrag=function(){return false}}if(document.onmousedown!=undefined){v._oldHandlers.onmousedown=document.onmousedown;document.onmousedown=function(){return false}}if(v.zoom){if(!v.zoomProxy){var y=v.zoomCanvas._ctx;y.clearRect(0,0,y.canvas.width,y.canvas.height);y=null}if(v.constrainZoomTo=="x"){v._zoom.start=[s.x,0]}else{if(v.constrainZoomTo=="y"){v._zoom.start=[0,s.y]}else{v._zoom.start=[s.x,s.y]}}v._zoom.started=true;for(var q in r){v._zoom.axes.start[q]=r[q]}j(document).bind("mousemove.jqplotCursor",{plot:t},h)}}function p(y){var v=y.data.plot;var x=v.plugins.cursor;if(x.zoom&&x._zoom.zooming&&!x.zoomTarget){var u=x._zoom.gridpos.x;var r=x._zoom.gridpos.y;var t=x._zoom.datapos;var z=x.zoomCanvas._ctx.canvas.height;var q=x.zoomCanvas._ctx.canvas.width;var w=v.axes;if(x.constrainOutsideZoom&&!x.onGrid){if(u<0){u=0}else{if(u>q){u=q}}if(r<0){r=0}else{if(r>z){r=z}}for(var s in t){if(t[s]){if(s.charAt(0)=="x"){t[s]=w[s].series_p2u(u)}else{t[s]=w[s].series_p2u(r)}}}}if(x.constrainZoomTo=="x"){r=z}else{if(x.constrainZoomTo=="y"){u=q}}x._zoom.end=[u,r];x._zoom.gridpos={x:u,y:r};x.doZoom(x._zoom.gridpos,t,v,x)}x._zoom.started=false;x._zoom.zooming=false;j(document).unbind("mousemove.jqplotCursor",h);if(document.onselectstart!=undefined&&x._oldHandlers.onselectstart!=null){document.onselectstart=x._oldHandlers.onselectstart;x._oldHandlers.onselectstart=null}if(document.ondrag!=undefined&&x._oldHandlers.ondrag!=null){document.ondrag=x._oldHandlers.ondrag;x._oldHandlers.ondrag=null}if(document.onmousedown!=undefined&&x._oldHandlers.onmousedown!=null){document.onmousedown=x._oldHandlers.onmousedown;x._oldHandlers.onmousedown=null}}function l(){var y=this._zoom.start;var u=this._zoom.end;var s=this.zoomCanvas._ctx;var r,v,x,q;if(u[0]>y[0]){r=y[0];q=u[0]-y[0]}else{r=u[0];q=y[0]-u[0]}if(u[1]>y[1]){v=y[1];x=u[1]-y[1]}else{v=u[1];x=y[1]-u[1]}s.fillStyle="rgba(0,0,0,0.2)";s.strokeStyle="#999999";s.lineWidth=1;s.clearRect(0,0,s.canvas.width,s.canvas.height);s.fillRect(0,0,s.canvas.width,s.canvas.height);s.clearRect(r,v,q,x);s.strokeRect(r,v,q,x);s=null}j.jqplot.CursorLegendRenderer=function(q){j.jqplot.TableLegendRenderer.call(this,q);this.formatString="%s"};j.jqplot.CursorLegendRenderer.prototype=new j.jqplot.TableLegendRenderer();j.jqplot.CursorLegendRenderer.prototype.constructor=j.jqplot.CursorLegendRenderer;j.jqplot.CursorLegendRenderer.prototype.draw=function(){if(this._elem){this._elem.emptyForce();this._elem=null}if(this.show){var w=this._series,A;var r=document.createElement("div");this._elem=j(r);r=null;this._elem.addClass("jqplot-legend jqplot-cursor-legend");this._elem.css("position","absolute");var q=false;for(var x=0;x').appendTo(this._elem);E.data("seriesIndex",s);j(' ').appendTo(E);var G=j(' ');G.appendTo(E);G.data("seriesIndex",s);if(this.escapeHtml){G.text(D)}else{G.html(D)}E=null;G=null}return this._elem}})(jQuery);
\ No newline at end of file
diff --git a/libreplan-webapp/src/main/webapp/jqplot/plugins/jqplot.dateAxisRenderer.js b/libreplan-webapp/src/main/webapp/jqplot/plugins/jqplot.dateAxisRenderer.js
deleted file mode 100644
index f09fc5443..000000000
--- a/libreplan-webapp/src/main/webapp/jqplot/plugins/jqplot.dateAxisRenderer.js
+++ /dev/null
@@ -1,702 +0,0 @@
-/**
- * jqPlot
- * Pure JavaScript plotting plugin using jQuery
- *
- * Version: 1.0.0b2_r1012
- *
- * Copyright (c) 2009-2011 Chris Leonello
- * jqPlot is currently available for use in all personal or commercial projects
- * under both the MIT (http://www.opensource.org/licenses/mit-license.php) and GPL
- * version 2.0 (http://www.gnu.org/licenses/gpl-2.0.html) licenses. This means that you can
- * choose the license that best suits your project and use it accordingly.
- *
- * Although not required, the author would appreciate an email letting him
- * know of any substantial use of jqPlot. You can reach the author at:
- * chris at jqplot dot com or see http://www.jqplot.com/info.php .
- *
- * If you are feeling kind and generous, consider supporting the project by
- * making a donation at: http://www.jqplot.com/donate.php .
- *
- * sprintf functions contained in jqplot.sprintf.js by Ash Searle:
- *
- * version 2007.04.27
- * author Ash Searle
- * http://hexmen.com/blog/2007/03/printf-sprintf/
- * http://hexmen.com/js/sprintf.js
- * The author (Ash Searle) has placed this code in the public domain:
- * "This code is unrestricted: you are free to use it however you like."
- *
- */
-(function($) {
- /**
- * Class: $.jqplot.DateAxisRenderer
- * A plugin for a jqPlot to render an axis as a series of date values.
- * This renderer has no options beyond those supplied by the class.
- * It supplies it's own tick formatter, so the tickOptions.formatter option
- * should not be overridden.
- *
- * Thanks to Ken Synder for his enhanced Date instance methods which are
- * included with this code .
- *
- * To use this renderer, include the plugin in your source
- * >
- *
- * and supply the appropriate options to your plot
- *
- * > {axes:{xaxis:{renderer:$.jqplot.DateAxisRenderer}}}
- *
- * Dates can be passed into the axis in almost any recognizable value and
- * will be parsed. They will be rendered on the axis in the format
- * specified by tickOptions.formatString. e.g. tickOptions.formatString = '%Y-%m-%d'.
- *
- * Accecptable format codes
- * are:
- *
- * > Code Result Description
- * > == Years ==
- * > %Y 2008 Four-digit year
- * > %y 08 Two-digit year
- * > == Months ==
- * > %m 09 Two-digit month
- * > %#m 9 One or two-digit month
- * > %B September Full month name
- * > %b Sep Abbreviated month name
- * > == Days ==
- * > %d 05 Two-digit day of month
- * > %#d 5 One or two-digit day of month
- * > %e 5 One or two-digit day of month
- * > %A Sunday Full name of the day of the week
- * > %a Sun Abbreviated name of the day of the week
- * > %w 0 Number of the day of the week (0 = Sunday, 6 = Saturday)
- * > %o th The ordinal suffix string following the day of the month
- * > == Hours ==
- * > %H 23 Hours in 24-hour format (two digits)
- * > %#H 3 Hours in 24-hour integer format (one or two digits)
- * > %I 11 Hours in 12-hour format (two digits)
- * > %#I 3 Hours in 12-hour integer format (one or two digits)
- * > %p PM AM or PM
- * > == Minutes ==
- * > %M 09 Minutes (two digits)
- * > %#M 9 Minutes (one or two digits)
- * > == Seconds ==
- * > %S 02 Seconds (two digits)
- * > %#S 2 Seconds (one or two digits)
- * > %s 1206567625723 Unix timestamp (Seconds past 1970-01-01 00:00:00)
- * > == Milliseconds ==
- * > %N 008 Milliseconds (three digits)
- * > %#N 8 Milliseconds (one to three digits)
- * > == Timezone ==
- * > %O 360 difference in minutes between local time and GMT
- * > %Z Mountain Standard Time Name of timezone as reported by browser
- * > %G -06:00 Hours and minutes between GMT
- * > == Shortcuts ==
- * > %F 2008-03-26 %Y-%m-%d
- * > %T 05:06:30 %H:%M:%S
- * > %X 05:06:30 %H:%M:%S
- * > %x 03/26/08 %m/%d/%y
- * > %D 03/26/08 %m/%d/%y
- * > %#c Wed Mar 26 15:31:00 2008 %a %b %e %H:%M:%S %Y
- * > %v 3-Sep-2008 %e-%b-%Y
- * > %R 15:31 %H:%M
- * > %r 3:31:00 PM %I:%M:%S %p
- * > == Characters ==
- * > %n \n Newline
- * > %t \t Tab
- * > %% % Percent Symbol
- */
- $.jqplot.DateAxisRenderer = function() {
- $.jqplot.LinearAxisRenderer.call(this);
- this.date = new $.jsDate();
- };
-
- var second = 1000;
- var minute = 60 * second;
- var hour = 60 * minute;
- var day = 24 * hour;
- var week = 7 * day;
-
- // these are less definitive
- var month = 30.4368499 * day;
- var year = 365.242199 * day;
-
- var daysInMonths = [31,28,31,30,31,30,31,30,31,30,31,30];
- // array of consistent nice intervals. Longer intervals
- // will depend on days in month, days in year, etc.
- var niceFormatStrings = ['%M:%S.%#N', '%M:%S.%#N', '%M:%S.%#N', '%M:%S', '%M:%S', '%M:%S', '%M:%S', '%H:%M:%S', '%H:%M:%S', '%H:%M', '%H:%M', '%H:%M', '%H:%M', '%H:%M', '%H:%M', '%a %H:%M', '%a %H:%M', '%b %e %H:%M', '%b %e %H:%M', '%b %e %H:%M', '%b %e %H:%M', '%v', '%v', '%v', '%v', '%v', '%v', '%v'];
- var niceIntervals = [0.1*second, 0.2*second, 0.5*second, second, 2*second, 5*second, 10*second, 15*second, 30*second, minute, 2*minute, 5*minute, 10*minute, 15*minute, 30*minute, hour, 2*hour, 4*hour, 6*hour, 8*hour, 12*hour, day, 2*day, 3*day, 4*day, 5*day, week, 2*week];
-
- var niceMonthlyIntervals = [];
-
- function bestDateInterval(min, max, titarget) {
- // iterate through niceIntervals to find one closest to titarget
- var badness = Number.MAX_VALUE;
- var temp, bestTi, bestfmt;
- for (var i=0, l=niceIntervals.length; i < l; i++) {
- temp = Math.abs(titarget - niceIntervals[i]);
- if (temp < badness) {
- badness = temp;
- bestTi = niceIntervals[i];
- bestfmt = niceFormatStrings[i];
- }
- }
-
- return [bestTi, bestfmt];
- }
-
- $.jqplot.DateAxisRenderer.prototype = new $.jqplot.LinearAxisRenderer();
- $.jqplot.DateAxisRenderer.prototype.constructor = $.jqplot.DateAxisRenderer;
-
- $.jqplot.DateTickFormatter = function(format, val) {
- if (!format) {
- format = '%Y/%m/%d';
- }
- return $.jsDate.strftime(val, format);
- };
-
- $.jqplot.DateAxisRenderer.prototype.init = function(options){
- // prop: tickRenderer
- // A class of a rendering engine for creating the ticks labels displayed on the plot,
- // See <$.jqplot.AxisTickRenderer>.
- // this.tickRenderer = $.jqplot.AxisTickRenderer;
- // this.labelRenderer = $.jqplot.AxisLabelRenderer;
- this.tickOptions.formatter = $.jqplot.DateTickFormatter;
- // prop: tickInset
- // Controls the amount to inset the first and last ticks from
- // the edges of the grid, in multiples of the tick interval.
- // 0 is no inset, 0.5 is one half a tick interval, 1 is a full
- // tick interval, etc.
- this.tickInset = 0;
- // prop: drawBaseline
- // True to draw the axis baseline.
- this.drawBaseline = true;
- // prop: baselineWidth
- // width of the baseline in pixels.
- this.baselineWidth = null;
- // prop: baselineColor
- // CSS color spec for the baseline.
- this.baselineColor = null;
- this.daTickInterval = null;
- this._daTickInterval = null;
-
- $.extend(true, this, options);
-
- var db = this._dataBounds,
- stats,
- sum,
- s,
- d,
- pd,
- sd,
- intv;
-
- // Go through all the series attached to this axis and find
- // the min/max bounds for this axis.
- for (var i=0; i db.max) || db.max == null) {
- db.max = d[j][0];
- }
- if (j>0) {
- intv = Math.abs(d[j][0] - d[j-1][0]);
- stats.intervals.push(intv);
- if (stats.frequencies.hasOwnProperty(intv)) {
- stats.frequencies[intv] += 1;
- }
- else {
- stats.frequencies[intv] = 1;
- }
- }
- sum += intv;
-
- }
- else {
- d[j][1] = new $.jsDate(d[j][1]).getTime();
- pd[j][1] = new $.jsDate(d[j][1]).getTime();
- sd[j][1] = new $.jsDate(d[j][1]).getTime();
- if ((d[j][1] != null && d[j][1] < db.min) || db.min == null) {
- db.min = d[j][1];
- }
- if ((d[j][1] != null && d[j][1] > db.max) || db.max == null) {
- db.max = d[j][1];
- }
- if (j>0) {
- intv = Math.abs(d[j][1] - d[j-1][1]);
- stats.intervals.push(intv);
- if (stats.frequencies.hasOwnProperty(intv)) {
- stats.frequencies[intv] += 1;
- }
- else {
- stats.frequencies[intv] = 1;
- }
- }
- }
- sum += intv;
- }
-
- if (s.renderer.bands) {
- if (s.renderer.bands.hiData.length) {
- var bd = s.renderer.bands.hiData;
- for (var j=0, l=bd.length; j < l; j++) {
- if (this.name === 'xaxis' || this.name === 'x2axis') {
- bd[j][0] = new $.jsDate(bd[j][0]).getTime();
- if ((bd[j][0] != null && bd[j][0] > db.max) || db.max == null) {
- db.max = bd[j][0];
- }
- }
- else {
- bd[j][1] = new $.jsDate(bd[j][1]).getTime();
- if ((bd[j][1] != null && bd[j][1] > db.max) || db.max == null) {
- db.max = bd[j][1];
- }
- }
- }
- }
- if (s.renderer.bands.lowData.length) {
- var bd = s.renderer.bands.lowData;
- for (var j=0, l=bd.length; j < l; j++) {
- if (this.name === 'xaxis' || this.name === 'x2axis') {
- bd[j][0] = new $.jsDate(bd[j][0]).getTime();
- if ((bd[j][0] != null && bd[j][0] < db.min) || db.min == null) {
- db.min = bd[j][0];
- }
- }
- else {
- bd[j][1] = new $.jsDate(bd[j][1]).getTime();
- if ((bd[j][1] != null && bd[j][1] < db.min) || db.min == null) {
- db.min = bd[j][1];
- }
- }
- }
- }
- }
-
- var tempf = 0,
- tempn=0;
- for (var n in stats.frequencies) {
- stats.sortedIntervals.push({interval:n, frequency:stats.frequencies[n]});
- }
- stats.sortedIntervals.sort(function(a, b){
- return b.frequency - a.frequency;
- });
-
- stats.min = $.jqplot.arrayMin(stats.intervals);
- stats.max = $.jqplot.arrayMax(stats.intervals);
- stats.mean = sum/d.length;
- this._intervalStats.push(stats);
- stats = sum = s = d = pd = sd = null;
- }
- db = null;
-
- };
-
- // called with scope of an axis
- $.jqplot.DateAxisRenderer.prototype.reset = function() {
- this.min = this._options.min;
- this.max = this._options.max;
- this.tickInterval = this._options.tickInterval;
- this.numberTicks = this._options.numberTicks;
- this._autoFormatString = '';
- if (this._overrideFormatString && this.tickOptions && this.tickOptions.formatString) {
- this.tickOptions.formatString = '';
- }
- this.daTickInterval = this._daTickInterval;
- // this._ticks = this.__ticks;
- };
-
- $.jqplot.DateAxisRenderer.prototype.createTicks = function(plot) {
- // we're are operating on an axis here
- var ticks = this._ticks;
- var userTicks = this.ticks;
- var name = this.name;
- // databounds were set on axis initialization.
- var db = this._dataBounds;
- var iv = this._intervalStats;
- var dim = (this.name.charAt(0) === 'x') ? this._plotDimensions.width : this._plotDimensions.height;
- var interval;
- var min, max;
- var pos1, pos2;
- var tt, i;
- var threshold = 30;
- var insetMult = 1;
-
- var tickInterval = this.tickInterval;
-
- // if we already have ticks, use them.
- // ticks must be in order of increasing value.
-
- min = ((this.min != null) ? new $.jsDate(this.min).getTime() : db.min);
- max = ((this.max != null) ? new $.jsDate(this.max).getTime() : db.max);
-
- // see if we're zooming. if we are, don't use the min and max we're given,
- // but compute some nice ones. They will be reset later.
-
- var cursor = plot.plugins.cursor;
-
- if (cursor && cursor._zoom && cursor._zoom.zooming) {
- this.min = null;
- this.max = null;
- }
-
- var range = max - min;
-
- if (this.tickOptions == null || !this.tickOptions.formatString) {
- this._overrideFormatString = true;
- }
-
- if (userTicks.length) {
- // ticks could be 1D or 2D array of [val, val, ,,,] or [[val, label], [val, label], ...] or mixed
- for (i=0; i 6) {
- intv = 6;
- }
-
- // figure out the starting month and ending month.
- var mstart = new $.jsDate(min).setDate(1).setHours(0,0,0,0);
-
- // See if max ends exactly on a month
- var tempmend = new $.jsDate(max);
- var mend = new $.jsDate(max).setDate(1).setHours(0,0,0,0);
-
- if (tempmend.getTime() !== mend.getTime()) {
- mend = mend.add(1, 'month');
- }
-
- var nmonths = mend.diff(mstart, 'month');
-
- nttarget = Math.ceil(nmonths/intv) + 1;
-
- this.min = mstart.getTime();
- this.max = mstart.clone().add((nttarget - 1) * intv, 'month').getTime();
- this.numberTicks = nttarget;
-
- for (var i=0; i 200) {
- this.numberTicks = parseInt(3+(dim-200)/100, 10);
- }
- else {
- this.numberTicks = 2;
- }
- }
-
- insetMult = range / (this.numberTicks-1)/1000;
-
- if (this.daTickInterval == null) {
- this.daTickInterval = [insetMult, 'seconds'];
- }
-
-
- for (var i=0; iC.max)||C.max==null){C.max=y[r][0]}if(r>0){o=Math.abs(y[r][0]-y[r-1][0]);u.intervals.push(o);if(u.frequencies.hasOwnProperty(o)){u.frequencies[o]+=1}else{u.frequencies[o]=1}}x+=o}else{y[r][1]=new h.jsDate(y[r][1]).getTime();A[r][1]=new h.jsDate(y[r][1]).getTime();z[r][1]=new h.jsDate(y[r][1]).getTime();if((y[r][1]!=null&&y[r][1]C.max)||C.max==null){C.max=y[r][1]}if(r>0){o=Math.abs(y[r][1]-y[r-1][1]);u.intervals.push(o);if(u.frequencies.hasOwnProperty(o)){u.frequencies[o]+=1}else{u.frequencies[o]=1}}}x+=o}if(D.renderer.bands){if(D.renderer.bands.hiData.length){var w=D.renderer.bands.hiData;for(var r=0,q=w.length;rC.max)||C.max==null){C.max=w[r][0]}}else{w[r][1]=new h.jsDate(w[r][1]).getTime();if((w[r][1]!=null&&w[r][1]>C.max)||C.max==null){C.max=w[r][1]}}}}if(D.renderer.bands.lowData.length){var w=D.renderer.bands.lowData;for(var r=0,q=w.length;r6){D=6}}var S=new h.jsDate(ab).setDate(1).setHours(0,0,0,0);var q=new h.jsDate(I);var z=new h.jsDate(I).setDate(1).setHours(0,0,0,0);if(q.getTime()!==z.getTime()){z=z.add(1,"month")}var R=z.diff(S,"month");Y=Math.ceil(R/D)+1;this.min=S.getTime();this.max=S.clone().add((Y-1)*D,"month").getTime();this.numberTicks=Y;for(var X=0;X200){this.numberTicks=parseInt(3+(n-200)/100,10)}else{this.numberTicks=2}}}N=B/(this.numberTicks-1)/1000;if(this.daTickInterval==null){this.daTickInterval=[N,"seconds"]}for(var X=0;X
- *
- * Properties described here are passed into the $.jqplot function
- * as options on the series renderer. For example:
- *
- * > plot2 = $.jqplot('chart2', [s1, s2], {
- * > seriesDefaults: {
- * > renderer:$.jqplot.DonutRenderer,
- * > rendererOptions:{
- * > sliceMargin: 2,
- * > innerDiameter: 110,
- * > startAngle: -90
- * > }
- * > }
- * > });
- *
- * A donut plot will trigger events on the plot target
- * according to user interaction. All events return the event object,
- * the series index, the point (slice) index, and the point data for
- * the appropriate slice.
- *
- * 'jqplotDataMouseOver' - triggered when user mouseing over a slice.
- * 'jqplotDataHighlight' - triggered the first time user mouses over a slice,
- * if highlighting is enabled.
- * 'jqplotDataUnhighlight' - triggered when a user moves the mouse out of
- * a highlighted slice.
- * 'jqplotDataClick' - triggered when the user clicks on a slice.
- * 'jqplotDataRightClick' - tiggered when the user right clicks on a slice if
- * the "captureRightClick" option is set to true on the plot.
- */
- $.jqplot.DonutRenderer = function(){
- $.jqplot.LineRenderer.call(this);
- };
-
- $.jqplot.DonutRenderer.prototype = new $.jqplot.LineRenderer();
- $.jqplot.DonutRenderer.prototype.constructor = $.jqplot.DonutRenderer;
-
- // called with scope of a series
- $.jqplot.DonutRenderer.prototype.init = function(options, plot) {
- // Group: Properties
- //
- // prop: diameter
- // Outer diameter of the donut, auto computed by default
- this.diameter = null;
- // prop: innerDiameter
- // Inner diameter of the donut, auto calculated by default.
- // If specified will override thickness value.
- this.innerDiameter = null;
- // prop: thickness
- // thickness of the donut, auto computed by default
- // Overridden by if innerDiameter is specified.
- this.thickness = null;
- // prop: padding
- // padding between the donut and plot edges, legend, etc.
- this.padding = 20;
- // prop: sliceMargin
- // angular spacing between donut slices in degrees.
- this.sliceMargin = 0;
- // prop: ringMargin
- // pixel distance between rings, or multiple series in a donut plot.
- // null will compute ringMargin based on sliceMargin.
- this.ringMargin = null;
- // prop: fill
- // true or false, wether to fil the slices.
- this.fill = true;
- // prop: shadowOffset
- // offset of the shadow from the slice and offset of
- // each succesive stroke of the shadow from the last.
- this.shadowOffset = 2;
- // prop: shadowAlpha
- // transparency of the shadow (0 = transparent, 1 = opaque)
- this.shadowAlpha = 0.07;
- // prop: shadowDepth
- // number of strokes to apply to the shadow,
- // each stroke offset shadowOffset from the last.
- this.shadowDepth = 5;
- // prop: highlightMouseOver
- // True to highlight slice when moused over.
- // This must be false to enable highlightMouseDown to highlight when clicking on a slice.
- this.highlightMouseOver = true;
- // prop: highlightMouseDown
- // True to highlight when a mouse button is pressed over a slice.
- // This will be disabled if highlightMouseOver is true.
- this.highlightMouseDown = false;
- // prop: highlightColors
- // an array of colors to use when highlighting a slice.
- this.highlightColors = [];
- // prop: dataLabels
- // Either 'label', 'value', 'percent' or an array of labels to place on the pie slices.
- // Defaults to percentage of each pie slice.
- this.dataLabels = 'percent';
- // prop: showDataLabels
- // true to show data labels on slices.
- this.showDataLabels = false;
- // prop: dataLabelFormatString
- // Format string for data labels. If none, '%s' is used for "label" and for arrays, '%d' for value and '%d%%' for percentage.
- this.dataLabelFormatString = null;
- // prop: dataLabelThreshold
- // Threshhold in percentage (0 - 100) of pie area, below which no label will be displayed.
- // This applies to all label types, not just to percentage labels.
- this.dataLabelThreshold = 3;
- // prop: dataLabelPositionFactor
- // A Multiplier (0-1) of the pie radius which controls position of label on slice.
- // Increasing will slide label toward edge of pie, decreasing will slide label toward center of pie.
- this.dataLabelPositionFactor = 0.4;
- // prop: dataLabelNudge
- // Number of pixels to slide the label away from (+) or toward (-) the center of the pie.
- this.dataLabelNudge = 0;
- // prop: startAngle
- // Angle to start drawing donut in degrees.
- // According to orientation of canvas coordinate system:
- // 0 = on the positive x axis
- // -90 = on the positive y axis.
- // 90 = on the negaive y axis.
- // 180 or - 180 = on the negative x axis.
- this.startAngle = 0;
- this.tickRenderer = $.jqplot.DonutTickRenderer;
- // Used as check for conditions where donut shouldn't be drawn.
- this._drawData = true;
- this._type = 'donut';
-
- // if user has passed in highlightMouseDown option and not set highlightMouseOver, disable highlightMouseOver
- if (options.highlightMouseDown && options.highlightMouseOver == null) {
- options.highlightMouseOver = false;
- }
-
- $.extend(true, this, options);
- if (this.diameter != null) {
- this.diameter = this.diameter - this.sliceMargin;
- }
- this._diameter = null;
- this._innerDiameter = null;
- this._radius = null;
- this._innerRadius = null;
- this._thickness = null;
- // references to the previous series in the plot to properly calculate diameters
- // and thicknesses of nested rings.
- this._previousSeries = [];
- this._numberSeries = 1;
- // array of [start,end] angles arrays, one for each slice. In radians.
- this._sliceAngles = [];
- // index of the currenty highlighted point, if any
- this._highlightedPoint = null;
-
- // set highlight colors if none provided
- if (this.highlightColors.length == 0) {
- for (var i=0; i 570) ? newrgb[j] * 0.8 : newrgb[j] + 0.3 * (255 - newrgb[j]);
- newrgb[j] = parseInt(newrgb[j], 10);
- }
- this.highlightColors.push('rgb('+newrgb[0]+','+newrgb[1]+','+newrgb[2]+')');
- }
- }
-
- plot.postParseOptionsHooks.addOnce(postParseOptions);
- plot.postInitHooks.addOnce(postInit);
- plot.eventListenerHooks.addOnce('jqplotMouseMove', handleMove);
- plot.eventListenerHooks.addOnce('jqplotMouseDown', handleMouseDown);
- plot.eventListenerHooks.addOnce('jqplotMouseUp', handleMouseUp);
- plot.eventListenerHooks.addOnce('jqplotClick', handleClick);
- plot.eventListenerHooks.addOnce('jqplotRightClick', handleRightClick);
- plot.postDrawHooks.addOnce(postPlotDraw);
-
-
- };
-
- $.jqplot.DonutRenderer.prototype.setGridData = function(plot) {
- // set gridData property. This will hold angle in radians of each data point.
- var stack = [];
- var td = [];
- var sa = this.startAngle/180*Math.PI;
- var tot = 0;
- // don't know if we have any valid data yet, so set plot to not draw.
- this._drawData = false;
- for (var i=0; i0) {
- stack[i] += stack[i-1];
- }
- tot += this.data[i][1];
- }
- var fact = Math.PI*2/stack[stack.length - 1];
-
- for (var i=0; i0) {
- stack[i] += stack[i-1];
- }
- tot += data[i][1];
- }
- var fact = Math.PI*2/stack[stack.length - 1];
-
- for (var i=0; i 6.282 + this.startAngle) {
- ang2 = 6.282 + this.startAngle;
- if (ang1 > ang2) {
- ang1 = 6.281 + this.startAngle;
- }
- }
- // Fix for IE, where it can't seem to handle 0 degree angles. Also avoids
- // ugly line on unfilled donuts.
- if (ang1 >= ang2) {
- return;
- }
- ctx.beginPath();
- ctx.fillStyle = color;
- ctx.strokeStyle = color;
- // ctx.lineWidth = lineWidth;
- ctx.arc(0, 0, r, ang1, ang2, false);
- ctx.lineTo(ri*Math.cos(ang2), ri*Math.sin(ang2));
- ctx.arc(0,0, ri, ang2, ang1, true);
- ctx.closePath();
- if (fill) {
- ctx.fill();
- }
- else {
- ctx.stroke();
- }
- }
-
- if (isShadow) {
- for (var i=0; i 1 && this.index > 0) ? this._previousSeries[0]._diameter : this._diameter;
- this._thickness = this.thickness || (od - this.innerDiameter - 2.0*ringmargin*this._numberSeries) / this._numberSeries/2.0;
- }
- else {
- this._thickness = this.thickness || mindim / 2 / (this._numberSeries + 1) * 0.85;
- }
-
- var r = this._radius = this._diameter/2;
- this._innerRadius = this._radius - this._thickness;
- var sa = this.startAngle / 180 * Math.PI;
- this._center = [(cw - trans * offx)/2 + trans * offx, (ch - trans*offy)/2 + trans * offy];
-
- if (this.shadow) {
- var shadowColor = 'rgba(0,0,0,'+this.shadowAlpha+')';
- for (var i=0; i= this.dataLabelThreshold) {
- var fstr, avgang = (ang1+ang2)/2, label;
-
- if (this.dataLabels == 'label') {
- fstr = this.dataLabelFormatString || '%s';
- label = $.jqplot.sprintf(fstr, gd[i][0]);
- }
- else if (this.dataLabels == 'value') {
- fstr = this.dataLabelFormatString || '%d';
- label = $.jqplot.sprintf(fstr, this.data[i][1]);
- }
- else if (this.dataLabels == 'percent') {
- fstr = this.dataLabelFormatString || '%d%%';
- label = $.jqplot.sprintf(fstr, gd[i][2]*100);
- }
- else if (this.dataLabels.constructor == Array) {
- fstr = this.dataLabelFormatString || '%s';
- label = $.jqplot.sprintf(fstr, this.dataLabels[i]);
- }
-
- var fact = this._innerRadius + this._thickness * this.dataLabelPositionFactor + this.sliceMargin + this.dataLabelNudge;
-
- var x = this._center[0] + Math.cos(avgang) * fact + this.canvas._offsets.left;
- var y = this._center[1] + Math.sin(avgang) * fact + this.canvas._offsets.top;
-
- var labelelem = $('' + label + ' ').insertBefore(plot.eventCanvas._elem);
- x -= labelelem.width()/2;
- y -= labelelem.height()/2;
- x = Math.round(x);
- y = Math.round(y);
- labelelem.css({left: x, top: y});
- }
- }
-
- };
-
- $.jqplot.DonutAxisRenderer = function() {
- $.jqplot.LinearAxisRenderer.call(this);
- };
-
- $.jqplot.DonutAxisRenderer.prototype = new $.jqplot.LinearAxisRenderer();
- $.jqplot.DonutAxisRenderer.prototype.constructor = $.jqplot.DonutAxisRenderer;
-
-
- // There are no traditional axes on a donut chart. We just need to provide
- // dummy objects with properties so the plot will render.
- // called with scope of axis object.
- $.jqplot.DonutAxisRenderer.prototype.init = function(options){
- //
- this.tickRenderer = $.jqplot.DonutTickRenderer;
- $.extend(true, this, options);
- // I don't think I'm going to need _dataBounds here.
- // have to go Axis scaling in a way to fit chart onto plot area
- // and provide u2p and p2u functionality for mouse cursor, etc.
- // for convienence set _dataBounds to 0 and 100 and
- // set min/max to 0 and 100.
- this._dataBounds = {min:0, max:100};
- this.min = 0;
- this.max = 100;
- this.showTicks = false;
- this.ticks = [];
- this.showMark = false;
- this.show = false;
- };
-
-
-
-
- $.jqplot.DonutLegendRenderer = function(){
- $.jqplot.TableLegendRenderer.call(this);
- };
-
- $.jqplot.DonutLegendRenderer.prototype = new $.jqplot.TableLegendRenderer();
- $.jqplot.DonutLegendRenderer.prototype.constructor = $.jqplot.DonutLegendRenderer;
-
- /**
- * Class: $.jqplot.DonutLegendRenderer
- * Legend Renderer specific to donut plots. Set by default
- * when user creates a donut plot.
- */
- $.jqplot.DonutLegendRenderer.prototype.init = function(options) {
- // Group: Properties
- //
- // prop: numberRows
- // Maximum number of rows in the legend. 0 or null for unlimited.
- this.numberRows = null;
- // prop: numberColumns
- // Maximum number of columns in the legend. 0 or null for unlimited.
- this.numberColumns = null;
- $.extend(true, this, options);
- };
-
- // called with context of legend
- $.jqplot.DonutLegendRenderer.prototype.draw = function() {
- var legend = this;
- if (this.show) {
- var series = this._series;
- var ss = 'position:absolute;';
- ss += (this.background) ? 'background:'+this.background+';' : '';
- ss += (this.border) ? 'border:'+this.border+';' : '';
- ss += (this.fontSize) ? 'font-size:'+this.fontSize+';' : '';
- ss += (this.fontFamily) ? 'font-family:'+this.fontFamily+';' : '';
- ss += (this.textColor) ? 'color:'+this.textColor+';' : '';
- ss += (this.marginTop != null) ? 'margin-top:'+this.marginTop+';' : '';
- ss += (this.marginBottom != null) ? 'margin-bottom:'+this.marginBottom+';' : '';
- ss += (this.marginLeft != null) ? 'margin-left:'+this.marginLeft+';' : '';
- ss += (this.marginRight != null) ? 'margin-right:'+this.marginRight+';' : '';
- this._elem = $('');
- // Donut charts legends don't go by number of series, but by number of data points
- // in the series. Refactor things here for that.
-
- var pad = false,
- reverse = false,
- nr, nc;
- var s = series[0];
- var colorGenerator = new $.jqplot.ColorGenerator(s.seriesColors);
-
- if (s.show) {
- var pd = s.data;
- if (this.numberRows) {
- nr = this.numberRows;
- if (!this.numberColumns){
- nc = Math.ceil(pd.length/nr);
- }
- else{
- nc = this.numberColumns;
- }
- }
- else if (this.numberColumns) {
- nc = this.numberColumns;
- nr = Math.ceil(pd.length/this.numberColumns);
- }
- else {
- nr = pd.length;
- nc = 1;
- }
-
- var i, j, tr, td1, td2, lt, rs, color;
- var idx = 0;
-
- for (i=0; i').prependTo(this._elem);
- }
- else{
- tr = $(' ').appendTo(this._elem);
- }
- for (j=0; j0){
- pad = true;
- }
- else{
- pad = false;
- }
- }
- else{
- if (i == nr -1){
- pad = false;
- }
- else{
- pad = true;
- }
- }
- rs = (pad) ? this.rowSpacing : '0';
-
- td1 = $(''+
- ' ');
- td2 = $(' ');
- if (this.escapeHtml){
- td2.text(lt);
- }
- else {
- td2.html(lt);
- }
- if (reverse) {
- td2.prependTo(tr);
- td1.prependTo(tr);
- }
- else {
- td1.appendTo(tr);
- td2.appendTo(tr);
- }
- pad = true;
- }
- idx++;
- }
- }
- }
- }
- return this._elem;
- };
-
- // setup default renderers for axes and legend so user doesn't have to
- // called with scope of plot
- function preInit(target, data, options) {
- options = options || {};
- options.axesDefaults = options.axesDefaults || {};
- options.legend = options.legend || {};
- options.seriesDefaults = options.seriesDefaults || {};
- // only set these if there is a donut series
- var setopts = false;
- if (options.seriesDefaults.renderer == $.jqplot.DonutRenderer) {
- setopts = true;
- }
- else if (options.series) {
- for (var i=0; i < options.series.length; i++) {
- if (options.series[i].renderer == $.jqplot.DonutRenderer) {
- setopts = true;
- }
- }
- }
-
- if (setopts) {
- options.axesDefaults.renderer = $.jqplot.DonutAxisRenderer;
- options.legend.renderer = $.jqplot.DonutLegendRenderer;
- options.legend.preDraw = true;
- options.seriesDefaults.pointLabels = {show: false};
- }
- }
-
- // called with scope of plot.
- function postInit(target, data, options) {
- // if multiple series, add a reference to the previous one so that
- // donut rings can nest.
- for (var i=1; i570)?n[o]*0.8:n[o]+0.3*(255-n[o]);n[o]=parseInt(n[o],10)}this.highlightColors.push("rgb("+n[0]+","+n[1]+","+n[2]+")")}}t.postParseOptionsHooks.addOnce(l);t.postInitHooks.addOnce(g);t.eventListenerHooks.addOnce("jqplotMouseMove",b);t.eventListenerHooks.addOnce("jqplotMouseDown",a);t.eventListenerHooks.addOnce("jqplotMouseUp",j);t.eventListenerHooks.addOnce("jqplotClick",f);t.eventListenerHooks.addOnce("jqplotRightClick",m);t.postDrawHooks.addOnce(h)};e.jqplot.DonutRenderer.prototype.setGridData=function(s){var o=[];var t=[];var n=this.startAngle/180*Math.PI;var r=0;this._drawData=false;for(var q=0;q0){o[q]+=o[q-1]}r+=this.data[q][1]}var p=Math.PI*2/o[o.length-1];for(var q=0;q0){o[q]+=o[q-1]}r+=s[q][1]}var p=Math.PI*2/o[o.length-1];for(var q=0;q6.282+this.startAngle){t=6.282+this.startAngle;if(u>t){u=6.281+this.startAngle}}if(u>=t){return}x.beginPath();x.fillStyle=p;x.strokeStyle=p;x.arc(0,0,n,u,t,false);x.lineTo(v*Math.cos(t),v*Math.sin(t));x.arc(0,0,v,t,u,true);x.closePath();if(w){x.fill()}else{x.stroke()}}if(s){for(var q=0;q1&&this.index>0)?this._previousSeries[0]._diameter:this._diameter;this._thickness=this.thickness||(M-this.innerDiameter-2*X*this._numberSeries)/this._numberSeries/2}else{this._thickness=this.thickness||v/2/(this._numberSeries+1)*0.85}var K=this._radius=this._diameter/2;this._innerRadius=this._radius-this._thickness;var o=this.startAngle/180*Math.PI;this._center=[(s-u*q)/2+u*q,(H-u*p)/2+u*p];if(this.shadow){var L="rgba(0,0,0,"+this.shadowAlpha+")";for(var Q=0;Q=this.dataLabelThreshold){var S,U=(A+z)/2,C;if(this.dataLabels=="label"){S=this.dataLabelFormatString||"%s";C=e.jqplot.sprintf(S,V[Q][0])}else{if(this.dataLabels=="value"){S=this.dataLabelFormatString||"%d";C=e.jqplot.sprintf(S,this.data[Q][1])}else{if(this.dataLabels=="percent"){S=this.dataLabelFormatString||"%d%%";C=e.jqplot.sprintf(S,V[Q][2]*100)}else{if(this.dataLabels.constructor==Array){S=this.dataLabelFormatString||"%s";C=e.jqplot.sprintf(S,this.dataLabels[Q])}}}}var n=this._innerRadius+this._thickness*this.dataLabelPositionFactor+this.sliceMargin+this.dataLabelNudge;var F=this._center[0]+Math.cos(U)*n+this.canvas._offsets.left;var E=this._center[1]+Math.sin(U)*n+this.canvas._offsets.top;var D=e(''+C+" ").insertBefore(P.eventCanvas._elem);F-=D.width()/2;E-=D.height()/2;F=Math.round(F);E=Math.round(E);D.css({left:F,top:E})}}};e.jqplot.DonutAxisRenderer=function(){e.jqplot.LinearAxisRenderer.call(this)};e.jqplot.DonutAxisRenderer.prototype=new e.jqplot.LinearAxisRenderer();e.jqplot.DonutAxisRenderer.prototype.constructor=e.jqplot.DonutAxisRenderer;e.jqplot.DonutAxisRenderer.prototype.init=function(n){this.tickRenderer=e.jqplot.DonutTickRenderer;e.extend(true,this,n);this._dataBounds={min:0,max:100};this.min=0;this.max=100;this.showTicks=false;this.ticks=[];this.showMark=false;this.show=false};e.jqplot.DonutLegendRenderer=function(){e.jqplot.TableLegendRenderer.call(this)};e.jqplot.DonutLegendRenderer.prototype=new e.jqplot.TableLegendRenderer();e.jqplot.DonutLegendRenderer.prototype.constructor=e.jqplot.DonutLegendRenderer;e.jqplot.DonutLegendRenderer.prototype.init=function(n){this.numberRows=null;this.numberColumns=null;e.extend(true,this,n)};e.jqplot.DonutLegendRenderer.prototype.draw=function(){var q=this;if(this.show){var y=this._series;var B="position:absolute;";B+=(this.background)?"background:"+this.background+";":"";B+=(this.border)?"border:"+this.border+";":"";B+=(this.fontSize)?"font-size:"+this.fontSize+";":"";B+=(this.fontFamily)?"font-family:"+this.fontFamily+";":"";B+=(this.textColor)?"color:"+this.textColor+";":"";B+=(this.marginTop!=null)?"margin-top:"+this.marginTop+";":"";B+=(this.marginBottom!=null)?"margin-bottom:"+this.marginBottom+";":"";B+=(this.marginLeft!=null)?"margin-left:"+this.marginLeft+";":"";B+=(this.marginRight!=null)?"margin-right:"+this.marginRight+";":"";this._elem=e('');var F=false,x=false,n,v;var z=y[0];var o=new e.jqplot.ColorGenerator(z.seriesColors);if(z.show){var G=z.data;if(this.numberRows){n=this.numberRows;if(!this.numberColumns){v=Math.ceil(G.length/n)}else{v=this.numberColumns}}else{if(this.numberColumns){v=this.numberColumns;n=Math.ceil(G.length/this.numberColumns)}else{n=G.length;v=1}}var E,D,p,t,r,u,w,C;var A=0;for(E=0;E').prependTo(this._elem)}else{p=e(' ').appendTo(this._elem)}for(D=0;D0){F=true}else{F=false}}else{if(E==n-1){F=false}else{F=true}}w=(F)?this.rowSpacing:"0";t=e(' ');r=e(' ');if(this.escapeHtml){r.text(u)}else{r.html(u)}if(x){r.prependTo(p);t.prependTo(p)}else{t.appendTo(p);r.appendTo(p)}F=true}A++}}}}return this._elem};function c(r,q,o){o=o||{};o.axesDefaults=o.axesDefaults||{};o.legend=o.legend||{};o.seriesDefaults=o.seriesDefaults||{};var n=false;if(o.seriesDefaults.renderer==e.jqplot.DonutRenderer){n=true}else{if(o.series){for(var p=0;p= 0.6) ? rgba[3]*0.6 : rgba[3]*(2-rgba[3]);
- drag.color = 'rgba('+newrgb[0]+','+newrgb[1]+','+newrgb[2]+','+alpha+')';
- }
- mr.color = drag.color;
- mr.init();
-
- var start = (neighbor.pointIndex > 0) ? neighbor.pointIndex - 1 : 0;
- var end = neighbor.pointIndex+2;
- drag._gridData = s.gridData.slice(start, end);
- }
-
- function handleMove(ev, gridpos, datapos, neighbor, plot) {
- if (plot.plugins.dragable.dragCanvas.isDragging) {
- var dc = plot.plugins.dragable.dragCanvas;
- var dp = dc._neighbor;
- var s = plot.series[dp.seriesIndex];
- var drag = s.plugins.dragable;
- var gd = s.gridData;
-
- // compute the new grid position with any constraints.
- var x = (drag.constrainTo == 'y') ? dp.gridData[0] : gridpos.x;
- var y = (drag.constrainTo == 'x') ? dp.gridData[1] : gridpos.y;
-
- // compute data values for any listeners.
- var xu = s._xaxis.series_p2u(x);
- var yu = s._yaxis.series_p2u(y);
-
- // clear the canvas then redraw effect at new position.
- var ctx = dc._ctx;
- ctx.clearRect(0, 0, ctx.canvas.width, ctx.canvas.height);
-
- // adjust our gridData for the new mouse position
- if (dp.pointIndex > 0) {
- drag._gridData[1] = [x, y];
- }
- else {
- drag._gridData[0] = [x, y];
- }
- plot.series[dp.seriesIndex].draw(dc._ctx, {gridData:drag._gridData, shadow:false, preventJqPlotSeriesDrawTrigger:true, color:drag.color, markerOptions:{color:drag.color, shadow:false}, trendline:{show:false}});
- plot.target.trigger('jqplotSeriesPointChange', [dp.seriesIndex, dp.pointIndex, [xu,yu], [x,y]]);
- }
- else if (neighbor != null) {
- var series = plot.series[neighbor.seriesIndex];
- if (series.isDragable) {
- var dc = plot.plugins.dragable.dragCanvas;
- if (!dc.isOver) {
- dc._cursors.push(ev.target.style.cursor);
- ev.target.style.cursor = "pointer";
- }
- dc.isOver = true;
- }
- }
- else if (neighbor == null) {
- var dc = plot.plugins.dragable.dragCanvas;
- if (dc.isOver) {
- ev.target.style.cursor = dc._cursors.pop();
- dc.isOver = false;
- }
- }
- }
-
- function handleDown(ev, gridpos, datapos, neighbor, plot) {
- var dc = plot.plugins.dragable.dragCanvas;
- dc._cursors.push(ev.target.style.cursor);
- if (neighbor != null) {
- var s = plot.series[neighbor.seriesIndex];
- var drag = s.plugins.dragable;
- if (s.isDragable && !dc.isDragging) {
- dc._neighbor = neighbor;
- dc.isDragging = true;
- initDragPoint(plot, neighbor);
- drag.markerRenderer.draw(s.gridData[neighbor.pointIndex][0], s.gridData[neighbor.pointIndex][1], dc._ctx);
- ev.target.style.cursor = "move";
- plot.target.trigger('jqplotDragStart', [neighbor.seriesIndex, neighbor.pointIndex, gridpos, datapos]);
- }
- }
- // Just in case of a hickup, we'll clear the drag canvas and reset.
- else {
- var ctx = dc._ctx;
- ctx.clearRect(0, 0, ctx.canvas.width, ctx.canvas.height);
- dc.isDragging = false;
- }
- }
-
- function handleUp(ev, gridpos, datapos, neighbor, plot) {
- if (plot.plugins.dragable.dragCanvas.isDragging) {
- var dc = plot.plugins.dragable.dragCanvas;
- // clear the canvas
- var ctx = dc._ctx;
- ctx.clearRect(0, 0, ctx.canvas.width, ctx.canvas.height);
- dc.isDragging = false;
- // redraw the series canvas at the new point.
- var dp = dc._neighbor;
- var s = plot.series[dp.seriesIndex];
- var drag = s.plugins.dragable;
- // compute the new grid position with any constraints.
- var x = (drag.constrainTo == 'y') ? dp.data[0] : datapos[s.xaxis];
- var y = (drag.constrainTo == 'x') ? dp.data[1] : datapos[s.yaxis];
- // var x = datapos[s.xaxis];
- // var y = datapos[s.yaxis];
- s.data[dp.pointIndex][0] = x;
- s.data[dp.pointIndex][1] = y;
- plot.drawSeries({preventJqPlotSeriesDrawTrigger:true}, dp.seriesIndex);
- dc._neighbor = null;
- ev.target.style.cursor = dc._cursors.pop();
- plot.target.trigger('jqplotDragStop', [gridpos, datapos]);
- }
- }
-})(jQuery);
\ No newline at end of file
diff --git a/libreplan-webapp/src/main/webapp/jqplot/plugins/jqplot.dragable.min.js b/libreplan-webapp/src/main/webapp/jqplot/plugins/jqplot.dragable.min.js
deleted file mode 100644
index 75dba07d6..000000000
--- a/libreplan-webapp/src/main/webapp/jqplot/plugins/jqplot.dragable.min.js
+++ /dev/null
@@ -1,57 +0,0 @@
-/**
- * jqPlot
- * Pure JavaScript plotting plugin using jQuery
- *
- * Version: 1.0.0b2_r1012
- *
- * Copyright (c) 2009-2011 Chris Leonello
- * jqPlot is currently available for use in all personal or commercial projects
- * under both the MIT (http://www.opensource.org/licenses/mit-license.php) and GPL
- * version 2.0 (http://www.gnu.org/licenses/gpl-2.0.html) licenses. This means that you can
- * choose the license that best suits your project and use it accordingly.
- *
- * Although not required, the author would appreciate an email letting him
- * know of any substantial use of jqPlot. You can reach the author at:
- * chris at jqplot dot com or see http://www.jqplot.com/info.php .
- *
- * If you are feeling kind and generous, consider supporting the project by
- * making a donation at: http://www.jqplot.com/donate.php .
- *
- * sprintf functions contained in jqplot.sprintf.js by Ash Searle:
- *
- * version 2007.04.27
- * author Ash Searle
- * http://hexmen.com/blog/2007/03/printf-sprintf/
- * http://hexmen.com/js/sprintf.js
- * The author (Ash Searle) has placed this code in the public domain:
- * "This code is unrestricted: you are free to use it however you like."
- *
- * included jsDate library by Chris Leonello:
- *
- * Copyright (c) 2010-2011 Chris Leonello
- *
- * jsDate is currently available for use in all personal or commercial projects
- * under both the MIT and GPL version 2.0 licenses. This means that you can
- * choose the license that best suits your project and use it accordingly.
- *
- * jsDate borrows many concepts and ideas from the Date Instance
- * Methods by Ken Snyder along with some parts of Ken's actual code.
- *
- * Ken's origianl Date Instance Methods and copyright notice:
- *
- * Ken Snyder (ken d snyder at gmail dot com)
- * 2008-09-10
- * version 2.0.2 (http://kendsnyder.com/sandbox/date/)
- * Creative Commons Attribution License 3.0 (http://creativecommons.org/licenses/by/3.0/)
- *
- * jqplotToImage function based on Larry Siden's export-jqplot-to-png.js.
- * Larry has generously given permission to adapt his code for inclusion
- * into jqPlot.
- *
- * Larry's original code can be found here:
- *
- * https://github.com/lsiden/export-jqplot-to-png
- *
- *
- */
-(function(d){d.jqplot.Dragable=function(g){this.markerRenderer=new d.jqplot.MarkerRenderer({shadow:false});this.shapeRenderer=new d.jqplot.ShapeRenderer();this.isDragging=false;this.isOver=false;this._ctx;this._elem;this._point;this._gridData;this.color;this.constrainTo="none";d.extend(true,this,g)};function b(){d.jqplot.GenericCanvas.call(this);this.isDragging=false;this.isOver=false;this._neighbor;this._cursors=[]}b.prototype=new d.jqplot.GenericCanvas();b.prototype.constructor=b;d.jqplot.Dragable.parseOptions=function(i,h){var g=h||{};this.plugins.dragable=new d.jqplot.Dragable(g.dragable);this.isDragable=d.jqplot.config.enablePlugins};d.jqplot.Dragable.postPlotDraw=function(){if(this.plugins.dragable&&this.plugins.dragable.highlightCanvas){this.plugins.dragable.highlightCanvas.resetCanvas();this.plugins.dragable.highlightCanvas=null}this.plugins.dragable={previousCursor:"auto",isOver:false};this.plugins.dragable.dragCanvas=new b();this.eventCanvas._elem.before(this.plugins.dragable.dragCanvas.createElement(this._gridPadding,"jqplot-dragable-canvas",this._plotDimensions,this));var g=this.plugins.dragable.dragCanvas.setContext()};d.jqplot.preParseSeriesOptionsHooks.push(d.jqplot.Dragable.parseOptions);d.jqplot.postDrawHooks.push(d.jqplot.Dragable.postPlotDraw);d.jqplot.eventListenerHooks.push(["jqplotMouseMove",e]);d.jqplot.eventListenerHooks.push(["jqplotMouseDown",c]);d.jqplot.eventListenerHooks.push(["jqplotMouseUp",a]);function f(n,p){var q=n.series[p.seriesIndex];var m=q.plugins.dragable;var h=q.markerRenderer;var i=m.markerRenderer;i.style=h.style;i.lineWidth=h.lineWidth+2.5;i.size=h.size+5;if(!m.color){var l=d.jqplot.getColorComponents(h.color);var o=[l[0],l[1],l[2]];var k=(l[3]>=0.6)?l[3]*0.6:l[3]*(2-l[3]);m.color="rgba("+o[0]+","+o[1]+","+o[2]+","+k+")"}i.color=m.color;i.init();var g=(p.pointIndex>0)?p.pointIndex-1:0;var j=p.pointIndex+2;m._gridData=q.gridData.slice(g,j)}function e(o,l,h,t,m){if(m.plugins.dragable.dragCanvas.isDragging){var u=m.plugins.dragable.dragCanvas;var i=u._neighbor;var w=m.series[i.seriesIndex];var k=w.plugins.dragable;var r=w.gridData;var p=(k.constrainTo=="y")?i.gridData[0]:l.x;var n=(k.constrainTo=="x")?i.gridData[1]:l.y;var g=w._xaxis.series_p2u(p);var q=w._yaxis.series_p2u(n);var v=u._ctx;v.clearRect(0,0,v.canvas.width,v.canvas.height);if(i.pointIndex>0){k._gridData[1]=[p,n]}else{k._gridData[0]=[p,n]}m.series[i.seriesIndex].draw(u._ctx,{gridData:k._gridData,shadow:false,preventJqPlotSeriesDrawTrigger:true,color:k.color,markerOptions:{color:k.color,shadow:false},trendline:{show:false}});m.target.trigger("jqplotSeriesPointChange",[i.seriesIndex,i.pointIndex,[g,q],[p,n]])}else{if(t!=null){var j=m.series[t.seriesIndex];if(j.isDragable){var u=m.plugins.dragable.dragCanvas;if(!u.isOver){u._cursors.push(o.target.style.cursor);o.target.style.cursor="pointer"}u.isOver=true}}else{if(t==null){var u=m.plugins.dragable.dragCanvas;if(u.isOver){o.target.style.cursor=u._cursors.pop();u.isOver=false}}}}}function c(k,i,g,l,j){var m=j.plugins.dragable.dragCanvas;m._cursors.push(k.target.style.cursor);if(l!=null){var o=j.series[l.seriesIndex];var h=o.plugins.dragable;if(o.isDragable&&!m.isDragging){m._neighbor=l;m.isDragging=true;f(j,l);h.markerRenderer.draw(o.gridData[l.pointIndex][0],o.gridData[l.pointIndex][1],m._ctx);k.target.style.cursor="move";j.target.trigger("jqplotDragStart",[l.seriesIndex,l.pointIndex,i,g])}}else{var n=m._ctx;n.clearRect(0,0,n.canvas.width,n.canvas.height);m.isDragging=false}}function a(m,j,g,o,k){if(k.plugins.dragable.dragCanvas.isDragging){var p=k.plugins.dragable.dragCanvas;var q=p._ctx;q.clearRect(0,0,q.canvas.width,q.canvas.height);p.isDragging=false;var h=p._neighbor;var r=k.series[h.seriesIndex];var i=r.plugins.dragable;var n=(i.constrainTo=="y")?h.data[0]:g[r.xaxis];var l=(i.constrainTo=="x")?h.data[1]:g[r.yaxis];r.data[h.pointIndex][0]=n;r.data[h.pointIndex][1]=l;k.drawSeries({preventJqPlotSeriesDrawTrigger:true},h.seriesIndex);p._neighbor=null;m.target.style.cursor=p._cursors.pop();k.target.trigger("jqplotDragStop",[j,g])}}})(jQuery);
\ No newline at end of file
diff --git a/libreplan-webapp/src/main/webapp/jqplot/plugins/jqplot.enhancedLegendRenderer.js b/libreplan-webapp/src/main/webapp/jqplot/plugins/jqplot.enhancedLegendRenderer.js
deleted file mode 100644
index 898f4b95a..000000000
--- a/libreplan-webapp/src/main/webapp/jqplot/plugins/jqplot.enhancedLegendRenderer.js
+++ /dev/null
@@ -1,241 +0,0 @@
-/**
- * jqPlot
- * Pure JavaScript plotting plugin using jQuery
- *
- * Version: 1.0.0b2_r1012
- *
- * Copyright (c) 2009-2011 Chris Leonello
- * jqPlot is currently available for use in all personal or commercial projects
- * under both the MIT (http://www.opensource.org/licenses/mit-license.php) and GPL
- * version 2.0 (http://www.gnu.org/licenses/gpl-2.0.html) licenses. This means that you can
- * choose the license that best suits your project and use it accordingly.
- *
- * Although not required, the author would appreciate an email letting him
- * know of any substantial use of jqPlot. You can reach the author at:
- * chris at jqplot dot com or see http://www.jqplot.com/info.php .
- *
- * If you are feeling kind and generous, consider supporting the project by
- * making a donation at: http://www.jqplot.com/donate.php .
- *
- * sprintf functions contained in jqplot.sprintf.js by Ash Searle:
- *
- * version 2007.04.27
- * author Ash Searle
- * http://hexmen.com/blog/2007/03/printf-sprintf/
- * http://hexmen.com/js/sprintf.js
- * The author (Ash Searle) has placed this code in the public domain:
- * "This code is unrestricted: you are free to use it however you like."
- *
- */
-(function($) {
- // class $.jqplot.EnhancedLegendRenderer
- // Legend renderer which can specify the number of rows and/or columns in the legend.
- $.jqplot.EnhancedLegendRenderer = function(){
- $.jqplot.TableLegendRenderer.call(this);
- };
-
- $.jqplot.EnhancedLegendRenderer.prototype = new $.jqplot.TableLegendRenderer();
- $.jqplot.EnhancedLegendRenderer.prototype.constructor = $.jqplot.EnhancedLegendRenderer;
-
- // called with scope of legend.
- $.jqplot.EnhancedLegendRenderer.prototype.init = function(options) {
- // prop: numberRows
- // Maximum number of rows in the legend. 0 or null for unlimited.
- this.numberRows = null;
- // prop: numberColumns
- // Maximum number of columns in the legend. 0 or null for unlimited.
- this.numberColumns = null;
- // prop: seriesToggle
- // false to not enable series on/off toggling on the legend.
- // true or a fadein/fadeout speed (number of milliseconds or 'fast', 'normal', 'slow')
- // to enable show/hide of series on click of legend item.
- this.seriesToggle = 'normal';
- // prop: disableIEFading
- // true to toggle series with a show/hide method only and not allow fading in/out.
- // This is to overcome poor performance of fade in some versions of IE.
- this.disableIEFading = true;
- $.extend(true, this, options);
-
- if (this.seriesToggle) {
- $.jqplot.postDrawHooks.push(postDraw);
- }
- };
-
- // called with scope of legend
- $.jqplot.EnhancedLegendRenderer.prototype.draw = function() {
- var legend = this;
- if (this.show) {
- var series = this._series;
- var s;
- var ss = 'position:absolute;';
- ss += (this.background) ? 'background:'+this.background+';' : '';
- ss += (this.border) ? 'border:'+this.border+';' : '';
- ss += (this.fontSize) ? 'font-size:'+this.fontSize+';' : '';
- ss += (this.fontFamily) ? 'font-family:'+this.fontFamily+';' : '';
- ss += (this.textColor) ? 'color:'+this.textColor+';' : '';
- ss += (this.marginTop != null) ? 'margin-top:'+this.marginTop+';' : '';
- ss += (this.marginBottom != null) ? 'margin-bottom:'+this.marginBottom+';' : '';
- ss += (this.marginLeft != null) ? 'margin-left:'+this.marginLeft+';' : '';
- ss += (this.marginRight != null) ? 'margin-right:'+this.marginRight+';' : '';
- this._elem = $('');
- if (this.seriesToggle) {
- this._elem.css('z-index', '3');
- }
-
- var pad = false,
- reverse = false,
- nr, nc;
- if (this.numberRows) {
- nr = this.numberRows;
- if (!this.numberColumns){
- nc = Math.ceil(series.length/nr);
- }
- else{
- nc = this.numberColumns;
- }
- }
- else if (this.numberColumns) {
- nc = this.numberColumns;
- nr = Math.ceil(series.length/this.numberColumns);
- }
- else {
- nr = series.length;
- nc = 1;
- }
-
- var i, j, tr, td1, td2, lt, rs, div, div0, div1;
- var idx = 0;
- // check to see if we need to reverse
- for (i=series.length-1; i>=0; i--) {
- if (nc == 1 && series[i]._stack || series[i].renderer.constructor == $.jqplot.BezierCurveRenderer){
- reverse = true;
- }
- }
-
- for (i=0; i0){
- pad = true;
- }
- else{
- pad = false;
- }
- }
- else{
- if (i == nr -1){
- pad = false;
- }
- else{
- pad = true;
- }
- }
- rs = (pad) ? this.rowSpacing : '0';
-
- td1 = $(document.createElement('td'));
- td1.addClass('jqplot-table-legend jqplot-table-legend-swatch');
- td1.css({textAlign: 'center', paddingTop: rs});
-
- div0 = $(document.createElement('div'));
- div0.addClass('jqplot-table-legend-swatch-outline');
- div1 = $(document.createElement('div'));
- div1.addClass('jqplot-table-legend-swatch');
- div1.css({backgroundColor: color, borderColor: color});
-
- td1.append(div0.append(div1));
-
- td2 = $(document.createElement('td'));
- td2.addClass('jqplot-table-legend jqplot-table-legend-label');
- td2.css('paddingTop', rs);
-
- // td1 = $(''+
- // ' ');
- // td2 = $(' ');
- if (this.escapeHtml){
- td2.text(lt);
- }
- else {
- td2.html(lt);
- }
- if (reverse) {
- if (this.showLabels) {td2.prependTo(tr);}
- if (this.showSwatches) {td1.prependTo(tr);}
- }
- else {
- if (this.showSwatches) {td1.appendTo(tr);}
- if (this.showLabels) {td2.appendTo(tr);}
- }
-
- if (this.seriesToggle) {
-
- // add an overlay for clicking series on/off
- // div0 = $(document.createElement('div'));
- // div0.addClass('jqplot-table-legend-overlay');
- // div0.css({position:'relative', left:0, top:0, height:'100%', width:'100%'});
- // tr.append(div0);
-
- var speed;
- if (typeof(this.seriesToggle) == 'string' || typeof(this.seriesToggle) == 'number') {
- if (!$.jqplot.use_excanvas || !this.disableIEFading) {
- speed = this.seriesToggle;
- }
- }
- if (this.showSwatches) {
- td1.bind('click', {series:s, speed:speed}, handleToggle);
- td1.addClass('jqplot-seriesToggle');
- }
- if (this.showLabels) {
- td2.bind('click', {series:s, speed:speed}, handleToggle);
- td2.addClass('jqplot-seriesToggle');
- }
- }
-
- pad = true;
- }
- }
- idx++;
- }
-
- td1 = td2 = div0 = div1 = null;
- }
- }
- return this._elem;
- };
-
- var handleToggle = function (ev) {
- ev.data.series.toggleDisplay(ev);
- if (ev.data.series.canvas._elem.hasClass('jqplot-series-hidden')) {
- $(this).addClass('jqplot-series-hidden');
- $(this).next('.jqplot-table-legend-label').addClass('jqplot-series-hidden');
- $(this).prev('.jqplot-table-legend-swatch').addClass('jqplot-series-hidden');
-
- }
- else {
- $(this).removeClass('jqplot-series-hidden');
- $(this).next('.jqplot-table-legend-label').removeClass('jqplot-series-hidden');
- $(this).prev('.jqplot-table-legend-swatch').removeClass('jqplot-series-hidden');
- }
- };
-
- // called with scope of plot.
- var postDraw = function () {
- if (this.legend.renderer.constructor == $.jqplot.EnhancedLegendRenderer && this.legend.seriesToggle){
- var e = this.legend._elem.detach();
- this.eventCanvas._elem.after(e);
- }
- };
-})(jQuery);
\ No newline at end of file
diff --git a/libreplan-webapp/src/main/webapp/jqplot/plugins/jqplot.enhancedLegendRenderer.min.js b/libreplan-webapp/src/main/webapp/jqplot/plugins/jqplot.enhancedLegendRenderer.min.js
deleted file mode 100644
index 1655c67f2..000000000
--- a/libreplan-webapp/src/main/webapp/jqplot/plugins/jqplot.enhancedLegendRenderer.min.js
+++ /dev/null
@@ -1,57 +0,0 @@
-/**
- * jqPlot
- * Pure JavaScript plotting plugin using jQuery
- *
- * Version: 1.0.0b2_r1012
- *
- * Copyright (c) 2009-2011 Chris Leonello
- * jqPlot is currently available for use in all personal or commercial projects
- * under both the MIT (http://www.opensource.org/licenses/mit-license.php) and GPL
- * version 2.0 (http://www.gnu.org/licenses/gpl-2.0.html) licenses. This means that you can
- * choose the license that best suits your project and use it accordingly.
- *
- * Although not required, the author would appreciate an email letting him
- * know of any substantial use of jqPlot. You can reach the author at:
- * chris at jqplot dot com or see http://www.jqplot.com/info.php .
- *
- * If you are feeling kind and generous, consider supporting the project by
- * making a donation at: http://www.jqplot.com/donate.php .
- *
- * sprintf functions contained in jqplot.sprintf.js by Ash Searle:
- *
- * version 2007.04.27
- * author Ash Searle
- * http://hexmen.com/blog/2007/03/printf-sprintf/
- * http://hexmen.com/js/sprintf.js
- * The author (Ash Searle) has placed this code in the public domain:
- * "This code is unrestricted: you are free to use it however you like."
- *
- * included jsDate library by Chris Leonello:
- *
- * Copyright (c) 2010-2011 Chris Leonello
- *
- * jsDate is currently available for use in all personal or commercial projects
- * under both the MIT and GPL version 2.0 licenses. This means that you can
- * choose the license that best suits your project and use it accordingly.
- *
- * jsDate borrows many concepts and ideas from the Date Instance
- * Methods by Ken Snyder along with some parts of Ken's actual code.
- *
- * Ken's origianl Date Instance Methods and copyright notice:
- *
- * Ken Snyder (ken d snyder at gmail dot com)
- * 2008-09-10
- * version 2.0.2 (http://kendsnyder.com/sandbox/date/)
- * Creative Commons Attribution License 3.0 (http://creativecommons.org/licenses/by/3.0/)
- *
- * jqplotToImage function based on Larry Siden's export-jqplot-to-png.js.
- * Larry has generously given permission to adapt his code for inclusion
- * into jqPlot.
- *
- * Larry's original code can be found here:
- *
- * https://github.com/lsiden/export-jqplot-to-png
- *
- *
- */
-(function(c){c.jqplot.EnhancedLegendRenderer=function(){c.jqplot.TableLegendRenderer.call(this)};c.jqplot.EnhancedLegendRenderer.prototype=new c.jqplot.TableLegendRenderer();c.jqplot.EnhancedLegendRenderer.prototype.constructor=c.jqplot.EnhancedLegendRenderer;c.jqplot.EnhancedLegendRenderer.prototype.init=function(d){this.numberRows=null;this.numberColumns=null;this.seriesToggle="normal";this.disableIEFading=true;c.extend(true,this,d);if(this.seriesToggle){c.jqplot.postDrawHooks.push(b)}};c.jqplot.EnhancedLegendRenderer.prototype.draw=function(){var f=this;if(this.show){var q=this._series;var r;var v="position:absolute;";v+=(this.background)?"background:"+this.background+";":"";v+=(this.border)?"border:"+this.border+";":"";v+=(this.fontSize)?"font-size:"+this.fontSize+";":"";v+=(this.fontFamily)?"font-family:"+this.fontFamily+";":"";v+=(this.textColor)?"color:"+this.textColor+";":"";v+=(this.marginTop!=null)?"margin-top:"+this.marginTop+";":"";v+=(this.marginBottom!=null)?"margin-bottom:"+this.marginBottom+";":"";v+=(this.marginLeft!=null)?"margin-left:"+this.marginLeft+";":"";v+=(this.marginRight!=null)?"margin-right:"+this.marginRight+";":"";this._elem=c('');if(this.seriesToggle){this._elem.css("z-index","3")}var A=false,p=false,d,n;if(this.numberRows){d=this.numberRows;if(!this.numberColumns){n=Math.ceil(q.length/d)}else{n=this.numberColumns}}else{if(this.numberColumns){n=this.numberColumns;d=Math.ceil(q.length/this.numberColumns)}else{d=q.length;n=1}}var z,x,e,l,k,m,o,t,h,g;var u=0;for(z=q.length-1;z>=0;z--){if(n==1&&q[z]._stack||q[z].renderer.constructor==c.jqplot.BezierCurveRenderer){p=true}}for(z=0;z0){A=true}else{A=false}}else{if(z==d-1){A=false}else{A=true}}o=(A)?this.rowSpacing:"0";l=c(document.createElement("td"));l.addClass("jqplot-table-legend jqplot-table-legend-swatch");l.css({textAlign:"center",paddingTop:o});h=c(document.createElement("div"));h.addClass("jqplot-table-legend-swatch-outline");g=c(document.createElement("div"));g.addClass("jqplot-table-legend-swatch");g.css({backgroundColor:w,borderColor:w});l.append(h.append(g));k=c(document.createElement("td"));k.addClass("jqplot-table-legend jqplot-table-legend-label");k.css("paddingTop",o);if(this.escapeHtml){k.text(m)}else{k.html(m)}if(p){if(this.showLabels){k.prependTo(e)}if(this.showSwatches){l.prependTo(e)}}else{if(this.showSwatches){l.appendTo(e)}if(this.showLabels){k.appendTo(e)}}if(this.seriesToggle){var y;if(typeof(this.seriesToggle)=="string"||typeof(this.seriesToggle)=="number"){if(!c.jqplot.use_excanvas||!this.disableIEFading){y=this.seriesToggle}}if(this.showSwatches){l.bind("click",{series:r,speed:y},a);l.addClass("jqplot-seriesToggle")}if(this.showLabels){k.bind("click",{series:r,speed:y},a);k.addClass("jqplot-seriesToggle")}}A=true}}u++}l=k=h=g=null}}return this._elem};var a=function(d){d.data.series.toggleDisplay(d);if(d.data.series.canvas._elem.hasClass("jqplot-series-hidden")){c(this).addClass("jqplot-series-hidden");c(this).next(".jqplot-table-legend-label").addClass("jqplot-series-hidden");c(this).prev(".jqplot-table-legend-swatch").addClass("jqplot-series-hidden")}else{c(this).removeClass("jqplot-series-hidden");c(this).next(".jqplot-table-legend-label").removeClass("jqplot-series-hidden");c(this).prev(".jqplot-table-legend-swatch").removeClass("jqplot-series-hidden")}};var b=function(){if(this.legend.renderer.constructor==c.jqplot.EnhancedLegendRenderer&&this.legend.seriesToggle){var d=this.legend._elem.detach();this.eventCanvas._elem.after(d)}}})(jQuery);
\ No newline at end of file
diff --git a/libreplan-webapp/src/main/webapp/jqplot/plugins/jqplot.funnelRenderer.js b/libreplan-webapp/src/main/webapp/jqplot/plugins/jqplot.funnelRenderer.js
deleted file mode 100644
index 401e1bd68..000000000
--- a/libreplan-webapp/src/main/webapp/jqplot/plugins/jqplot.funnelRenderer.js
+++ /dev/null
@@ -1,938 +0,0 @@
-/**
- * jqPlot
- * Pure JavaScript plotting plugin using jQuery
- *
- * Version: 1.0.0b2_r1012
- *
- * Copyright (c) 2009-2011 Chris Leonello
- * jqPlot is currently available for use in all personal or commercial projects
- * under both the MIT (http://www.opensource.org/licenses/mit-license.php) and GPL
- * version 2.0 (http://www.gnu.org/licenses/gpl-2.0.html) licenses. This means that you can
- * choose the license that best suits your project and use it accordingly.
- *
- * Although not required, the author would appreciate an email letting him
- * know of any substantial use of jqPlot. You can reach the author at:
- * chris at jqplot dot com or see http://www.jqplot.com/info.php .
- *
- * If you are feeling kind and generous, consider supporting the project by
- * making a donation at: http://www.jqplot.com/donate.php .
- *
- * sprintf functions contained in jqplot.sprintf.js by Ash Searle:
- *
- * version 2007.04.27
- * author Ash Searle
- * http://hexmen.com/blog/2007/03/printf-sprintf/
- * http://hexmen.com/js/sprintf.js
- * The author (Ash Searle) has placed this code in the public domain:
- * "This code is unrestricted: you are free to use it however you like."
- *
- */
-(function($) {
- /**
- * Class: $.jqplot.FunnelRenderer
- * Plugin renderer to draw a funnel chart.
- * x values, if present, will be used as labels.
- * y values give area size.
- *
- * Funnel charts will draw a single series
- * only.
- *
- * To use this renderer, you need to include the
- * funnel renderer plugin, for example:
- *
- * >
- *
- * Properties described here are passed into the $.jqplot function
- * as options on the series renderer. For example:
- *
- * > plot2 = $.jqplot('chart2', [s1, s2], {
- * > seriesDefaults: {
- * > renderer:$.jqplot.FunnelRenderer,
- * > rendererOptions:{
- * > sectionMargin: 12,
- * > widthRatio: 0.3
- * > }
- * > }
- * > });
- *
- * IMPORTANT
- *
- * *The funnel renderer will reorder data in descending order* so the largest value in
- * the data set is first and displayed on top of the funnel. Data will then
- * be displayed in descending order down the funnel. The area of each funnel
- * section will correspond to the value of each data point relative to the sum
- * of all values. That is section area is proportional to section value divided by
- * sum of all section values.
- *
- * If your data is not in descending order when passed into the plot, *it will be
- * reordered* when stored in the series.data property. A copy of the unordered
- * data is kept in the series._unorderedData property.
- *
- * A funnel plot will trigger events on the plot target
- * according to user interaction. All events return the event object,
- * the series index, the point (section) index, and the point data for
- * the appropriate section. *Note* the point index will referr to the ordered
- * data, not the original unordered data.
- *
- * 'jqplotDataMouseOver' - triggered when mousing over a section.
- * 'jqplotDataHighlight' - triggered the first time user mouses over a section,
- * if highlighting is enabled.
- * 'jqplotDataUnhighlight' - triggered when a user moves the mouse out of
- * a highlighted section.
- * 'jqplotDataClick' - triggered when the user clicks on a section.
- * 'jqplotDataRightClick' - tiggered when the user right clicks on a section if
- * the "captureRightClick" option is set to true on the plot.
- */
- $.jqplot.FunnelRenderer = function(){
- $.jqplot.LineRenderer.call(this);
- };
-
- $.jqplot.FunnelRenderer.prototype = new $.jqplot.LineRenderer();
- $.jqplot.FunnelRenderer.prototype.constructor = $.jqplot.FunnelRenderer;
-
- // called with scope of a series
- $.jqplot.FunnelRenderer.prototype.init = function(options, plot) {
- // Group: Properties
- //
- // prop: padding
- // padding between the funnel and plot edges, legend, etc.
- this.padding = {top: 20, right: 20, bottom: 20, left: 20};
- // prop: sectionMargin
- // spacing between funnel sections in pixels.
- this.sectionMargin = 6;
- // prop: fill
- // true or false, wether to fill the areas.
- this.fill = true;
- // prop: shadowOffset
- // offset of the shadow from the area and offset of
- // each succesive stroke of the shadow from the last.
- this.shadowOffset = 2;
- // prop: shadowAlpha
- // transparency of the shadow (0 = transparent, 1 = opaque)
- this.shadowAlpha = 0.07;
- // prop: shadowDepth
- // number of strokes to apply to the shadow,
- // each stroke offset shadowOffset from the last.
- this.shadowDepth = 5;
- // prop: highlightMouseOver
- // True to highlight area when moused over.
- // This must be false to enable highlightMouseDown to highlight when clicking on a area.
- this.highlightMouseOver = true;
- // prop: highlightMouseDown
- // True to highlight when a mouse button is pressed over a area.
- // This will be disabled if highlightMouseOver is true.
- this.highlightMouseDown = false;
- // prop: highlightColors
- // array of colors to use when highlighting an area.
- this.highlightColors = [];
- // prop: widthRatio
- // The ratio of the width of the top of the funnel to the bottom.
- // a ratio of 0 will make an upside down pyramid.
- this.widthRatio = 0.2;
- // prop: lineWidth
- // width of line if areas are stroked and not filled.
- this.lineWidth = 2;
- // prop: dataLabels
- // Either 'label', 'value', 'percent' or an array of labels to place on the pie slices.
- // Defaults to percentage of each pie slice.
- this.dataLabels = 'percent';
- // prop: showDataLabels
- // true to show data labels on slices.
- this.showDataLabels = false;
- // prop: dataLabelFormatString
- // Format string for data labels. If none, '%s' is used for "label" and for arrays, '%d' for value and '%d%%' for percentage.
- this.dataLabelFormatString = null;
- // prop: dataLabelThreshold
- // Threshhold in percentage (0 - 100) of pie area, below which no label will be displayed.
- // This applies to all label types, not just to percentage labels.
- this.dataLabelThreshold = 3;
- this._type = 'funnel';
-
- this.tickRenderer = $.jqplot.FunnelTickRenderer;
-
- // if user has passed in highlightMouseDown option and not set highlightMouseOver, disable highlightMouseOver
- if (options.highlightMouseDown && options.highlightMouseOver == null) {
- options.highlightMouseOver = false;
- }
-
- $.extend(true, this, options);
-
- // index of the currenty highlighted point, if any
- this._highlightedPoint = null;
-
- // lengths of bases, or horizontal sides of areas of trapezoid.
- this._bases = [];
- // total area
- this._atot;
- // areas of segments.
- this._areas = [];
- // vertical lengths of segments.
- this._lengths = [];
- // angle of the funnel to vertical.
- this._angle;
- this._dataIndices = [];
-
- // sort data
- this._unorderedData = $.extend(true, [], this.data);
- var idxs = $.extend(true, [], this.data);
- for (var i=0; i 570) ? newrgb[j] * 0.8 : newrgb[j] + 0.4 * (255 - newrgb[j]);
- newrgb[j] = parseInt(newrgb[j], 10);
- }
- this.highlightColors.push('rgb('+newrgb[0]+','+newrgb[1]+','+newrgb[2]+')');
- }
- }
-
- plot.postParseOptionsHooks.addOnce(postParseOptions);
- plot.postInitHooks.addOnce(postInit);
- plot.eventListenerHooks.addOnce('jqplotMouseMove', handleMove);
- plot.eventListenerHooks.addOnce('jqplotMouseDown', handleMouseDown);
- plot.eventListenerHooks.addOnce('jqplotMouseUp', handleMouseUp);
- plot.eventListenerHooks.addOnce('jqplotClick', handleClick);
- plot.eventListenerHooks.addOnce('jqplotRightClick', handleRightClick);
- plot.postDrawHooks.addOnce(postPlotDraw);
-
- };
-
- // gridData will be of form [label, percentage of total]
- $.jqplot.FunnelRenderer.prototype.setGridData = function(plot) {
- // set gridData property. This will hold angle in radians of each data point.
- var sum = 0;
- var td = [];
- for (var i=0; i this._lengths[i]*tolerance && count < 100) {
- this._lengths[i] = this._areas[i]/(this._bases[i] - this._lengths[i] * Math.tan(this._angle));
- err = Math.abs(this._lengths[i] - guess);
- this._bases[i+1] = this._bases[i] - (2*this._lengths[i]*Math.tan(this._angle));
- guess = this._lengths[i];
- count++;
- }
- lsum += this._lengths[i];
- }
-
- // figure out vertices of each section
- this._vertices = new Array(gd.length);
-
- // these are 4 coners of entire trapezoid
- var p0 = [loff, toff],
- p1 = [loff+this._bases[0], toff],
- p2 = [loff + (this._bases[0] - this._bases[this._bases.length-1])/2, toff + this._length],
- p3 = [p2[0] + this._bases[this._bases.length-1], p2[1]];
-
- // equations of right and left sides, returns x, y values given height of section (y value)
- function findleft (l) {
- var m = (p0[1] - p2[1])/(p0[0] - p2[0]);
- var b = p0[1] - m*p0[0];
- var y = l + p0[1];
-
- return [(y - b)/m, y];
- }
-
- function findright (l) {
- var m = (p1[1] - p3[1])/(p1[0] - p3[0]);
- var b = p1[1] - m*p1[0];
- var y = l + p1[1];
-
- return [(y - b)/m, y];
- }
-
- var x = offx, y = offy;
- var h=0, adj=0;
-
- for (i=0; i 0 && i < gd.length-1) {
- adj = sm/2;
- }
- else if (i == gd.length -1) {
- adj = 2*sm/3;
- }
- v.push(findleft(h+adj));
- v.push(findright(h+adj));
- h += this._lengths[i];
- if (i == 0) {
- adj = -2*sm/3;
- }
- else if (i > 0 && i < gd.length-1) {
- adj = -sm/2;
- }
- else if (i == gd.length - 1) {
- adj = 0;
- }
- v.push(findright(h+adj));
- v.push(findleft(h+adj));
-
- }
-
- if (this.shadow) {
- var shadowColor = 'rgba(0,0,0,'+this.shadowAlpha+')';
- for (var i=0; i= this.dataLabelThreshold) {
- var fstr, label;
-
- if (this.dataLabels == 'label') {
- fstr = this.dataLabelFormatString || '%s';
- label = $.jqplot.sprintf(fstr, gd[i][0]);
- }
- else if (this.dataLabels == 'value') {
- fstr = this.dataLabelFormatString || '%d';
- label = $.jqplot.sprintf(fstr, this.data[i][1]);
- }
- else if (this.dataLabels == 'percent') {
- fstr = this.dataLabelFormatString || '%d%%';
- label = $.jqplot.sprintf(fstr, gd[i][1]*100);
- }
- else if (this.dataLabels.constructor == Array) {
- fstr = this.dataLabelFormatString || '%s';
- label = $.jqplot.sprintf(fstr, this.dataLabels[this._dataIndices[i]]);
- }
-
- var fact = (this._radius ) * this.dataLabelPositionFactor + this.sliceMargin + this.dataLabelNudge;
-
- var x = (v[0][0] + v[1][0])/2 + this.canvas._offsets.left;
- var y = (v[1][1] + v[2][1])/2 + this.canvas._offsets.top;
-
- var labelelem = $('' + label + ' ').insertBefore(plot.eventCanvas._elem);
- x -= labelelem.width()/2;
- y -= labelelem.height()/2;
- x = Math.round(x);
- y = Math.round(y);
- labelelem.css({left: x, top: y});
- }
-
- }
-
- };
-
- $.jqplot.FunnelAxisRenderer = function() {
- $.jqplot.LinearAxisRenderer.call(this);
- };
-
- $.jqplot.FunnelAxisRenderer.prototype = new $.jqplot.LinearAxisRenderer();
- $.jqplot.FunnelAxisRenderer.prototype.constructor = $.jqplot.FunnelAxisRenderer;
-
-
- // There are no traditional axes on a funnel chart. We just need to provide
- // dummy objects with properties so the plot will render.
- // called with scope of axis object.
- $.jqplot.FunnelAxisRenderer.prototype.init = function(options){
- //
- this.tickRenderer = $.jqplot.FunnelTickRenderer;
- $.extend(true, this, options);
- // I don't think I'm going to need _dataBounds here.
- // have to go Axis scaling in a way to fit chart onto plot area
- // and provide u2p and p2u functionality for mouse cursor, etc.
- // for convienence set _dataBounds to 0 and 100 and
- // set min/max to 0 and 100.
- this._dataBounds = {min:0, max:100};
- this.min = 0;
- this.max = 100;
- this.showTicks = false;
- this.ticks = [];
- this.showMark = false;
- this.show = false;
- };
-
-
-
- /**
- * Class: $.jqplot.FunnelLegendRenderer
- * Legend Renderer specific to funnel plots. Set by default
- * when the user creates a funnel plot.
- */
- $.jqplot.FunnelLegendRenderer = function(){
- $.jqplot.TableLegendRenderer.call(this);
- };
-
- $.jqplot.FunnelLegendRenderer.prototype = new $.jqplot.TableLegendRenderer();
- $.jqplot.FunnelLegendRenderer.prototype.constructor = $.jqplot.FunnelLegendRenderer;
-
- $.jqplot.FunnelLegendRenderer.prototype.init = function(options) {
- // Group: Properties
- //
- // prop: numberRows
- // Maximum number of rows in the legend. 0 or null for unlimited.
- this.numberRows = null;
- // prop: numberColumns
- // Maximum number of columns in the legend. 0 or null for unlimited.
- this.numberColumns = null;
- $.extend(true, this, options);
- };
-
- // called with context of legend
- $.jqplot.FunnelLegendRenderer.prototype.draw = function() {
- var legend = this;
- if (this.show) {
- var series = this._series;
- var ss = 'position:absolute;';
- ss += (this.background) ? 'background:'+this.background+';' : '';
- ss += (this.border) ? 'border:'+this.border+';' : '';
- ss += (this.fontSize) ? 'font-size:'+this.fontSize+';' : '';
- ss += (this.fontFamily) ? 'font-family:'+this.fontFamily+';' : '';
- ss += (this.textColor) ? 'color:'+this.textColor+';' : '';
- ss += (this.marginTop != null) ? 'margin-top:'+this.marginTop+';' : '';
- ss += (this.marginBottom != null) ? 'margin-bottom:'+this.marginBottom+';' : '';
- ss += (this.marginLeft != null) ? 'margin-left:'+this.marginLeft+';' : '';
- ss += (this.marginRight != null) ? 'margin-right:'+this.marginRight+';' : '';
- this._elem = $('');
- // Funnel charts legends don't go by number of series, but by number of data points
- // in the series. Refactor things here for that.
-
- var pad = false,
- reverse = false,
- nr, nc;
- var s = series[0];
- var colorGenerator = new $.jqplot.ColorGenerator(s.seriesColors);
-
- if (s.show) {
- var pd = s.data;
- if (this.numberRows) {
- nr = this.numberRows;
- if (!this.numberColumns){
- nc = Math.ceil(pd.length/nr);
- }
- else{
- nc = this.numberColumns;
- }
- }
- else if (this.numberColumns) {
- nc = this.numberColumns;
- nr = Math.ceil(pd.length/this.numberColumns);
- }
- else {
- nr = pd.length;
- nc = 1;
- }
-
- var i, j, tr, td1, td2, lt, rs, color;
- var idx = 0;
-
- for (i=0; i').prependTo(this._elem);
- }
- else{
- tr = $(' ').appendTo(this._elem);
- }
- for (j=0; j0){
- pad = true;
- }
- else{
- pad = false;
- }
- }
- else{
- if (i == nr -1){
- pad = false;
- }
- else{
- pad = true;
- }
- }
- rs = (pad) ? this.rowSpacing : '0';
-
- td1 = $(''+
- ' ');
- td2 = $(' ');
- if (this.escapeHtml){
- td2.text(lt);
- }
- else {
- td2.html(lt);
- }
- if (reverse) {
- td2.prependTo(tr);
- td1.prependTo(tr);
- }
- else {
- td1.appendTo(tr);
- td2.appendTo(tr);
- }
- pad = true;
- }
- idx++;
- }
- }
- }
- }
- return this._elem;
- };
-
- // $.jqplot.FunnelLegendRenderer.prototype.pack = function(offsets) {
- // if (this.show) {
- // // fake a grid for positioning
- // var grid = {_top:offsets.top, _left:offsets.left, _right:offsets.right, _bottom:this._plotDimensions.height - offsets.bottom};
- // if (this.placement == 'insideGrid') {
- // switch (this.location) {
- // case 'nw':
- // var a = grid._left + this.xoffset;
- // var b = grid._top + this.yoffset;
- // this._elem.css('left', a);
- // this._elem.css('top', b);
- // break;
- // case 'n':
- // var a = (offsets.left + (this._plotDimensions.width - offsets.right))/2 - this.getWidth()/2;
- // var b = grid._top + this.yoffset;
- // this._elem.css('left', a);
- // this._elem.css('top', b);
- // break;
- // case 'ne':
- // var a = offsets.right + this.xoffset;
- // var b = grid._top + this.yoffset;
- // this._elem.css({right:a, top:b});
- // break;
- // case 'e':
- // var a = offsets.right + this.xoffset;
- // var b = (offsets.top + (this._plotDimensions.height - offsets.bottom))/2 - this.getHeight()/2;
- // this._elem.css({right:a, top:b});
- // break;
- // case 'se':
- // var a = offsets.right + this.xoffset;
- // var b = offsets.bottom + this.yoffset;
- // this._elem.css({right:a, bottom:b});
- // break;
- // case 's':
- // var a = (offsets.left + (this._plotDimensions.width - offsets.right))/2 - this.getWidth()/2;
- // var b = offsets.bottom + this.yoffset;
- // this._elem.css({left:a, bottom:b});
- // break;
- // case 'sw':
- // var a = grid._left + this.xoffset;
- // var b = offsets.bottom + this.yoffset;
- // this._elem.css({left:a, bottom:b});
- // break;
- // case 'w':
- // var a = grid._left + this.xoffset;
- // var b = (offsets.top + (this._plotDimensions.height - offsets.bottom))/2 - this.getHeight()/2;
- // this._elem.css({left:a, top:b});
- // break;
- // default: // same as 'se'
- // var a = grid._right - this.xoffset;
- // var b = grid._bottom + this.yoffset;
- // this._elem.css({right:a, bottom:b});
- // break;
- // }
- //
- // }
- // else {
- // switch (this.location) {
- // case 'nw':
- // var a = this._plotDimensions.width - grid._left + this.xoffset;
- // var b = grid._top + this.yoffset;
- // this._elem.css('right', a);
- // this._elem.css('top', b);
- // break;
- // case 'n':
- // var a = (offsets.left + (this._plotDimensions.width - offsets.right))/2 - this.getWidth()/2;
- // var b = this._plotDimensions.height - grid._top + this.yoffset;
- // this._elem.css('left', a);
- // this._elem.css('bottom', b);
- // break;
- // case 'ne':
- // var a = this._plotDimensions.width - offsets.right + this.xoffset;
- // var b = grid._top + this.yoffset;
- // this._elem.css({left:a, top:b});
- // break;
- // case 'e':
- // var a = this._plotDimensions.width - offsets.right + this.xoffset;
- // var b = (offsets.top + (this._plotDimensions.height - offsets.bottom))/2 - this.getHeight()/2;
- // this._elem.css({left:a, top:b});
- // break;
- // case 'se':
- // var a = this._plotDimensions.width - offsets.right + this.xoffset;
- // var b = offsets.bottom + this.yoffset;
- // this._elem.css({left:a, bottom:b});
- // break;
- // case 's':
- // var a = (offsets.left + (this._plotDimensions.width - offsets.right))/2 - this.getWidth()/2;
- // var b = this._plotDimensions.height - offsets.bottom + this.yoffset;
- // this._elem.css({left:a, top:b});
- // break;
- // case 'sw':
- // var a = this._plotDimensions.width - grid._left + this.xoffset;
- // var b = offsets.bottom + this.yoffset;
- // this._elem.css({right:a, bottom:b});
- // break;
- // case 'w':
- // var a = this._plotDimensions.width - grid._left + this.xoffset;
- // var b = (offsets.top + (this._plotDimensions.height - offsets.bottom))/2 - this.getHeight()/2;
- // this._elem.css({right:a, top:b});
- // break;
- // default: // same as 'se'
- // var a = grid._right - this.xoffset;
- // var b = grid._bottom + this.yoffset;
- // this._elem.css({right:a, bottom:b});
- // break;
- // }
- // }
- // }
- // };
-
- // setup default renderers for axes and legend so user doesn't have to
- // called with scope of plot
- function preInit(target, data, options) {
- options = options || {};
- options.axesDefaults = options.axesDefaults || {};
- options.legend = options.legend || {};
- options.seriesDefaults = options.seriesDefaults || {};
- // only set these if there is a funnel series
- var setopts = false;
- if (options.seriesDefaults.renderer == $.jqplot.FunnelRenderer) {
- setopts = true;
- }
- else if (options.series) {
- for (var i=0; i < options.series.length; i++) {
- if (options.series[i].renderer == $.jqplot.FunnelRenderer) {
- setopts = true;
- }
- }
- }
-
- if (setopts) {
- options.axesDefaults.renderer = $.jqplot.FunnelAxisRenderer;
- options.legend.renderer = $.jqplot.FunnelLegendRenderer;
- options.legend.preDraw = true;
- options.sortData = false;
- options.seriesDefaults.pointLabels = {show: false};
- }
- }
-
- function postInit(target, data, options) {
- // if multiple series, add a reference to the previous one so that
- // funnel rings can nest.
- for (var i=0; i570)?m[n]*0.8:m[n]+0.4*(255-m[n]);m[n]=parseInt(m[n],10)}this.highlightColors.push("rgb("+m[0]+","+m[1]+","+m[2]+")")}}t.postParseOptionsHooks.addOnce(k);t.postInitHooks.addOnce(g);t.eventListenerHooks.addOnce("jqplotMouseMove",a);t.eventListenerHooks.addOnce("jqplotMouseDown",b);t.eventListenerHooks.addOnce("jqplotMouseUp",j);t.eventListenerHooks.addOnce("jqplotClick",f);t.eventListenerHooks.addOnce("jqplotRightClick",l);t.postDrawHooks.addOnce(h)};e.jqplot.FunnelRenderer.prototype.setGridData=function(o){var n=0;var p=[];for(var m=0;mthis._lengths[Y]*n&&W<100){this._lengths[Y]=this._areas[Y]/(this._bases[Y]-this._lengths[Y]*Math.tan(this._angle));aa=Math.abs(this._lengths[Y]-E);this._bases[Y+1]=this._bases[Y]-(2*this._lengths[Y]*Math.tan(this._angle));E=this._lengths[Y];W++}Q+=this._lengths[Y]}this._vertices=new Array(B.length);var ae=[t,F],ad=[t+this._bases[0],F],ac=[t+(this._bases[0]-this._bases[this._bases.length-1])/2,F+this._length],ab=[ac[0]+this._bases[this._bases.length-1],ac[1]];function V(ag){var x=(ae[1]-ac[1])/(ae[0]-ac[0]);var v=ae[1]-x*ae[0];var ah=ag+ae[1];return[(ah-v)/x,ah]}function D(ag){var x=(ad[1]-ab[1])/(ad[0]-ab[0]);var v=ad[1]-x*ad[0];var ah=ag+ad[1];return[(ah-v)/x,ah]}var T=w,S=u;var Z=0,m=0;for(Y=0;Y0&&Y0&&Y=this.dataLabelThreshold){var K,X;if(this.dataLabels=="label"){K=this.dataLabelFormatString||"%s";X=e.jqplot.sprintf(K,B[Y][0])}else{if(this.dataLabels=="value"){K=this.dataLabelFormatString||"%d";X=e.jqplot.sprintf(K,this.data[Y][1])}else{if(this.dataLabels=="percent"){K=this.dataLabelFormatString||"%d%%";X=e.jqplot.sprintf(K,B[Y][1]*100)}else{if(this.dataLabels.constructor==Array){K=this.dataLabelFormatString||"%s";X=e.jqplot.sprintf(K,this.dataLabels[this._dataIndices[Y]])}}}}var s=(this._radius)*this.dataLabelPositionFactor+this.sliceMargin+this.dataLabelNudge;var T=(U[0][0]+U[1][0])/2+this.canvas._offsets.left;var S=(U[1][1]+U[2][1])/2+this.canvas._offsets.top;var z=e(''+X+" ").insertBefore(p.eventCanvas._elem);T-=z.width()/2;S-=z.height()/2;T=Math.round(T);S=Math.round(S);z.css({left:T,top:S})}}};e.jqplot.FunnelAxisRenderer=function(){e.jqplot.LinearAxisRenderer.call(this)};e.jqplot.FunnelAxisRenderer.prototype=new e.jqplot.LinearAxisRenderer();e.jqplot.FunnelAxisRenderer.prototype.constructor=e.jqplot.FunnelAxisRenderer;e.jqplot.FunnelAxisRenderer.prototype.init=function(m){this.tickRenderer=e.jqplot.FunnelTickRenderer;e.extend(true,this,m);this._dataBounds={min:0,max:100};this.min=0;this.max=100;this.showTicks=false;this.ticks=[];this.showMark=false;this.show=false};e.jqplot.FunnelLegendRenderer=function(){e.jqplot.TableLegendRenderer.call(this)};e.jqplot.FunnelLegendRenderer.prototype=new e.jqplot.TableLegendRenderer();e.jqplot.FunnelLegendRenderer.prototype.constructor=e.jqplot.FunnelLegendRenderer;e.jqplot.FunnelLegendRenderer.prototype.init=function(m){this.numberRows=null;this.numberColumns=null;e.extend(true,this,m)};e.jqplot.FunnelLegendRenderer.prototype.draw=function(){var p=this;if(this.show){var x=this._series;var A="position:absolute;";A+=(this.background)?"background:"+this.background+";":"";A+=(this.border)?"border:"+this.border+";":"";A+=(this.fontSize)?"font-size:"+this.fontSize+";":"";A+=(this.fontFamily)?"font-family:"+this.fontFamily+";":"";A+=(this.textColor)?"color:"+this.textColor+";":"";A+=(this.marginTop!=null)?"margin-top:"+this.marginTop+";":"";A+=(this.marginBottom!=null)?"margin-bottom:"+this.marginBottom+";":"";A+=(this.marginLeft!=null)?"margin-left:"+this.marginLeft+";":"";A+=(this.marginRight!=null)?"margin-right:"+this.marginRight+";":"";this._elem=e('');var E=false,w=false,m,u;var y=x[0];var n=new e.jqplot.ColorGenerator(y.seriesColors);if(y.show){var F=y.data;if(this.numberRows){m=this.numberRows;if(!this.numberColumns){u=Math.ceil(F.length/m)}else{u=this.numberColumns}}else{if(this.numberColumns){u=this.numberColumns;m=Math.ceil(F.length/this.numberColumns)}else{m=F.length;u=1}}var D,C,o,r,q,t,v,B;var z=0;for(D=0;D').prependTo(this._elem)}else{o=e(' ').appendTo(this._elem)}for(C=0;C0){E=true}else{E=false}}else{if(D==m-1){E=false}else{E=true}}v=(E)?this.rowSpacing:"0";r=e(' ');q=e(' ');if(this.escapeHtml){q.text(t)}else{q.html(t)}if(w){q.prependTo(o);r.prependTo(o)}else{r.appendTo(o);q.appendTo(o)}E=true}z++}}}}return this._elem};function c(q,p,n){n=n||{};n.axesDefaults=n.axesDefaults||{};n.legend=n.legend||{};n.seriesDefaults=n.seriesDefaults||{};var m=false;if(n.seriesDefaults.renderer==e.jqplot.FunnelRenderer){m=true}else{if(n.series){for(var o=0;o
- *
- * A tooltip providing information about the data point is enabled by default.
- * To disable the tooltip, set "showTooltip" to false.
- *
- * You can control what data is displayed in the tooltip with various
- * options. The "tooltipAxes" option controls wether the x, y or both
- * data values are displayed.
- *
- * Some chart types (e.g. hi-low-close) have more than one y value per
- * data point. To display the additional values in the tooltip, set the
- * "yvalues" option to the desired number of y values present (3 for a hlc chart).
- *
- * By default, data values will be formatted with the same formatting
- * specifiers as used to format the axis ticks. A custom format code
- * can be supplied with the tooltipFormatString option. This will apply
- * to all values in the tooltip.
- *
- * For more complete control, the "formatString" option can be set. This
- * Allows conplete control over tooltip formatting. Values are passed to
- * the format string in an order determined by the "tooltipAxes" and "yvalues"
- * options. So, if you have a hi-low-close chart and you just want to display
- * the hi-low-close values in the tooltip, you could set a formatString like:
- *
- * > highlighter: {
- * > tooltipAxes: 'y',
- * > yvalues: 3,
- * > formatString:'
- * > hi: %s
- * > low: %s
- * > close: %s
'
- * > }
- *
- */
- $.jqplot.Highlighter = function(options) {
- // Group: Properties
- //
- //prop: show
- // true to show the highlight.
- this.show = $.jqplot.config.enablePlugins;
- // prop: markerRenderer
- // Renderer used to draw the marker of the highlighted point.
- // Renderer will assimilate attributes from the data point being highlighted,
- // so no attributes need set on the renderer directly.
- // Default is to turn off shadow drawing on the highlighted point.
- this.markerRenderer = new $.jqplot.MarkerRenderer({shadow:false});
- // prop: showMarker
- // true to show the marker
- this.showMarker = true;
- // prop: lineWidthAdjust
- // Pixels to add to the lineWidth of the highlight.
- this.lineWidthAdjust = 2.5;
- // prop: sizeAdjust
- // Pixels to add to the overall size of the highlight.
- this.sizeAdjust = 5;
- // prop: showTooltip
- // Show a tooltip with data point values.
- this.showTooltip = true;
- // prop: tooltipLocation
- // Where to position tooltip, 'n', 'ne', 'e', 'se', 's', 'sw', 'w', 'nw'
- this.tooltipLocation = 'nw';
- // prop: fadeTooltip
- // true = fade in/out tooltip, flase = show/hide tooltip
- this.fadeTooltip = true;
- // prop: tooltipFadeSpeed
- // 'slow', 'def', 'fast', or number of milliseconds.
- this.tooltipFadeSpeed = "fast";
- // prop: tooltipOffset
- // Pixel offset of tooltip from the highlight.
- this.tooltipOffset = 2;
- // prop: tooltipAxes
- // Which axes to display in tooltip, 'x', 'y' or 'both', 'xy' or 'yx'
- // 'both' and 'xy' are equivalent, 'yx' reverses order of labels.
- this.tooltipAxes = 'both';
- // prop; tooltipSeparator
- // String to use to separate x and y axes in tooltip.
- this.tooltipSeparator = ', ';
- // prop; tooltipContentEditor
- // Function used to edit/augment/replace the formatted tooltip contents.
- // Called as str = tooltipContentEditor(str, seriesIndex, pointIndex)
- // where str is the generated tooltip html and seriesIndex and pointIndex identify
- // the data point being highlighted. Should return the html for the tooltip contents.
- this.tooltipContentEditor = null;
- // prop: useAxesFormatters
- // Use the x and y axes formatters to format the text in the tooltip.
- this.useAxesFormatters = true;
- // prop: tooltipFormatString
- // sprintf format string for the tooltip.
- // Uses Ash Searle's javascript sprintf implementation
- // found here: http://hexmen.com/blog/2007/03/printf-sprintf/
- // See http://perldoc.perl.org/functions/sprintf.html for reference.
- // Additional "p" and "P" format specifiers added by Chris Leonello.
- this.tooltipFormatString = '%.5P';
- // prop: formatString
- // alternative to tooltipFormatString
- // will format the whole tooltip text, populating with x, y values as
- // indicated by tooltipAxes option. So, you could have a tooltip like:
- // 'Date: %s, number of cats: %d' to format the whole tooltip at one go.
- // If useAxesFormatters is true, values will be formatted according to
- // Axes formatters and you can populate your tooltip string with
- // %s placeholders.
- this.formatString = null;
- // prop: yvalues
- // Number of y values to expect in the data point array.
- // Typically this is 1. Certain plots, like OHLC, will
- // have more y values in each data point array.
- this.yvalues = 1;
- // prop: bringSeriesToFront
- // This option requires jQuery 1.4+
- // True to bring the series of the highlighted point to the front
- // of other series.
- this.bringSeriesToFront = false;
- this._tooltipElem;
- this.isHighlighting = false;
- this.currentNeighbor = null;
-
- $.extend(true, this, options);
- };
-
- var locations = ['nw', 'n', 'ne', 'e', 'se', 's', 'sw', 'w'];
- var locationIndicies = {'nw':0, 'n':1, 'ne':2, 'e':3, 'se':4, 's':5, 'sw':6, 'w':7};
- var oppositeLocations = ['se', 's', 'sw', 'w', 'nw', 'n', 'ne', 'e'];
-
- // axis.renderer.tickrenderer.formatter
-
- // called with scope of plot
- $.jqplot.Highlighter.init = function (target, data, opts){
- var options = opts || {};
- // add a highlighter attribute to the plot
- this.plugins.highlighter = new $.jqplot.Highlighter(options.highlighter);
- };
-
- // called within scope of series
- $.jqplot.Highlighter.parseOptions = function (defaults, options) {
- // Add a showHighlight option to the series
- // and set it to true by default.
- this.showHighlight = true;
- };
-
- // called within context of plot
- // create a canvas which we can draw on.
- // insert it before the eventCanvas, so eventCanvas will still capture events.
- $.jqplot.Highlighter.postPlotDraw = function() {
- // Memory Leaks patch
- if (this.plugins.highlighter && this.plugins.highlighter.highlightCanvas) {
- this.plugins.highlighter.highlightCanvas.resetCanvas();
- this.plugins.highlighter.highlightCanvas = null;
- }
-
- if (this.plugins.highlighter && this.plugins.highlighter._tooltipElem) {
- this.plugins.highlighter._tooltipElem.emptyForce();
- this.plugins.highlighter._tooltipElem = null;
- }
-
- this.plugins.highlighter.highlightCanvas = new $.jqplot.GenericCanvas();
-
- this.eventCanvas._elem.before(this.plugins.highlighter.highlightCanvas.createElement(this._gridPadding, 'jqplot-highlight-canvas', this._plotDimensions, this));
- this.plugins.highlighter.highlightCanvas.setContext();
-
- var elem = document.createElement('div');
- this.plugins.highlighter._tooltipElem = $(elem);
- elem = null;
- this.plugins.highlighter._tooltipElem.addClass('jqplot-highlighter-tooltip');
- this.plugins.highlighter._tooltipElem.css({position:'absolute', display:'none'});
-
- this.eventCanvas._elem.before(this.plugins.highlighter._tooltipElem);
- };
-
- $.jqplot.preInitHooks.push($.jqplot.Highlighter.init);
- $.jqplot.preParseSeriesOptionsHooks.push($.jqplot.Highlighter.parseOptions);
- $.jqplot.postDrawHooks.push($.jqplot.Highlighter.postPlotDraw);
-
- function draw(plot, neighbor) {
- var hl = plot.plugins.highlighter;
- var s = plot.series[neighbor.seriesIndex];
- var smr = s.markerRenderer;
- var mr = hl.markerRenderer;
- mr.style = smr.style;
- mr.lineWidth = smr.lineWidth + hl.lineWidthAdjust;
- mr.size = smr.size + hl.sizeAdjust;
- var rgba = $.jqplot.getColorComponents(smr.color);
- var newrgb = [rgba[0], rgba[1], rgba[2]];
- var alpha = (rgba[3] >= 0.6) ? rgba[3]*0.6 : rgba[3]*(2-rgba[3]);
- mr.color = 'rgba('+newrgb[0]+','+newrgb[1]+','+newrgb[2]+','+alpha+')';
- mr.init();
- mr.draw(s.gridData[neighbor.pointIndex][0], s.gridData[neighbor.pointIndex][1], hl.highlightCanvas._ctx);
- }
-
- function showTooltip(plot, series, neighbor) {
- // neighbor looks like: {seriesIndex: i, pointIndex:j, gridData:p, data:s.data[j]}
- // gridData should be x,y pixel coords on the grid.
- // add the plot._gridPadding to that to get x,y in the target.
- var hl = plot.plugins.highlighter;
- var elem = hl._tooltipElem;
- var serieshl = series.highlighter || {};
-
- var opts = $.extend(true, {}, hl, serieshl);
-
- if (opts.useAxesFormatters) {
- var xf = series._xaxis._ticks[0].formatter;
- var yf = series._yaxis._ticks[0].formatter;
- var xfstr = series._xaxis._ticks[0].formatString;
- var yfstr = series._yaxis._ticks[0].formatString;
- var str;
- var xstr = xf(xfstr, neighbor.data[0]);
- var ystrs = [];
- for (var i=1; i=0.6)?l[3]*0.6:l[3]*(2-l[3]);i.color="rgba("+n[0]+","+n[1]+","+n[2]+","+k+")";i.init();i.draw(p.gridData[o.pointIndex][0],p.gridData[o.pointIndex][1],j.highlightCanvas._ctx)}function g(A,q,m){var k=A.plugins.highlighter;var D=k._tooltipElem;var r=q.highlighter||{};var t=d.extend(true,{},k,r);if(t.useAxesFormatters){var w=q._xaxis._ticks[0].formatter;var h=q._yaxis._ticks[0].formatter;var E=q._xaxis._ticks[0].formatString;var s=q._yaxis._ticks[0].formatString;var z;var u=w(E,m.data[0]);var l=[];for(var B=1;B
- *
- * and supply the appropriate options to your plot
- *
- * > {axes:{xaxis:{renderer:$.jqplot.LogAxisRenderer}}}
- **/
- $.jqplot.LogAxisRenderer = function() {
- $.jqplot.LinearAxisRenderer.call(this);
- // prop: axisDefaults
- // Default properties which will be applied directly to the series.
- //
- // Group: Properties
- //
- // Properties
- //
- // base - the logarithmic base, commonly 2, 10 or Math.E
- // tickDistribution - Deprecated. "power" distribution of ticks
- // always used. Option has no effect.
- this.axisDefaults = {
- base : 10,
- tickDistribution :'power'
- };
- };
-
- $.jqplot.LogAxisRenderer.prototype = new $.jqplot.LinearAxisRenderer();
- $.jqplot.LogAxisRenderer.prototype.constructor = $.jqplot.LogAxisRenderer;
-
- $.jqplot.LogAxisRenderer.prototype.init = function(options) {
- // prop: drawBaseline
- // True to draw the axis baseline.
- this.drawBaseline = true;
- // prop: minorTicks
- // Number of ticks to add between "major" ticks.
- // Major ticks are ticks supplied by user or auto computed.
- // Minor ticks cannot be created by user.
- this.minorTicks = 'auto';
- this._scalefact = 1.0;
-
- $.extend(true, this, options);
-
- this._autoFormatString = '%d';
- this._overrideFormatString = false;
-
- for (var d in this.renderer.axisDefaults) {
- if (this[d] == null) {
- this[d] = this.renderer.axisDefaults[d];
- }
- }
-
- this.resetDataBounds();
- };
-
- $.jqplot.LogAxisRenderer.prototype.createTicks = function(plot) {
- // we're are operating on an axis here
- var ticks = this._ticks;
- var userTicks = this.ticks;
- var name = this.name;
- var db = this._dataBounds;
- var dim = (this.name.charAt(0) === 'x') ? this._plotDimensions.width : this._plotDimensions.height;
- var interval;
- var min, max;
- var pos1, pos2;
- var tt, i;
-
- var threshold = 30;
- // For some reason scalefactor is screwing up ticks.
- this._scalefact = (Math.max(dim, threshold+1) - threshold)/300;
-
- // if we already have ticks, use them.
- // ticks must be in order of increasing value.
- if (userTicks.length) {
- // ticks could be 1D or 2D array of [val, val, ,,,] or [[val, label], [val, label], ...] or mixed
- for (i=0; i 140) {
- numberTicks = Math.round(Math.log(this.max/this.min)/Math.log(this.base) + 1);
- if (numberTicks < 2) {
- numberTicks = 2;
- }
- if (minorTicks === 0) {
- var temp = dim/(numberTicks - 1);
- if (temp < 100) {
- minorTicks = 0;
- }
- else if (temp < 190) {
- minorTicks = 1;
- }
- else if (temp < 250) {
- minorTicks = 3;
- }
- else if (temp < 600) {
- minorTicks = 4;
- }
- else {
- minorTicks = 9;
- }
- }
- }
- else {
- numberTicks = 2;
- if (minorTicks === 0) {
- minorTicks = 1;
- }
- minorTicks = 0;
- }
- }
- else {
- numberTicks = this.numberTicks;
- }
-
- if (order >= 0 && minorTicks !== 3) {
- this._autoFormatString = '%d';
- }
- // Adjust format string for case with 3 ticks where we'll have like 1, 2.5, 5, 7.5, 10
- else if (order <= 0 && minorTicks === 3) {
- var temp = -(order - 1);
- this._autoFormatString = '%.'+ Math.abs(order-1) + 'f';
- }
-
- // Adjust format string for values less than 1.
- else if (order < 0) {
- var temp = -order;
- this._autoFormatString = '%.'+ Math.abs(order) + 'f';
- }
-
- else {
- this._autoFormatString = '%d';
- }
-
- var to, t, val, tt1, spread, interval;
- for (var i=0; i=0; j--) {
- val = tt1-interval*(j+1);
- t = new this.tickRenderer(this.tickOptions);
-
- if (this._overrideFormatString && this._autoFormatString != '') {
- t.formatString = this._autoFormatString;
- }
- if (!this.showTicks) {
- t.showLabel = false;
- t.showMark = false;
- }
- else if (!this.showTickMarks) {
- t.showMark = false;
- }
- t.setTick(val, this.name);
- this._ticks.push(t);
- }
- }
- }
- }
-
- // min and max are set as would be the case with zooming
- else if (this.min != null && this.max != null) {
- var opts = $.extend(true, {}, this.tickOptions, {name: this.name, value: null});
- var nt, ti;
- // don't have an interval yet, pick one that gives the most
- // "round" ticks we can get.
- if (this.numberTicks == null && this.tickInterval == null) {
- // var threshold = 30;
- var tdim = Math.max(dim, threshold+1);
- var nttarget = Math.ceil((tdim-threshold)/35 + 1);
-
- var ret = $.jqplot.LinearTickGenerator.bestConstrainedInterval(this.min, this.max, nttarget);
-
- this._autoFormatString = ret[3];
- nt = ret[2];
- ti = ret[4];
-
- for (var i=0; i 0) {
- shim = -t._textRenderer.height * Math.cos(-t._textRenderer.angle) / 2;
- }
- else {
- shim = -t.getHeight() + t._textRenderer.height * Math.cos(t._textRenderer.angle) / 2;
- }
- break;
- case 'middle':
- // if (t.angle > 0) {
- // shim = -t.getHeight()/2 + t._textRenderer.height * Math.sin(-t._textRenderer.angle) / 2;
- // }
- // else {
- // shim = -t.getHeight()/2 - t._textRenderer.height * Math.sin(t._textRenderer.angle) / 2;
- // }
- shim = -t.getHeight()/2;
- break;
- default:
- shim = -t.getHeight()/2;
- break;
- }
- }
- else {
- shim = -t.getHeight()/2;
- }
-
- var val = this.u2p(t.value) + shim + 'px';
- t._elem.css('top', val);
- t.pack();
- }
- }
- if (lshow) {
- var h = this._label._elem.outerHeight(true);
- this._label._elem.css('top', offmax - pixellength/2 - h/2 + 'px');
- if (this.name == 'yaxis') {
- this._label._elem.css('left', '0px');
- }
- else {
- this._label._elem.css('right', '0px');
- }
- this._label.pack();
- }
- }
- }
- };
-})(jQuery);
\ No newline at end of file
diff --git a/libreplan-webapp/src/main/webapp/jqplot/plugins/jqplot.logAxisRenderer.min.js b/libreplan-webapp/src/main/webapp/jqplot/plugins/jqplot.logAxisRenderer.min.js
deleted file mode 100644
index 0f254dace..000000000
--- a/libreplan-webapp/src/main/webapp/jqplot/plugins/jqplot.logAxisRenderer.min.js
+++ /dev/null
@@ -1,57 +0,0 @@
-/**
- * jqPlot
- * Pure JavaScript plotting plugin using jQuery
- *
- * Version: 1.0.0b2_r1012
- *
- * Copyright (c) 2009-2011 Chris Leonello
- * jqPlot is currently available for use in all personal or commercial projects
- * under both the MIT (http://www.opensource.org/licenses/mit-license.php) and GPL
- * version 2.0 (http://www.gnu.org/licenses/gpl-2.0.html) licenses. This means that you can
- * choose the license that best suits your project and use it accordingly.
- *
- * Although not required, the author would appreciate an email letting him
- * know of any substantial use of jqPlot. You can reach the author at:
- * chris at jqplot dot com or see http://www.jqplot.com/info.php .
- *
- * If you are feeling kind and generous, consider supporting the project by
- * making a donation at: http://www.jqplot.com/donate.php .
- *
- * sprintf functions contained in jqplot.sprintf.js by Ash Searle:
- *
- * version 2007.04.27
- * author Ash Searle
- * http://hexmen.com/blog/2007/03/printf-sprintf/
- * http://hexmen.com/js/sprintf.js
- * The author (Ash Searle) has placed this code in the public domain:
- * "This code is unrestricted: you are free to use it however you like."
- *
- * included jsDate library by Chris Leonello:
- *
- * Copyright (c) 2010-2011 Chris Leonello
- *
- * jsDate is currently available for use in all personal or commercial projects
- * under both the MIT and GPL version 2.0 licenses. This means that you can
- * choose the license that best suits your project and use it accordingly.
- *
- * jsDate borrows many concepts and ideas from the Date Instance
- * Methods by Ken Snyder along with some parts of Ken's actual code.
- *
- * Ken's origianl Date Instance Methods and copyright notice:
- *
- * Ken Snyder (ken d snyder at gmail dot com)
- * 2008-09-10
- * version 2.0.2 (http://kendsnyder.com/sandbox/date/)
- * Creative Commons Attribution License 3.0 (http://creativecommons.org/licenses/by/3.0/)
- *
- * jqplotToImage function based on Larry Siden's export-jqplot-to-png.js.
- * Larry has generously given permission to adapt his code for inclusion
- * into jqPlot.
- *
- * Larry's original code can be found here:
- *
- * https://github.com/lsiden/export-jqplot-to-png
- *
- *
- */
-(function(a){a.jqplot.LogAxisRenderer=function(){a.jqplot.LinearAxisRenderer.call(this);this.axisDefaults={base:10,tickDistribution:"power"}};a.jqplot.LogAxisRenderer.prototype=new a.jqplot.LinearAxisRenderer();a.jqplot.LogAxisRenderer.prototype.constructor=a.jqplot.LogAxisRenderer;a.jqplot.LogAxisRenderer.prototype.init=function(b){this.drawBaseline=true;this.minorTicks="auto";this._scalefact=1;a.extend(true,this,b);this._autoFormatString="%d";this._overrideFormatString=false;for(var c in this.renderer.axisDefaults){if(this[c]==null){this[c]=this.renderer.axisDefaults[c]}}this.resetDataBounds()};a.jqplot.LogAxisRenderer.prototype.createTicks=function(d){var G=this._ticks;var w=this.ticks;var s=this.name;var u=this._dataBounds;var b=(this.name.charAt(0)==="x")?this._plotDimensions.width:this._plotDimensions.height;var k;var N,v;var m,l;var M,K;var g=30;this._scalefact=(Math.max(b,g+1)-g)/300;if(w.length){for(K=0;K140){h=Math.round(Math.log(this.max/this.min)/Math.log(this.base)+1);if(h<2){h=2}if(C===0){var o=b/(h-1);if(o<100){C=0}else{if(o<190){C=1}else{if(o<250){C=3}else{if(o<600){C=4}else{C=9}}}}}}else{h=2;if(C===0){C=1}C=0}}else{h=this.numberTicks}if(E>=0&&C!==3){this._autoFormatString="%d"}else{if(E<=0&&C===3){var o=-(E-1);this._autoFormatString="%."+Math.abs(E-1)+"f"}else{if(E<0){var o=-E;this._autoFormatString="%."+Math.abs(E)+"f"}else{this._autoFormatString="%d"}}}var O,H,z,p,n,k;for(var K=0;K=0;J--){z=p-k*(J+1);H=new this.tickRenderer(this.tickOptions);if(this._overrideFormatString&&this._autoFormatString!=""){H.formatString=this._autoFormatString}if(!this.showTicks){H.showLabel=false;H.showMark=false}else{if(!this.showTickMarks){H.showMark=false}}H.setTick(z,this.name);this._ticks.push(H)}}}}else{if(this.min!=null&&this.max!=null){var y=a.extend(true,{},this.tickOptions,{name:this.name,value:null});var I,e;if(this.numberTicks==null&&this.tickInterval==null){var D=Math.max(b,g+1);var L=Math.ceil((D-g)/35+1);var B=a.jqplot.LinearTickGenerator.bestConstrainedInterval(this.min,this.max,L);this._autoFormatString=B[3];I=B[2];e=B[4];for(var K=0;K0){c=-n._textRenderer.height*Math.cos(-n._textRenderer.angle)/2}else{c=-n.getHeight()+n._textRenderer.height*Math.cos(n._textRenderer.angle)/2}break;case"middle":c=-n.getHeight()/2;break;default:c=-n.getHeight()/2;break}}else{c=-n.getHeight()/2}var z=this.u2p(n.value)+c+"px";n._elem.css("top",z);n.pack()}}if(o){var x=this._label._elem.outerHeight(true);this._label._elem.css("top",m-g/2-x/2+"px");if(this.name=="yaxis"){this._label._elem.css("left","0px")}else{this._label._elem.css("right","0px")}this._label.pack()}}}}})(jQuery);
\ No newline at end of file
diff --git a/libreplan-webapp/src/main/webapp/jqplot/plugins/jqplot.mekkoAxisRenderer.js b/libreplan-webapp/src/main/webapp/jqplot/plugins/jqplot.mekkoAxisRenderer.js
deleted file mode 100644
index 292256efa..000000000
--- a/libreplan-webapp/src/main/webapp/jqplot/plugins/jqplot.mekkoAxisRenderer.js
+++ /dev/null
@@ -1,610 +0,0 @@
-/**
- * jqPlot
- * Pure JavaScript plotting plugin using jQuery
- *
- * Version: 1.0.0b2_r1012
- *
- * Copyright (c) 2009-2011 Chris Leonello
- * jqPlot is currently available for use in all personal or commercial projects
- * under both the MIT (http://www.opensource.org/licenses/mit-license.php) and GPL
- * version 2.0 (http://www.gnu.org/licenses/gpl-2.0.html) licenses. This means that you can
- * choose the license that best suits your project and use it accordingly.
- *
- * Although not required, the author would appreciate an email letting him
- * know of any substantial use of jqPlot. You can reach the author at:
- * chris at jqplot dot com or see http://www.jqplot.com/info.php .
- *
- * If you are feeling kind and generous, consider supporting the project by
- * making a donation at: http://www.jqplot.com/donate.php .
- *
- * sprintf functions contained in jqplot.sprintf.js by Ash Searle:
- *
- * version 2007.04.27
- * author Ash Searle
- * http://hexmen.com/blog/2007/03/printf-sprintf/
- * http://hexmen.com/js/sprintf.js
- * The author (Ash Searle) has placed this code in the public domain:
- * "This code is unrestricted: you are free to use it however you like."
- *
- */
-(function($) {
- // class: $.jqplot.MekkoAxisRenderer
- // An axis renderer for a Mekko chart.
- // Should be used with a Mekko chart where the mekkoRenderer is used on the series.
- // Displays the Y axis as a range from 0 to 1 (0 to 100%) and the x axis with a tick
- // for each series scaled to the sum of all the y values.
- $.jqplot.MekkoAxisRenderer = function() {
- };
-
- // called with scope of axis object.
- $.jqplot.MekkoAxisRenderer.prototype.init = function(options){
- // prop: tickMode
- // How to space the ticks on the axis.
- // 'bar' will place a tick at the width of each bar.
- // This is the default for the x axis.
- // 'even' will place ticks at even intervals. This is
- // the default for x2 axis and y axis. y axis cannot be changed.
- this.tickMode;
- // prop: barLabelRenderer
- // renderer to use to draw labels under each bar.
- this.barLabelRenderer = $.jqplot.AxisLabelRenderer;
- // prop: barLabels
- // array of labels to put under each bar.
- this.barLabels = this.barLabels || [];
- // prop: barLabelOptions
- // options object to pass to the bar label renderer.
- this.barLabelOptions = {};
- this.tickOptions = $.extend(true, {showGridline:false}, this.tickOptions);
- this._barLabels = [];
- $.extend(true, this, options);
- if (this.name == 'yaxis') {
- this.tickOptions.formatString = this.tickOptions.formatString || "%d\%";
- }
- var db = this._dataBounds;
- db.min = 0;
- // for y axes, scale always go from 0 to 1 (0 to 100%)
- if (this.name == 'yaxis' || this.name == 'y2axis') {
- db.max = 100;
- this.tickMode = 'even';
- }
- // For x axes, scale goes from 0 to sum of all y values.
- else if (this.name == 'xaxis'){
- this.tickMode = (this.tickMode == null) ? 'bar' : this.tickMode;
- for (var i=0; i dim) {
- dim = temp;
- }
- }
- }
-
- if (lshow) {
- w = this._label._elem.outerWidth(true);
- h = this._label._elem.outerHeight(true);
- }
- if (this.name == 'xaxis') {
- dim = dim + h;
- this._elem.css({'height':dim+'px', left:'0px', bottom:'0px'});
- }
- else if (this.name == 'x2axis') {
- dim = dim + h;
- this._elem.css({'height':dim+'px', left:'0px', top:'0px'});
- }
- else if (this.name == 'yaxis') {
- dim = dim + w;
- this._elem.css({'width':dim+'px', left:'0px', top:'0px'});
- if (lshow && this._label.constructor == $.jqplot.AxisLabelRenderer) {
- this._label._elem.css('width', w+'px');
- }
- }
- else {
- dim = dim + w;
- this._elem.css({'width':dim+'px', right:'0px', top:'0px'});
- if (lshow && this._label.constructor == $.jqplot.AxisLabelRenderer) {
- this._label._elem.css('width', w+'px');
- }
- }
- }
- };
-
- // called with scope of axis
- $.jqplot.MekkoAxisRenderer.prototype.createTicks = function() {
- // we're are operating on an axis here
- var ticks = this._ticks;
- var userTicks = this.ticks;
- var name = this.name;
- // databounds were set on axis initialization.
- var db = this._dataBounds;
- var dim, interval;
- var min, max;
- var pos1, pos2;
- var t, tt, i, j;
-
- // if we already have ticks, use them.
- // ticks must be in order of increasing value.
-
- if (userTicks.length) {
- // ticks could be 1D or 2D array of [val, val, ,,,] or [[val, label], [val, label], ...] or mixed
- for (i=0; i 0) {
- adj = Math.max(Math.log(min)/Math.LN10, 0.05);
- }
- min -= adj;
- max += adj;
- }
-
- var range = max - min;
- var rmin, rmax;
- var temp, prev, curr;
- var ynumticks = [3,5,6,11,21];
-
- // yaxis divide ticks in nice intervals from 0 to 1.
- if (this.name == 'yaxis' || this.name == 'y2axis') {
- this.min = 0;
- this.max = 100;
- // user didn't specify number of ticks.
- if (!this.numberTicks){
- if (this.tickInterval) {
- this.numberTicks = 3 + Math.ceil(range / this.tickInterval);
- }
- else {
- temp = 2 + Math.ceil((dim-(this.tickSpacing-1))/this.tickSpacing);
- for (i=0; i 1) {
- prev = curr;
- continue;
- }
- else if (curr < 1) {
- // was prev or is curr closer to one?
- if (Math.abs(prev - 1) < Math.abs(curr - 1)) {
- this.numberTicks = ynumticks[i-1];
- break;
- }
- else {
- this.numberTicks = ynumticks[i];
- break;
- }
- }
- else if (i == ynumticks.length -1) {
- this.numberTicks = ynumticks[i];
- }
- }
- this.tickInterval = range / (this.numberTicks - 1);
- }
- }
-
- // user did specify number of ticks.
- else {
- this.tickInterval = range / (this.numberTicks - 1);
- }
-
- for (var i=0; i temp) {
- t = new this.tickRenderer(this.tickOptions);
- if (!this.showTicks) {
- t.showLabel = false;
- t.showMark = false;
- }
- else if (!this.showTickMarks) {
- t.showMark = false;
- }
- t.setTick(this.max, this.name);
- this._ticks.push(t);
-
- }
- }
-
- else if (this.tickMode == 'even') {
- this.min = 0;
- this.max = this.max || db.max;
- // get a desired number of ticks
- var nt = 2 + Math.ceil((dim-(this.tickSpacing-1))/this.tickSpacing);
- range = this.max - this.min;
- this.numberTicks = nt;
- this.tickInterval = range / (this.numberTicks - 1);
-
- for (i=0; i 0) {
- shim = -t._textRenderer.height * Math.cos(-t._textRenderer.angle) / 2;
- }
- else {
- shim = -t.getHeight() + t._textRenderer.height * Math.cos(t._textRenderer.angle) / 2;
- }
- break;
- case 'middle':
- shim = -t.getHeight()/2;
- break;
- default:
- shim = -t.getHeight()/2;
- break;
- }
- }
- else {
- shim = -t.getHeight()/2;
- }
-
- var val = this.u2p(t.value) + shim + 'px';
- t._elem.css('top', val);
- t.pack();
- }
- }
- if (lshow) {
- var h = this._label._elem.outerHeight(true);
- this._label._elem.css('top', offmax - pixellength/2 - h/2 + 'px');
- if (this.name == 'yaxis') {
- this._label._elem.css('left', '0px');
- }
- else {
- this._label._elem.css('right', '0px');
- }
- this._label.pack();
- }
- }
- }
- };
-})(jQuery);
diff --git a/libreplan-webapp/src/main/webapp/jqplot/plugins/jqplot.mekkoAxisRenderer.min.js b/libreplan-webapp/src/main/webapp/jqplot/plugins/jqplot.mekkoAxisRenderer.min.js
deleted file mode 100644
index 8eac794d9..000000000
--- a/libreplan-webapp/src/main/webapp/jqplot/plugins/jqplot.mekkoAxisRenderer.min.js
+++ /dev/null
@@ -1,57 +0,0 @@
-/**
- * jqPlot
- * Pure JavaScript plotting plugin using jQuery
- *
- * Version: 1.0.0b2_r1012
- *
- * Copyright (c) 2009-2011 Chris Leonello
- * jqPlot is currently available for use in all personal or commercial projects
- * under both the MIT (http://www.opensource.org/licenses/mit-license.php) and GPL
- * version 2.0 (http://www.gnu.org/licenses/gpl-2.0.html) licenses. This means that you can
- * choose the license that best suits your project and use it accordingly.
- *
- * Although not required, the author would appreciate an email letting him
- * know of any substantial use of jqPlot. You can reach the author at:
- * chris at jqplot dot com or see http://www.jqplot.com/info.php .
- *
- * If you are feeling kind and generous, consider supporting the project by
- * making a donation at: http://www.jqplot.com/donate.php .
- *
- * sprintf functions contained in jqplot.sprintf.js by Ash Searle:
- *
- * version 2007.04.27
- * author Ash Searle
- * http://hexmen.com/blog/2007/03/printf-sprintf/
- * http://hexmen.com/js/sprintf.js
- * The author (Ash Searle) has placed this code in the public domain:
- * "This code is unrestricted: you are free to use it however you like."
- *
- * included jsDate library by Chris Leonello:
- *
- * Copyright (c) 2010-2011 Chris Leonello
- *
- * jsDate is currently available for use in all personal or commercial projects
- * under both the MIT and GPL version 2.0 licenses. This means that you can
- * choose the license that best suits your project and use it accordingly.
- *
- * jsDate borrows many concepts and ideas from the Date Instance
- * Methods by Ken Snyder along with some parts of Ken's actual code.
- *
- * Ken's origianl Date Instance Methods and copyright notice:
- *
- * Ken Snyder (ken d snyder at gmail dot com)
- * 2008-09-10
- * version 2.0.2 (http://kendsnyder.com/sandbox/date/)
- * Creative Commons Attribution License 3.0 (http://creativecommons.org/licenses/by/3.0/)
- *
- * jqplotToImage function based on Larry Siden's export-jqplot-to-png.js.
- * Larry has generously given permission to adapt his code for inclusion
- * into jqPlot.
- *
- * Larry's original code can be found here:
- *
- * https://github.com/lsiden/export-jqplot-to-png
- *
- *
- */
-(function(a){a.jqplot.MekkoAxisRenderer=function(){};a.jqplot.MekkoAxisRenderer.prototype.init=function(c){this.tickMode;this.barLabelRenderer=a.jqplot.AxisLabelRenderer;this.barLabels=this.barLabels||[];this.barLabelOptions={};this.tickOptions=a.extend(true,{showGridline:false},this.tickOptions);this._barLabels=[];a.extend(true,this,c);if(this.name=="yaxis"){this.tickOptions.formatString=this.tickOptions.formatString||"%d%"}var b=this._dataBounds;b.min=0;if(this.name=="yaxis"||this.name=="y2axis"){b.max=100;this.tickMode="even"}else{if(this.name=="xaxis"){this.tickMode=(this.tickMode==null)?"bar":this.tickMode;for(var d=0;dk){k=d}}}if(b){c=this._label._elem.outerWidth(true);j=this._label._elem.outerHeight(true)}if(this.name=="xaxis"){k=k+j;this._elem.css({height:k+"px",left:"0px",bottom:"0px"})}else{if(this.name=="x2axis"){k=k+j;this._elem.css({height:k+"px",left:"0px",top:"0px"})}else{if(this.name=="yaxis"){k=k+c;this._elem.css({width:k+"px",left:"0px",top:"0px"});if(b&&this._label.constructor==a.jqplot.AxisLabelRenderer){this._label._elem.css("width",c+"px")}}else{k=k+c;this._elem.css({width:k+"px",right:"0px",top:"0px"});if(b&&this._label.constructor==a.jqplot.AxisLabelRenderer){this._label._elem.css("width",c+"px")}}}}}};a.jqplot.MekkoAxisRenderer.prototype.createTicks=function(){var z=this._ticks;var w=this.ticks;var B=this.name;var y=this._dataBounds;var p,x;var n,r;var d,c;var h,b,s,q;if(w.length){for(s=0;s0){g=Math.max(Math.log(n)/Math.LN10,0.05)}n-=g;r+=g}var k=r-n;var m,o;var v,l,u;var f=[3,5,6,11,21];if(this.name=="yaxis"||this.name=="y2axis"){this.min=0;this.max=100;if(!this.numberTicks){if(this.tickInterval){this.numberTicks=3+Math.ceil(k/this.tickInterval)}else{v=2+Math.ceil((p-(this.tickSpacing-1))/this.tickSpacing);for(s=0;s1){l=u;continue}else{if(u<1){if(Math.abs(l-1)v){h=new this.tickRenderer(this.tickOptions);if(!this.showTicks){h.showLabel=false;h.showMark=false}else{if(!this.showTickMarks){h.showMark=false}}h.setTick(this.max,this.name);this._ticks.push(h)}}else{if(this.tickMode=="even"){this.min=0;this.max=this.max||y.max;var A=2+Math.ceil((p-(this.tickSpacing-1))/this.tickSpacing);k=this.max-this.min;this.numberTicks=A;this.tickInterval=k/(this.numberTicks-1);for(s=0;s0){c=-n._textRenderer.height*Math.cos(-n._textRenderer.angle)/2}else{c=-n.getHeight()+n._textRenderer.height*Math.cos(n._textRenderer.angle)/2}break;case"middle":c=-n.getHeight()/2;break;default:c=-n.getHeight()/2;break}}else{c=-n.getHeight()/2}var D=this.u2p(n.value)+c+"px";n._elem.css("top",D);n.pack()}}if(o){var z=this._label._elem.outerHeight(true);this._label._elem.css("top",m-f/2-z/2+"px");if(this.name=="yaxis"){this._label._elem.css("left","0px")}else{this._label._elem.css("right","0px")}this._label.pack()}}}}})(jQuery);
\ No newline at end of file
diff --git a/libreplan-webapp/src/main/webapp/jqplot/plugins/jqplot.mekkoRenderer.js b/libreplan-webapp/src/main/webapp/jqplot/plugins/jqplot.mekkoRenderer.js
deleted file mode 100644
index 9f1a76de2..000000000
--- a/libreplan-webapp/src/main/webapp/jqplot/plugins/jqplot.mekkoRenderer.js
+++ /dev/null
@@ -1,436 +0,0 @@
-/**
- * jqPlot
- * Pure JavaScript plotting plugin using jQuery
- *
- * Version: 1.0.0b2_r1012
- *
- * Copyright (c) 2009-2011 Chris Leonello
- * jqPlot is currently available for use in all personal or commercial projects
- * under both the MIT (http://www.opensource.org/licenses/mit-license.php) and GPL
- * version 2.0 (http://www.gnu.org/licenses/gpl-2.0.html) licenses. This means that you can
- * choose the license that best suits your project and use it accordingly.
- *
- * Although not required, the author would appreciate an email letting him
- * know of any substantial use of jqPlot. You can reach the author at:
- * chris at jqplot dot com or see http://www.jqplot.com/info.php .
- *
- * If you are feeling kind and generous, consider supporting the project by
- * making a donation at: http://www.jqplot.com/donate.php .
- *
- * sprintf functions contained in jqplot.sprintf.js by Ash Searle:
- *
- * version 2007.04.27
- * author Ash Searle
- * http://hexmen.com/blog/2007/03/printf-sprintf/
- * http://hexmen.com/js/sprintf.js
- * The author (Ash Searle) has placed this code in the public domain:
- * "This code is unrestricted: you are free to use it however you like."
- *
- */
-(function($) {
- /**
- * Class: $.jqplot.MekkoRenderer
- * Draws a Mekko style chart which shows 3 dimensional data on a 2 dimensional graph.
- * the <$.jqplot.MekkoAxisRenderer> should be used with mekko charts. The mekko renderer
- * overrides the default legend renderer with it's own $.jqplot.MekkoLegendRenderer
- * which allows more flexibility to specify number of rows and columns in the legend.
- *
- * Data is specified per bar in the chart. You can specify data as an array of y values, or as
- * an array of [label, value] pairs. Note that labels are used only on the first series.
- * Labels on subsequent series are ignored:
- *
- * > bar1 = [['shirts', 8],['hats', 14],['shoes', 6],['gloves', 16],['dolls', 12]];
- * > bar2 = [15,6,9,13,6];
- * > bar3 = [['grumpy',4],['sneezy',2],['happy',7],['sleepy',9],['doc',7]];
- *
- * If you want to place labels for each bar under the axis, you use the barLabels option on
- * the axes. The bar labels can be styled with the ".jqplot-mekko-barLabel" css class.
- *
- * > barLabels = ['Mickey Mouse', 'Donald Duck', 'Goofy'];
- * > axes:{xaxis:{barLabels:barLabels}}
- *
- */
-
-
- $.jqplot.MekkoRenderer = function(){
- this.shapeRenderer = new $.jqplot.ShapeRenderer();
- // prop: borderColor
- // color of the borders between areas on the chart
- this.borderColor = null;
- // prop: showBorders
- // True to draw borders lines between areas on the chart.
- // False will draw borders lines with the same color as the area.
- this.showBorders = true;
- };
-
- // called with scope of series.
- $.jqplot.MekkoRenderer.prototype.init = function(options, plot) {
- this.fill = false;
- this.fillRect = true;
- this.strokeRect = true;
- this.shadow = false;
- // width of bar on x axis.
- this._xwidth = 0;
- this._xstart = 0;
- $.extend(true, this.renderer, options);
- // set the shape renderer options
- var opts = {lineJoin:'miter', lineCap:'butt', isarc:false, fillRect:this.fillRect, strokeRect:this.strokeRect};
- this.renderer.shapeRenderer.init(opts);
- plot.axes.x2axis._series.push(this);
- this._type = 'mekko';
- };
-
- // Method: setGridData
- // converts the user data values to grid coordinates and stores them
- // in the gridData array. Will convert user data into appropriate
- // rectangles.
- // Called with scope of a series.
- $.jqplot.MekkoRenderer.prototype.setGridData = function(plot) {
- // recalculate the grid data
- var xp = this._xaxis.series_u2p;
- var yp = this._yaxis.series_u2p;
- var data = this._plotData;
- this.gridData = [];
- // figure out width on x axis.
- // this._xwidth = this._sumy / plot._sumy * this.canvas.getWidth();
- this._xwidth = xp(this._sumy) - xp(0);
- if (this.index>0) {
- this._xstart = plot.series[this.index-1]._xstart + plot.series[this.index-1]._xwidth;
- }
- var totheight = this.canvas.getHeight();
- var sumy = 0;
- var cury;
- var curheight;
- for (var i=0; i');
- // Mekko charts legends don't go by number of series, but by number of data points
- // in the series. Refactor things here for that.
-
- var pad = false,
- reverse = true, // mekko charts are always stacked, so reverse
- nr, nc;
- var s = series[0];
- var colorGenerator = new $.jqplot.ColorGenerator(s.seriesColors);
-
- if (s.show) {
- var pd = s.data;
- if (this.numberRows) {
- nr = this.numberRows;
- if (!this.numberColumns){
- nc = Math.ceil(pd.length/nr);
- }
- else{
- nc = this.numberColumns;
- }
- }
- else if (this.numberColumns) {
- nc = this.numberColumns;
- nr = Math.ceil(pd.length/this.numberColumns);
- }
- else {
- nr = pd.length;
- nc = 1;
- }
-
- var i, j, tr, td1, td2, lt, rs, color;
- var idx = 0;
-
- for (i=0; i').prependTo(this._elem);
- }
- else{
- tr = $(' ').appendTo(this._elem);
- }
- for (j=0; j0){
- pad = true;
- }
- else{
- pad = false;
- }
- }
- else{
- if (i == nr -1){
- pad = false;
- }
- else{
- pad = true;
- }
- }
- rs = (pad) ? this.rowSpacing : '0';
-
- td1 = $(''+
- ' ');
- td2 = $(' ');
- if (this.escapeHtml){
- td2.text(lt);
- }
- else {
- td2.html(lt);
- }
- if (reverse) {
- td2.prependTo(tr);
- td1.prependTo(tr);
- }
- else {
- td1.appendTo(tr);
- td2.appendTo(tr);
- }
- pad = true;
- }
- idx++;
- }
- }
-
- tr = null;
- td1 = null;
- td2 = null;
- }
- }
- return this._elem;
- };
-
- $.jqplot.MekkoLegendRenderer.prototype.pack = function(offsets) {
- if (this.show) {
- // fake a grid for positioning
- var grid = {_top:offsets.top, _left:offsets.left, _right:offsets.right, _bottom:this._plotDimensions.height - offsets.bottom};
- if (this.placement == 'insideGrid') {
- switch (this.location) {
- case 'nw':
- var a = grid._left + this.xoffset;
- var b = grid._top + this.yoffset;
- this._elem.css('left', a);
- this._elem.css('top', b);
- break;
- case 'n':
- var a = (offsets.left + (this._plotDimensions.width - offsets.right))/2 - this.getWidth()/2;
- var b = grid._top + this.yoffset;
- this._elem.css('left', a);
- this._elem.css('top', b);
- break;
- case 'ne':
- var a = offsets.right + this.xoffset;
- var b = grid._top + this.yoffset;
- this._elem.css({right:a, top:b});
- break;
- case 'e':
- var a = offsets.right + this.xoffset;
- var b = (offsets.top + (this._plotDimensions.height - offsets.bottom))/2 - this.getHeight()/2;
- this._elem.css({right:a, top:b});
- break;
- case 'se':
- var a = offsets.right + this.xoffset;
- var b = offsets.bottom + this.yoffset;
- this._elem.css({right:a, bottom:b});
- break;
- case 's':
- var a = (offsets.left + (this._plotDimensions.width - offsets.right))/2 - this.getWidth()/2;
- var b = offsets.bottom + this.yoffset;
- this._elem.css({left:a, bottom:b});
- break;
- case 'sw':
- var a = grid._left + this.xoffset;
- var b = offsets.bottom + this.yoffset;
- this._elem.css({left:a, bottom:b});
- break;
- case 'w':
- var a = grid._left + this.xoffset;
- var b = (offsets.top + (this._plotDimensions.height - offsets.bottom))/2 - this.getHeight()/2;
- this._elem.css({left:a, top:b});
- break;
- default: // same as 'se'
- var a = grid._right - this.xoffset;
- var b = grid._bottom + this.yoffset;
- this._elem.css({right:a, bottom:b});
- break;
- }
-
- }
- else {
- switch (this.location) {
- case 'nw':
- var a = this._plotDimensions.width - grid._left + this.xoffset;
- var b = grid._top + this.yoffset;
- this._elem.css('right', a);
- this._elem.css('top', b);
- break;
- case 'n':
- var a = (offsets.left + (this._plotDimensions.width - offsets.right))/2 - this.getWidth()/2;
- var b = this._plotDimensions.height - grid._top + this.yoffset;
- this._elem.css('left', a);
- this._elem.css('bottom', b);
- break;
- case 'ne':
- var a = this._plotDimensions.width - offsets.right + this.xoffset;
- var b = grid._top + this.yoffset;
- this._elem.css({left:a, top:b});
- break;
- case 'e':
- var a = this._plotDimensions.width - offsets.right + this.xoffset;
- var b = (offsets.top + (this._plotDimensions.height - offsets.bottom))/2 - this.getHeight()/2;
- this._elem.css({left:a, top:b});
- break;
- case 'se':
- var a = this._plotDimensions.width - offsets.right + this.xoffset;
- var b = offsets.bottom + this.yoffset;
- this._elem.css({left:a, bottom:b});
- break;
- case 's':
- var a = (offsets.left + (this._plotDimensions.width - offsets.right))/2 - this.getWidth()/2;
- var b = this._plotDimensions.height - offsets.bottom + this.yoffset;
- this._elem.css({left:a, top:b});
- break;
- case 'sw':
- var a = this._plotDimensions.width - grid._left + this.xoffset;
- var b = offsets.bottom + this.yoffset;
- this._elem.css({right:a, bottom:b});
- break;
- case 'w':
- var a = this._plotDimensions.width - grid._left + this.xoffset;
- var b = (offsets.top + (this._plotDimensions.height - offsets.bottom))/2 - this.getHeight()/2;
- this._elem.css({right:a, top:b});
- break;
- default: // same as 'se'
- var a = grid._right - this.xoffset;
- var b = grid._bottom + this.yoffset;
- this._elem.css({right:a, bottom:b});
- break;
- }
- }
- }
- };
-
- // setup default renderers for axes and legend so user doesn't have to
- // called with scope of plot
- function preInit(target, data, options) {
- options = options || {};
- options.axesDefaults = options.axesDefaults || {};
- options.legend = options.legend || {};
- options.seriesDefaults = options.seriesDefaults || {};
- var setopts = false;
- if (options.seriesDefaults.renderer == $.jqplot.MekkoRenderer) {
- setopts = true;
- }
- else if (options.series) {
- for (var i=0; i < options.series.length; i++) {
- if (options.series[i].renderer == $.jqplot.MekkoRenderer) {
- setopts = true;
- }
- }
- }
-
- if (setopts) {
- options.axesDefaults.renderer = $.jqplot.MekkoAxisRenderer;
- options.legend.renderer = $.jqplot.MekkoLegendRenderer;
- options.legend.preDraw = true;
- }
- }
-
- $.jqplot.preInitHooks.push(preInit);
-
-})(jQuery);
\ No newline at end of file
diff --git a/libreplan-webapp/src/main/webapp/jqplot/plugins/jqplot.mekkoRenderer.min.js b/libreplan-webapp/src/main/webapp/jqplot/plugins/jqplot.mekkoRenderer.min.js
deleted file mode 100644
index e014e77e9..000000000
--- a/libreplan-webapp/src/main/webapp/jqplot/plugins/jqplot.mekkoRenderer.min.js
+++ /dev/null
@@ -1,57 +0,0 @@
-/**
- * jqPlot
- * Pure JavaScript plotting plugin using jQuery
- *
- * Version: 1.0.0b2_r1012
- *
- * Copyright (c) 2009-2011 Chris Leonello
- * jqPlot is currently available for use in all personal or commercial projects
- * under both the MIT (http://www.opensource.org/licenses/mit-license.php) and GPL
- * version 2.0 (http://www.gnu.org/licenses/gpl-2.0.html) licenses. This means that you can
- * choose the license that best suits your project and use it accordingly.
- *
- * Although not required, the author would appreciate an email letting him
- * know of any substantial use of jqPlot. You can reach the author at:
- * chris at jqplot dot com or see http://www.jqplot.com/info.php .
- *
- * If you are feeling kind and generous, consider supporting the project by
- * making a donation at: http://www.jqplot.com/donate.php .
- *
- * sprintf functions contained in jqplot.sprintf.js by Ash Searle:
- *
- * version 2007.04.27
- * author Ash Searle
- * http://hexmen.com/blog/2007/03/printf-sprintf/
- * http://hexmen.com/js/sprintf.js
- * The author (Ash Searle) has placed this code in the public domain:
- * "This code is unrestricted: you are free to use it however you like."
- *
- * included jsDate library by Chris Leonello:
- *
- * Copyright (c) 2010-2011 Chris Leonello
- *
- * jsDate is currently available for use in all personal or commercial projects
- * under both the MIT and GPL version 2.0 licenses. This means that you can
- * choose the license that best suits your project and use it accordingly.
- *
- * jsDate borrows many concepts and ideas from the Date Instance
- * Methods by Ken Snyder along with some parts of Ken's actual code.
- *
- * Ken's origianl Date Instance Methods and copyright notice:
- *
- * Ken Snyder (ken d snyder at gmail dot com)
- * 2008-09-10
- * version 2.0.2 (http://kendsnyder.com/sandbox/date/)
- * Creative Commons Attribution License 3.0 (http://creativecommons.org/licenses/by/3.0/)
- *
- * jqplotToImage function based on Larry Siden's export-jqplot-to-png.js.
- * Larry has generously given permission to adapt his code for inclusion
- * into jqPlot.
- *
- * Larry's original code can be found here:
- *
- * https://github.com/lsiden/export-jqplot-to-png
- *
- *
- */
-(function(b){b.jqplot.MekkoRenderer=function(){this.shapeRenderer=new b.jqplot.ShapeRenderer();this.borderColor=null;this.showBorders=true};b.jqplot.MekkoRenderer.prototype.init=function(c,e){this.fill=false;this.fillRect=true;this.strokeRect=true;this.shadow=false;this._xwidth=0;this._xstart=0;b.extend(true,this.renderer,c);var d={lineJoin:"miter",lineCap:"butt",isarc:false,fillRect:this.fillRect,strokeRect:this.strokeRect};this.renderer.shapeRenderer.init(d);e.axes.x2axis._series.push(this);this._type="mekko"};b.jqplot.MekkoRenderer.prototype.setGridData=function(h){var e=this._xaxis.series_u2p;var c=this._yaxis.series_u2p;var g=this._plotData;this.gridData=[];this._xwidth=e(this._sumy)-e(0);if(this.index>0){this._xstart=h.series[this.index-1]._xstart+h.series[this.index-1]._xwidth}var l=this.canvas.getHeight();var d=0;var k;var j;for(var f=0;f');var w=false,n=true,c,l;var p=o[0];var d=new b.jqplot.ColorGenerator(p.seriesColors);if(p.show){var x=p.data;if(this.numberRows){c=this.numberRows;if(!this.numberColumns){l=Math.ceil(x.length/c)}else{l=this.numberColumns}}else{if(this.numberColumns){l=this.numberColumns;c=Math.ceil(x.length/this.numberColumns)}else{c=x.length;l=1}}var v,u,e,h,g,k,m,t;var q=0;for(v=0;v').prependTo(this._elem)}else{e=b(' ').appendTo(this._elem)}for(u=0;u0){w=true}else{w=false}}else{if(v==c-1){w=false}else{w=true}}m=(w)?this.rowSpacing:"0";h=b(' ');g=b(' ');if(this.escapeHtml){g.text(k)}else{g.html(k)}if(n){g.prependTo(e);h.prependTo(e)}else{h.appendTo(e);g.appendTo(e)}w=true}q++}}e=null;h=null;g=null}}return this._elem};b.jqplot.MekkoLegendRenderer.prototype.pack=function(f){if(this.show){var e={_top:f.top,_left:f.left,_right:f.right,_bottom:this._plotDimensions.height-f.bottom};if(this.placement=="insideGrid"){switch(this.location){case"nw":var d=e._left+this.xoffset;var c=e._top+this.yoffset;this._elem.css("left",d);this._elem.css("top",c);break;case"n":var d=(f.left+(this._plotDimensions.width-f.right))/2-this.getWidth()/2;var c=e._top+this.yoffset;this._elem.css("left",d);this._elem.css("top",c);break;case"ne":var d=f.right+this.xoffset;var c=e._top+this.yoffset;this._elem.css({right:d,top:c});break;case"e":var d=f.right+this.xoffset;var c=(f.top+(this._plotDimensions.height-f.bottom))/2-this.getHeight()/2;this._elem.css({right:d,top:c});break;case"se":var d=f.right+this.xoffset;var c=f.bottom+this.yoffset;this._elem.css({right:d,bottom:c});break;case"s":var d=(f.left+(this._plotDimensions.width-f.right))/2-this.getWidth()/2;var c=f.bottom+this.yoffset;this._elem.css({left:d,bottom:c});break;case"sw":var d=e._left+this.xoffset;var c=f.bottom+this.yoffset;this._elem.css({left:d,bottom:c});break;case"w":var d=e._left+this.xoffset;var c=(f.top+(this._plotDimensions.height-f.bottom))/2-this.getHeight()/2;this._elem.css({left:d,top:c});break;default:var d=e._right-this.xoffset;var c=e._bottom+this.yoffset;this._elem.css({right:d,bottom:c});break}}else{switch(this.location){case"nw":var d=this._plotDimensions.width-e._left+this.xoffset;var c=e._top+this.yoffset;this._elem.css("right",d);this._elem.css("top",c);break;case"n":var d=(f.left+(this._plotDimensions.width-f.right))/2-this.getWidth()/2;var c=this._plotDimensions.height-e._top+this.yoffset;this._elem.css("left",d);this._elem.css("bottom",c);break;case"ne":var d=this._plotDimensions.width-f.right+this.xoffset;var c=e._top+this.yoffset;this._elem.css({left:d,top:c});break;case"e":var d=this._plotDimensions.width-f.right+this.xoffset;var c=(f.top+(this._plotDimensions.height-f.bottom))/2-this.getHeight()/2;this._elem.css({left:d,top:c});break;case"se":var d=this._plotDimensions.width-f.right+this.xoffset;var c=f.bottom+this.yoffset;this._elem.css({left:d,bottom:c});break;case"s":var d=(f.left+(this._plotDimensions.width-f.right))/2-this.getWidth()/2;var c=this._plotDimensions.height-f.bottom+this.yoffset;this._elem.css({left:d,top:c});break;case"sw":var d=this._plotDimensions.width-e._left+this.xoffset;var c=f.bottom+this.yoffset;this._elem.css({right:d,bottom:c});break;case"w":var d=this._plotDimensions.width-e._left+this.xoffset;var c=(f.top+(this._plotDimensions.height-f.bottom))/2-this.getHeight()/2;this._elem.css({right:d,top:c});break;default:var d=e._right-this.xoffset;var c=e._bottom+this.yoffset;this._elem.css({right:d,bottom:c});break}}}};function a(g,f,d){d=d||{};d.axesDefaults=d.axesDefaults||{};d.legend=d.legend||{};d.seriesDefaults=d.seriesDefaults||{};var c=false;if(d.seriesDefaults.renderer==b.jqplot.MekkoRenderer){c=true}else{if(d.series){for(var e=0;e
- *
- * Properties described here are passed into the $.jqplot function
- * as options on the series renderer. For example:
- *
- * > plot0 = $.jqplot('chart0',[[18]],{
- * > title: 'Network Speed',
- * > seriesDefaults: {
- * > renderer: $.jqplot.MeterGaugeRenderer,
- * > rendererOptions: {
- * > label: 'MB/s'
- * > }
- * > }
- * > });
- *
- * A meterGauge plot does not support events.
- */
- $.jqplot.MeterGaugeRenderer = function(){
- $.jqplot.LineRenderer.call(this);
- };
-
- $.jqplot.MeterGaugeRenderer.prototype = new $.jqplot.LineRenderer();
- $.jqplot.MeterGaugeRenderer.prototype.constructor = $.jqplot.MeterGaugeRenderer;
-
- // called with scope of a series
- $.jqplot.MeterGaugeRenderer.prototype.init = function(options) {
- // Group: Properties
- //
- // prop: diameter
- // Outer diameter of the meterGauge, auto computed by default
- this.diameter = null;
- // prop: padding
- // padding between the meterGauge and plot edges, auto
- // calculated by default.
- this.padding = null;
- // prop: shadowOffset
- // offset of the shadow from the gauge ring and offset of
- // each succesive stroke of the shadow from the last.
- this.shadowOffset = 2;
- // prop: shadowAlpha
- // transparency of the shadow (0 = transparent, 1 = opaque)
- this.shadowAlpha = 0.07;
- // prop: shadowDepth
- // number of strokes to apply to the shadow,
- // each stroke offset shadowOffset from the last.
- this.shadowDepth = 4;
- // prop: background
- // background color of the inside of the gauge.
- this.background = "#efefef";
- // prop: ringColor
- // color of the outer ring, hub, and needle of the gauge.
- this.ringColor = "#BBC6D0";
- // needle color not implemented yet.
- this.needleColor = "#C3D3E5";
- // prop: tickColor
- // color of the tick marks around the gauge.
- this.tickColor = "989898";
- // prop: ringWidth
- // width of the ring around the gauge. Auto computed by default.
- this.ringWidth = null;
- // prop: min
- // Minimum value on the gauge. Auto computed by default
- this.min;
- // prop: max
- // Maximum value on the gauge. Auto computed by default
- this.max;
- // prop: ticks
- // Array of tick values. Auto computed by default.
- this.ticks = [];
- // prop: showTicks
- // true to show ticks around gauge.
- this.showTicks = true;
- // prop: showTickLabels
- // true to show tick labels next to ticks.
- this.showTickLabels = true;
- // prop: label
- // A gauge label like 'kph' or 'Volts'
- this.label = null;
- // prop: labelHeightAdjust
- // Number of Pixels to offset the label up (-) or down (+) from its default position.
- this.labelHeightAdjust = 0;
- // prop: labelPosition
- // Where to position the label, either 'inside' or 'bottom'.
- this.labelPosition = 'inside';
- // prop: intervals
- // Array of ranges to be drawn around the gauge.
- // Array of form:
- // > [value1, value2, ...]
- // indicating the values for the first, second, ... intervals.
- this.intervals = [];
- // prop: intervalColors
- // Array of colors to use for the intervals.
- this.intervalColors = [ "#4bb2c5", "#EAA228", "#c5b47f", "#579575", "#839557", "#958c12", "#953579", "#4b5de4", "#d8b83f", "#ff5800", "#0085cc", "#c747a3", "#cddf54", "#FBD178", "#26B4E3", "#bd70c7"];
- // prop: intervalInnerRadius
- // Radius of the inner circle of the interval ring.
- this.intervalInnerRadius = null;
- // prop: intervalOuterRadius
- // Radius of the outer circle of the interval ring.
- this.intervalOuterRadius = null;
- this.tickRenderer = $.jqplot.MeterGaugeTickRenderer;
- // ticks spaced every 1, 2, 2.5, 5, 10, 20, .1, .2, .25, .5, etc.
- this.tickPositions = [1, 2, 2.5, 5, 10];
- // prop: tickSpacing
- // Degrees between ticks. This is a target number, if
- // incompatible span and ticks are supplied, a suitable
- // spacing close to this value will be computed.
- this.tickSpacing = 30;
- this.numberMinorTicks = null;
- // prop: hubRadius
- // Radius of the hub at the bottom center of gauge which the needle attaches to.
- // Auto computed by default
- this.hubRadius = null;
- // prop: tickPadding
- // padding of the tick marks to the outer ring and the tick labels to marks.
- // Auto computed by default.
- this.tickPadding = null;
- // prop: needleThickness
- // Maximum thickness the needle. Auto computed by default.
- this.needleThickness = null;
- // prop: needlePad
- // Padding between needle and inner edge of the ring when the needle is at the min or max gauge value.
- this.needlePad = 6;
- // prop: pegNeedle
- // True will stop needle just below/above the min/max values if data is below/above min/max,
- // as if the meter is "pegged".
- this.pegNeedle = true;
- this._type = 'meterGauge';
-
- $.extend(true, this, options);
- this.type = null;
- this.numberTicks = null;
- this.tickInterval = null;
- // span, the sweep (in degrees) from min to max. This gauge is
- // a semi-circle.
- this.span = 180;
- // get rid of this nonsense
- // this.innerSpan = this.span;
- if (this.type == 'circular') {
- this.semiCircular = false;
- }
- else if (this.type != 'circular') {
- this.semiCircular = true;
- }
- else {
- this.semiCircular = (this.span <= 180) ? true : false;
- }
- this._tickPoints = [];
- // reference to label element.
- this._labelElem = null;
-
- // start the gauge at the beginning of the span
- this.startAngle = (90 + (360 - this.span)/2) * Math.PI/180;
- this.endAngle = (90 - (360 - this.span)/2) * Math.PI/180;
-
- this.setmin = !!(this.min == null);
- this.setmax = !!(this.max == null);
-
- // if given intervals and is an array of values, create labels and colors.
- if (this.intervals.length) {
- if (this.intervals[0].length == null || this.intervals.length == 1) {
- for (var i=0; i= this.data[0][1]) {
- this.max = this.intervals[this.intervals.length-1][0];
- this.setmax = false;
- }
- }
- else {
- this.setmax = false;
- }
- }
-
- else {
- // no ticks and no intervals supplied, put needle in middle
- this.min = (this.min == null) ? 0 : this.min;
- this.setmin = false;
- if (this.max == null) {
- this.max = this.data[0][1] * 1.25;
- this.setmax = true;
- }
- else {
- this.setmax = false;
- }
- }
- };
-
- $.jqplot.MeterGaugeRenderer.prototype.setGridData = function(plot) {
- // set gridData property. This will hold angle in radians of each data point.
- var stack = [];
- var td = [];
- var sa = this.startAngle;
- for (var i=0; i0) {
- stack[i] += stack[i-1];
- }
- }
- var fact = Math.PI*2/stack[stack.length - 1];
-
- for (var i=0; i0) {
- stack[i] += stack[i-1];
- }
- }
- var fact = Math.PI*2/stack[stack.length - 1];
-
- for (var i=0; i=0; i--) {
- temp = interval/(pos[i] * Math.pow(10, fact));
- if (temp == 4 || temp == 5) {
- return temp - 1;
- }
- }
- return null;
- }
-
- // called with scope of series
- $.jqplot.MeterGaugeRenderer.prototype.draw = function (ctx, gd, options) {
- var i;
- var opts = (options != undefined) ? options : {};
- // offset and direction of offset due to legend placement
- var offx = 0;
- var offy = 0;
- var trans = 1;
- if (options.legendInfo && options.legendInfo.placement == 'inside') {
- var li = options.legendInfo;
- switch (li.location) {
- case 'nw':
- offx = li.width + li.xoffset;
- break;
- case 'w':
- offx = li.width + li.xoffset;
- break;
- case 'sw':
- offx = li.width + li.xoffset;
- break;
- case 'ne':
- offx = li.width + li.xoffset;
- trans = -1;
- break;
- case 'e':
- offx = li.width + li.xoffset;
- trans = -1;
- break;
- case 'se':
- offx = li.width + li.xoffset;
- trans = -1;
- break;
- case 'n':
- offy = li.height + li.yoffset;
- break;
- case 's':
- offy = li.height + li.yoffset;
- trans = -1;
- break;
- default:
- break;
- }
- }
-
-
-
- // pre-draw so can get it's dimensions.
- if (this.label) {
- this._labelElem = $(''+this.label+'
');
- this.canvas._elem.after(this._labelElem);
- }
-
- var shadow = (opts.shadow != undefined) ? opts.shadow : this.shadow;
- var showLine = (opts.showLine != undefined) ? opts.showLine : this.showLine;
- var fill = (opts.fill != undefined) ? opts.fill : this.fill;
- var cw = ctx.canvas.width;
- var ch = ctx.canvas.height;
- if (this.padding == null) {
- this.padding = Math.round(Math.min(cw, ch)/30);
- }
- var w = cw - offx - 2 * this.padding;
- var h = ch - offy - 2 * this.padding;
- if (this.labelPosition == 'bottom' && this.label) {
- h -= this._labelElem.outerHeight(true);
- }
- var mindim = Math.min(w,h);
- var d = mindim;
-
- if (!this.diameter) {
- if (this.semiCircular) {
- if ( w >= 2*h) {
- if (!this.ringWidth) {
- this.ringWidth = 2*h/35;
- }
- this.needleThickness = this.needleThickness || 2+Math.pow(this.ringWidth, 0.8);
- this.innerPad = this.ringWidth/2 + this.needleThickness/2 + this.needlePad;
- this.diameter = 2 * (h - 2*this.innerPad);
- }
- else {
- if (!this.ringWidth) {
- this.ringWidth = w/35;
- }
- this.needleThickness = this.needleThickness || 2+Math.pow(this.ringWidth, 0.8);
- this.innerPad = this.ringWidth/2 + this.needleThickness/2 + this.needlePad;
- this.diameter = w - 2*this.innerPad - this.ringWidth - this.padding;
- }
- // center taking into account legend and over draw for gauge bottom below hub.
- // this will be center of hub.
- this._center = [(cw - trans * offx)/2 + trans * offx, (ch + trans*offy - this.padding - this.ringWidth - this.innerPad)];
- }
- else {
- if (!this.ringWidth) {
- this.ringWidth = d/35;
- }
- this.needleThickness = this.needleThickness || 2+Math.pow(this.ringWidth, 0.8);
- this.innerPad = 0;
- this.diameter = d - this.ringWidth;
- // center in middle of canvas taking into account legend.
- // will be center of hub.
- this._center = [(cw-trans*offx)/2 + trans * offx, (ch-trans*offy)/2 + trans * offy];
- }
- }
-
-
- if (this._labelElem && this.labelPosition == 'bottom') {
- this._center[1] -= this._labelElem.outerHeight(true);
- }
-
- this._radius = this.diameter/2;
-
- this.tickSpacing = 6000/this.diameter;
-
- if (!this.hubRadius) {
- this.hubRadius = this.diameter/18;
- }
-
- this.shadowOffset = 0.5 + this.ringWidth/9;
- this.shadowWidth = this.ringWidth*1;
-
- this.tickPadding = 3 + Math.pow(this.diameter/20, 0.7);
- this.tickOuterRadius = this._radius - this.ringWidth/2 - this.tickPadding;
- this.tickLength = (this.showTicks) ? this._radius/13 : 0;
-
- if (this.ticks.length == 0) {
- // no ticks, lets make some.
- var max = this.max,
- min = this.min,
- setmax = this.setmax,
- setmin = this.setmin,
- ti = (max - min) * this.tickSpacing / this.span;
- var tf = Math.floor(parseFloat((Math.log(ti)/Math.log(10)).toFixed(11)));
- var tp = (ti/Math.pow(10, tf));
- (tp > 2 && tp <= 2.5) ? tp = 2.5 : tp = Math.ceil(tp);
- var t = this.tickPositions;
- var tpindex, nt;
-
- for (i=0; i 0) ? min - min % ti : min - min % ti - ti;
- if (!this.forceZero) {
- var diff = Math.min(min - tmin, 0.8*ti);
- var ntp = Math.floor(diff/t[tpindex]);
- if (ntp > 1) {
- tmin = tmin + t[tpindex] * (ntp-1);
- if (parseInt(tmin, 10) != tmin && parseInt(tmin-t[tpindex], 10) == tmin-t[tpindex]) {
- tmin = tmin - t[tpindex];
- }
- }
- }
- if (min == tmin) {
- min -= ti;
- }
- else {
- // tmin should always be lower than dataMin
- if (min - tmin > 0.23*ti) {
- min = tmin;
- }
- else {
- min = tmin -ti;
- nt += 1;
- }
- }
- nt += 1;
- var tmax = min + (nt - 1) * ti;
- if (max >= tmax) {
- tmax += ti;
- nt += 1;
- }
- // now tmax should always be mroe than dataMax
- if (tmax - max < 0.23*ti) {
- tmax += ti;
- nt += 1;
- }
- this.max = max = tmax;
- this.min = min;
-
- this.tickInterval = ti;
- this.numberTicks = nt;
- var it;
- for (i=0; i= tmax) {
- max = tmax + ti;
- nt += 1;
- }
- else {
- max = tmax;
- }
-
- this.tickInterval = this.tickInterval || ti;
- this.numberTicks = this.numberTicks || nt;
- var it;
- for (i=0; i 1) {
- var rstr = String(range);
- if (rstr.search(/\./) == -1) {
- var pos = rstr.search(/0+$/);
- nonSigDigits = (pos > 0) ? rstr.length - pos - 1 : 0;
- }
- }
- sigRange = range/Math.pow(10, nonSigDigits);
- for (i=0; i'+this.ticks[i][1]+'');
- this.canvas._elem.after(elem);
- ew = elem.outerWidth(true);
- eh = elem.outerHeight(true);
- l = this._tickPoints[i][0] - ew * (this._tickPoints[i][2]-Math.PI)/Math.PI - tp * Math.cos(this._tickPoints[i][2]);
- t = this._tickPoints[i][1] - eh/2 + eh/2 * Math.pow(Math.abs((Math.sin(this._tickPoints[i][2]))), 0.5) + tp/3 * Math.pow(Math.abs((Math.sin(this._tickPoints[i][2]))), 0.5) ;
- // t = this._tickPoints[i][1] - eh/2 - eh/2 * Math.sin(this._tickPoints[i][2]) - tp/2 * Math.sin(this._tickPoints[i][2]);
- elem.css({left:l, top:t});
- dim = ew*Math.cos(this._tickPoints[i][2]) + eh*Math.sin(Math.PI/2+this._tickPoints[i][2]/2);
- maxdim = (dim > maxdim) ? dim : maxdim;
- }
- }
-
- // draw the gauge label
- if (this.label && this.labelPosition == 'inside') {
- var l = this._center[0] + this.canvas._offsets.left;
- var tp = this.tickPadding * (1 - 1/(this.diameter/80+1));
- var t = 0.5*(this._center[1] + this.canvas._offsets.top - this.hubRadius) + 0.5*(this._center[1] + this.canvas._offsets.top - this.tickOuterRadius + this.tickLength + tp) + this.labelHeightAdjust;
- // this._labelElem = $(''+this.label+'
');
- // this.canvas._elem.after(this._labelElem);
- l -= this._labelElem.outerWidth(true)/2;
- t -= this._labelElem.outerHeight(true)/2;
- this._labelElem.css({left:l, top:t});
- }
-
- else if (this.label && this.labelPosition == 'bottom') {
- var l = this._center[0] + this.canvas._offsets.left - this._labelElem.outerWidth(true)/2;
- var t = this._center[1] + this.canvas._offsets.top + this.innerPad + + this.ringWidth + this.padding + this.labelHeightAdjust;
- this._labelElem.css({left:l, top:t});
-
- }
-
- // draw the intervals
-
- ctx.save();
- var inner = this.intervalInnerRadius || this.hubRadius * 1.5;
- if (this.intervalOuterRadius == null) {
- if (this.showTickLabels) {
- var outer = (this.tickOuterRadius - this.tickLength - this.tickPadding - this.diameter/8);
- }
- else {
- var outer = (this.tickOuterRadius - this.tickLength - this.diameter/16);
- }
- }
- else {
- var outer = this.intervalOuterRadius;
- }
- var range = this.max - this.min;
- var intrange = this.intervals[this.intervals.length-1] - this.min;
- var start, end, span = this.span*Math.PI/180;
- for (i=0; i this.max + dataspan*3/this.span) {
- datapoint = this.max + dataspan*3/this.span;
- }
- if (this.data[0][1] < this.min - dataspan*3/this.span) {
- datapoint = this.min - dataspan*3/this.span;
- }
- }
- var dataang = (datapoint - this.min)/dataspan * this.span * Math.PI/180 + this.startAngle;
-
-
- ctx.save();
- ctx.beginPath();
- ctx.fillStyle = this.ringColor;
- ctx.strokeStyle = this.ringColor;
- this.needleLength = (this.tickOuterRadius - this.tickLength) * 0.85;
- this.needleThickness = (this.needleThickness < 2) ? 2 : this.needleThickness;
- var endwidth = this.needleThickness * 0.4;
-
-
- var dl = this.needleLength/10;
- var dt = (this.needleThickness - endwidth)/10;
- var templ;
- for (var i=0; i<10; i++) {
- templ = this.needleThickness - i*dt;
- ctx.moveTo(dl*i*Math.cos(dataang), dl*i*Math.sin(dataang));
- ctx.lineWidth = templ;
- ctx.lineTo(dl*(i+1)*Math.cos(dataang), dl*(i+1)*Math.sin(dataang));
- ctx.stroke();
- }
-
- ctx.restore();
- }
- else {
- this._center = [(cw - trans * offx)/2 + trans * offx, (ch - trans*offy)/2 + trans * offy];
- }
- };
-
- $.jqplot.MeterGaugeAxisRenderer = function() {
- $.jqplot.LinearAxisRenderer.call(this);
- };
-
- $.jqplot.MeterGaugeAxisRenderer.prototype = new $.jqplot.LinearAxisRenderer();
- $.jqplot.MeterGaugeAxisRenderer.prototype.constructor = $.jqplot.MeterGaugeAxisRenderer;
-
-
- // There are no traditional axes on a gauge chart. We just need to provide
- // dummy objects with properties so the plot will render.
- // called with scope of axis object.
- $.jqplot.MeterGaugeAxisRenderer.prototype.init = function(options){
- //
- this.tickRenderer = $.jqplot.MeterGaugeTickRenderer;
- $.extend(true, this, options);
- // I don't think I'm going to need _dataBounds here.
- // have to go Axis scaling in a way to fit chart onto plot area
- // and provide u2p and p2u functionality for mouse cursor, etc.
- // for convienence set _dataBounds to 0 and 100 and
- // set min/max to 0 and 100.
- this._dataBounds = {min:0, max:100};
- this.min = 0;
- this.max = 100;
- this.showTicks = false;
- this.ticks = [];
- this.showMark = false;
- this.show = false;
- };
-
- $.jqplot.MeterGaugeLegendRenderer = function(){
- $.jqplot.TableLegendRenderer.call(this);
- };
-
- $.jqplot.MeterGaugeLegendRenderer.prototype = new $.jqplot.TableLegendRenderer();
- $.jqplot.MeterGaugeLegendRenderer.prototype.constructor = $.jqplot.MeterGaugeLegendRenderer;
-
- /**
- * Class: $.jqplot.MeterGaugeLegendRenderer
- *Meter gauges don't typically have a legend, this overrides the default legend renderer.
- */
- $.jqplot.MeterGaugeLegendRenderer.prototype.init = function(options) {
- // Maximum number of rows in the legend. 0 or null for unlimited.
- this.numberRows = null;
- // Maximum number of columns in the legend. 0 or null for unlimited.
- this.numberColumns = null;
- $.extend(true, this, options);
- };
-
- // called with context of legend
- $.jqplot.MeterGaugeLegendRenderer.prototype.draw = function() {
- if (this.show) {
- var series = this._series;
- var ss = 'position:absolute;';
- ss += (this.background) ? 'background:'+this.background+';' : '';
- ss += (this.border) ? 'border:'+this.border+';' : '';
- ss += (this.fontSize) ? 'font-size:'+this.fontSize+';' : '';
- ss += (this.fontFamily) ? 'font-family:'+this.fontFamily+';' : '';
- ss += (this.textColor) ? 'color:'+this.textColor+';' : '';
- ss += (this.marginTop != null) ? 'margin-top:'+this.marginTop+';' : '';
- ss += (this.marginBottom != null) ? 'margin-bottom:'+this.marginBottom+';' : '';
- ss += (this.marginLeft != null) ? 'margin-left:'+this.marginLeft+';' : '';
- ss += (this.marginRight != null) ? 'margin-right:'+this.marginRight+';' : '';
- this._elem = $('');
- // MeterGauge charts legends don't go by number of series, but by number of data points
- // in the series. Refactor things here for that.
-
- var pad = false,
- reverse = false,
- nr, nc;
- var s = series[0];
-
- if (s.show) {
- var pd = s.data;
- if (this.numberRows) {
- nr = this.numberRows;
- if (!this.numberColumns){
- nc = Math.ceil(pd.length/nr);
- }
- else{
- nc = this.numberColumns;
- }
- }
- else if (this.numberColumns) {
- nc = this.numberColumns;
- nr = Math.ceil(pd.length/this.numberColumns);
- }
- else {
- nr = pd.length;
- nc = 1;
- }
-
- var i, j, tr, td1, td2, lt, rs, color;
- var idx = 0;
-
- for (i=0; i').prependTo(this._elem);
- }
- else{
- tr = $(' ').appendTo(this._elem);
- }
- for (j=0; j0){
- pad = true;
- }
- else{
- pad = false;
- }
- }
- else{
- if (i == nr -1){
- pad = false;
- }
- else{
- pad = true;
- }
- }
- rs = (pad) ? this.rowSpacing : '0';
-
- td1 = $(''+
- ' ');
- td2 = $(' ');
- if (this.escapeHtml){
- td2.text(lt);
- }
- else {
- td2.html(lt);
- }
- if (reverse) {
- td2.prependTo(tr);
- td1.prependTo(tr);
- }
- else {
- td1.appendTo(tr);
- td2.appendTo(tr);
- }
- pad = true;
- }
- idx++;
- }
- }
- }
- }
- return this._elem;
- };
-
-
- // setup default renderers for axes and legend so user doesn't have to
- // called with scope of plot
- function preInit(target, data, options) {
- // debugger
- options = options || {};
- options.axesDefaults = options.axesDefaults || {};
- options.legend = options.legend || {};
- options.seriesDefaults = options.seriesDefaults || {};
- options.grid = options.grid || {};
-
- // only set these if there is a gauge series
- var setopts = false;
- if (options.seriesDefaults.renderer == $.jqplot.MeterGaugeRenderer) {
- setopts = true;
- }
- else if (options.series) {
- for (var i=0; i < options.series.length; i++) {
- if (options.series[i].renderer == $.jqplot.MeterGaugeRenderer) {
- setopts = true;
- }
- }
- }
-
- if (setopts) {
- options.axesDefaults.renderer = $.jqplot.MeterGaugeAxisRenderer;
- options.legend.renderer = $.jqplot.MeterGaugeLegendRenderer;
- options.legend.preDraw = true;
- options.grid.background = options.grid.background || 'white';
- options.grid.drawGridlines = false;
- options.grid.borderWidth = (options.grid.borderWidth != null) ? options.grid.borderWidth : 0;
- options.grid.shadow = (options.grid.shadow != null) ? options.grid.shadow : false;
- }
- }
-
- // called with scope of plot
- function postParseOptions(options) {
- //
- }
-
- $.jqplot.preInitHooks.push(preInit);
- $.jqplot.postParseOptionsHooks.push(postParseOptions);
-
- $.jqplot.MeterGaugeTickRenderer = function() {
- $.jqplot.AxisTickRenderer.call(this);
- };
-
- $.jqplot.MeterGaugeTickRenderer.prototype = new $.jqplot.AxisTickRenderer();
- $.jqplot.MeterGaugeTickRenderer.prototype.constructor = $.jqplot.MeterGaugeTickRenderer;
-
-})(jQuery);
-
-
\ No newline at end of file
diff --git a/libreplan-webapp/src/main/webapp/jqplot/plugins/jqplot.meterGaugeRenderer.min.js b/libreplan-webapp/src/main/webapp/jqplot/plugins/jqplot.meterGaugeRenderer.min.js
deleted file mode 100644
index 52f7bdc2c..000000000
--- a/libreplan-webapp/src/main/webapp/jqplot/plugins/jqplot.meterGaugeRenderer.min.js
+++ /dev/null
@@ -1,57 +0,0 @@
-/**
- * jqPlot
- * Pure JavaScript plotting plugin using jQuery
- *
- * Version: 1.0.0b2_r1012
- *
- * Copyright (c) 2009-2011 Chris Leonello
- * jqPlot is currently available for use in all personal or commercial projects
- * under both the MIT (http://www.opensource.org/licenses/mit-license.php) and GPL
- * version 2.0 (http://www.gnu.org/licenses/gpl-2.0.html) licenses. This means that you can
- * choose the license that best suits your project and use it accordingly.
- *
- * Although not required, the author would appreciate an email letting him
- * know of any substantial use of jqPlot. You can reach the author at:
- * chris at jqplot dot com or see http://www.jqplot.com/info.php .
- *
- * If you are feeling kind and generous, consider supporting the project by
- * making a donation at: http://www.jqplot.com/donate.php .
- *
- * sprintf functions contained in jqplot.sprintf.js by Ash Searle:
- *
- * version 2007.04.27
- * author Ash Searle
- * http://hexmen.com/blog/2007/03/printf-sprintf/
- * http://hexmen.com/js/sprintf.js
- * The author (Ash Searle) has placed this code in the public domain:
- * "This code is unrestricted: you are free to use it however you like."
- *
- * included jsDate library by Chris Leonello:
- *
- * Copyright (c) 2010-2011 Chris Leonello
- *
- * jsDate is currently available for use in all personal or commercial projects
- * under both the MIT and GPL version 2.0 licenses. This means that you can
- * choose the license that best suits your project and use it accordingly.
- *
- * jsDate borrows many concepts and ideas from the Date Instance
- * Methods by Ken Snyder along with some parts of Ken's actual code.
- *
- * Ken's origianl Date Instance Methods and copyright notice:
- *
- * Ken Snyder (ken d snyder at gmail dot com)
- * 2008-09-10
- * version 2.0.2 (http://kendsnyder.com/sandbox/date/)
- * Creative Commons Attribution License 3.0 (http://creativecommons.org/licenses/by/3.0/)
- *
- * jqplotToImage function based on Larry Siden's export-jqplot-to-png.js.
- * Larry has generously given permission to adapt his code for inclusion
- * into jqPlot.
- *
- * Larry's original code can be found here:
- *
- * https://github.com/lsiden/export-jqplot-to-png
- *
- *
- */
-(function(c){c.jqplot.MeterGaugeRenderer=function(){c.jqplot.LineRenderer.call(this)};c.jqplot.MeterGaugeRenderer.prototype=new c.jqplot.LineRenderer();c.jqplot.MeterGaugeRenderer.prototype.constructor=c.jqplot.MeterGaugeRenderer;c.jqplot.MeterGaugeRenderer.prototype.init=function(e){this.diameter=null;this.padding=null;this.shadowOffset=2;this.shadowAlpha=0.07;this.shadowDepth=4;this.background="#efefef";this.ringColor="#BBC6D0";this.needleColor="#C3D3E5";this.tickColor="989898";this.ringWidth=null;this.min;this.max;this.ticks=[];this.showTicks=true;this.showTickLabels=true;this.label=null;this.labelHeightAdjust=0;this.labelPosition="inside";this.intervals=[];this.intervalColors=["#4bb2c5","#EAA228","#c5b47f","#579575","#839557","#958c12","#953579","#4b5de4","#d8b83f","#ff5800","#0085cc","#c747a3","#cddf54","#FBD178","#26B4E3","#bd70c7"];this.intervalInnerRadius=null;this.intervalOuterRadius=null;this.tickRenderer=c.jqplot.MeterGaugeTickRenderer;this.tickPositions=[1,2,2.5,5,10];this.tickSpacing=30;this.numberMinorTicks=null;this.hubRadius=null;this.tickPadding=null;this.needleThickness=null;this.needlePad=6;this.pegNeedle=true;this._type="meterGauge";c.extend(true,this,e);this.type=null;this.numberTicks=null;this.tickInterval=null;this.span=180;if(this.type=="circular"){this.semiCircular=false}else{if(this.type!="circular"){this.semiCircular=true}else{this.semiCircular=(this.span<=180)?true:false}}this._tickPoints=[];this._labelElem=null;this.startAngle=(90+(360-this.span)/2)*Math.PI/180;this.endAngle=(90-(360-this.span)/2)*Math.PI/180;this.setmin=!!(this.min==null);this.setmax=!!(this.max==null);if(this.intervals.length){if(this.intervals[0].length==null||this.intervals.length==1){for(var f=0;f=this.data[0][1]){this.max=this.intervals[this.intervals.length-1][0];this.setmax=false}}else{this.setmax=false}}else{this.min=(this.min==null)?0:this.min;this.setmin=false;if(this.max==null){this.max=this.data[0][1]*1.25;this.setmax=true}else{this.setmax=false}}}};c.jqplot.MeterGaugeRenderer.prototype.setGridData=function(j){var f=[];var k=[];var e=this.startAngle;for(var h=0;h0){f[h]+=f[h-1]}}var g=Math.PI*2/f[f.length-1];for(var h=0;h0){f[h]+=f[h-1]}}var g=Math.PI*2/f[f.length-1];for(var h=0;h=0;h--){e=f/(j[h]*Math.pow(10,g));if(e==4||e==5){return e-1}}return null}c.jqplot.MeterGaugeRenderer.prototype.draw=function(X,aC,ap){var aa;var aM=(ap!=undefined)?ap:{};var ai=0;var ah=0;var at=1;if(ap.legendInfo&&ap.legendInfo.placement=="inside"){var aI=ap.legendInfo;switch(aI.location){case"nw":ai=aI.width+aI.xoffset;break;case"w":ai=aI.width+aI.xoffset;break;case"sw":ai=aI.width+aI.xoffset;break;case"ne":ai=aI.width+aI.xoffset;at=-1;break;case"e":ai=aI.width+aI.xoffset;at=-1;break;case"se":ai=aI.width+aI.xoffset;at=-1;break;case"n":ah=aI.height+aI.yoffset;break;case"s":ah=aI.height+aI.yoffset;at=-1;break;default:break}}if(this.label){this._labelElem=c(''+this.label+"
");this.canvas._elem.after(this._labelElem)}var m=(aM.shadow!=undefined)?aM.shadow:this.shadow;var N=(aM.showLine!=undefined)?aM.showLine:this.showLine;var I=(aM.fill!=undefined)?aM.fill:this.fill;var K=X.canvas.width;var S=X.canvas.height;if(this.padding==null){this.padding=Math.round(Math.min(K,S)/30)}var Q=K-ai-2*this.padding;var ab=S-ah-2*this.padding;if(this.labelPosition=="bottom"&&this.label){ab-=this._labelElem.outerHeight(true)}var L=Math.min(Q,ab);var ad=L;if(!this.diameter){if(this.semiCircular){if(Q>=2*ab){if(!this.ringWidth){this.ringWidth=2*ab/35}this.needleThickness=this.needleThickness||2+Math.pow(this.ringWidth,0.8);this.innerPad=this.ringWidth/2+this.needleThickness/2+this.needlePad;this.diameter=2*(ab-2*this.innerPad)}else{if(!this.ringWidth){this.ringWidth=Q/35}this.needleThickness=this.needleThickness||2+Math.pow(this.ringWidth,0.8);this.innerPad=this.ringWidth/2+this.needleThickness/2+this.needlePad;this.diameter=Q-2*this.innerPad-this.ringWidth-this.padding}this._center=[(K-at*ai)/2+at*ai,(S+at*ah-this.padding-this.ringWidth-this.innerPad)]}else{if(!this.ringWidth){this.ringWidth=ad/35}this.needleThickness=this.needleThickness||2+Math.pow(this.ringWidth,0.8);this.innerPad=0;this.diameter=ad-this.ringWidth;this._center=[(K-at*ai)/2+at*ai,(S-at*ah)/2+at*ah]}}if(this._labelElem&&this.labelPosition=="bottom"){this._center[1]-=this._labelElem.outerHeight(true)}this._radius=this.diameter/2;this.tickSpacing=6000/this.diameter;if(!this.hubRadius){this.hubRadius=this.diameter/18}this.shadowOffset=0.5+this.ringWidth/9;this.shadowWidth=this.ringWidth*1;this.tickPadding=3+Math.pow(this.diameter/20,0.7);this.tickOuterRadius=this._radius-this.ringWidth/2-this.tickPadding;this.tickLength=(this.showTicks)?this._radius/13:0;if(this.ticks.length==0){var A=this.max,aL=this.min,q=this.setmax,aG=this.setmin,au=(A-aL)*this.tickSpacing/this.span;var aw=Math.floor(parseFloat((Math.log(au)/Math.log(10)).toFixed(11)));var an=(au/Math.pow(10,aw));(an>2&&an<=2.5)?an=2.5:an=Math.ceil(an);var T=this.tickPositions;var aA,ak;for(aa=0;aa0)?aL-aL%au:aL-aL%au-au;if(!this.forceZero){var D=Math.min(aL-aP,0.8*au);var o=Math.floor(D/T[aA]);if(o>1){aP=aP+T[aA]*(o-1);if(parseInt(aP,10)!=aP&&parseInt(aP-T[aA],10)==aP-T[aA]){aP=aP-T[aA]}}}if(aL==aP){aL-=au}else{if(aL-aP>0.23*au){aL=aP}else{aL=aP-au;ak+=1}}ak+=1;var E=aL+(ak-1)*au;if(A>=E){E+=au;ak+=1}if(E-A<0.23*au){E+=au;ak+=1}this.max=A=E;this.min=aL;this.tickInterval=au;this.numberTicks=ak;var O;for(aa=0;aa=E){A=E+au;ak+=1}else{A=E}this.tickInterval=this.tickInterval||au;this.numberTicks=this.numberTicks||ak;var O;for(aa=0;aa1){var aJ=String(P);if(aJ.search(/\./)==-1){var aF=aJ.search(/0+$/);av=(aF>0)?aJ.length-aF-1:0}}M=P/Math.pow(10,av);for(aa=0;aa'+this.ticks[aa][1]+"");this.canvas._elem.after(J);aO=J.outerWidth(true);g=J.outerHeight(true);W=this._tickPoints[aa][0]-aO*(this._tickPoints[aa][2]-Math.PI)/Math.PI-an*Math.cos(this._tickPoints[aa][2]);T=this._tickPoints[aa][1]-g/2+g/2*Math.pow(Math.abs((Math.sin(this._tickPoints[aa][2]))),0.5)+an/3*Math.pow(Math.abs((Math.sin(this._tickPoints[aa][2]))),0.5);J.css({left:W,top:T});G=aO*Math.cos(this._tickPoints[aa][2])+g*Math.sin(Math.PI/2+this._tickPoints[aa][2]/2);n=(G>n)?G:n}}if(this.label&&this.labelPosition=="inside"){var W=this._center[0]+this.canvas._offsets.left;var an=this.tickPadding*(1-1/(this.diameter/80+1));var T=0.5*(this._center[1]+this.canvas._offsets.top-this.hubRadius)+0.5*(this._center[1]+this.canvas._offsets.top-this.tickOuterRadius+this.tickLength+an)+this.labelHeightAdjust;W-=this._labelElem.outerWidth(true)/2;T-=this._labelElem.outerHeight(true)/2;this._labelElem.css({left:W,top:T})}else{if(this.label&&this.labelPosition=="bottom"){var W=this._center[0]+this.canvas._offsets.left-this._labelElem.outerWidth(true)/2;var T=this._center[1]+this.canvas._offsets.top+this.innerPad+ +this.ringWidth+this.padding+this.labelHeightAdjust;this._labelElem.css({left:W,top:T})}}X.save();var ax=this.intervalInnerRadius||this.hubRadius*1.5;if(this.intervalOuterRadius==null){if(this.showTickLabels){var ag=(this.tickOuterRadius-this.tickLength-this.tickPadding-this.diameter/8)}else{var ag=(this.tickOuterRadius-this.tickLength-this.diameter/16)}}else{var ag=this.intervalOuterRadius}var P=this.max-this.min;var aD=this.intervals[this.intervals.length-1]-this.min;var y,Z,u=this.span*Math.PI/180;for(aa=0;aathis.max+R*3/this.span){ay=this.max+R*3/this.span}if(this.data[0][1]');var f=false,q=false,u,o;var w=p[0];if(w.show){var t=w.data;if(this.numberRows){u=this.numberRows;if(!this.numberColumns){o=Math.ceil(t.length/u)}else{o=this.numberColumns}}else{if(this.numberColumns){o=this.numberColumns;u=Math.ceil(t.length/this.numberColumns)}else{u=t.length;o=1}}var n,m,r,g,e,l,k,h;var v=0;for(n=0;n').prependTo(this._elem)}else{r=c(' ').appendTo(this._elem)}for(m=0;m0){f=true}else{f=false}}else{if(n==u-1){f=false}else{f=true}}k=(f)?this.rowSpacing:"0";g=c(' ');e=c(' ');if(this.escapeHtml){e.text(l)}else{e.html(l)}if(q){e.prependTo(r);g.prependTo(r)}else{g.appendTo(r);e.appendTo(r)}f=true}v++}}}}return this._elem};function a(j,h,f){f=f||{};f.axesDefaults=f.axesDefaults||{};f.legend=f.legend||{};f.seriesDefaults=f.seriesDefaults||{};f.grid=f.grid||{};var e=false;if(f.seriesDefaults.renderer==c.jqplot.MeterGaugeRenderer){e=true}else{if(f.series){for(var g=0;g
- *
- * You will most likely want to use a date axis renderer
- * for the x axis also, so include the date axis render js file also:
- *
- * >
- *
- * Then you set the renderer in the series options on your plot:
- *
- * > series: [{renderer:$.jqplot.OHLCRenderer}]
- *
- * For OHLC and candlestick charts, data should be specified
- * like so:
- *
- * > dat = [['07/06/2009',138.7,139.68,135.18,135.4], ['06/29/2009',143.46,144.66,139.79,140.02], ...]
- *
- * If the data array has only 4 values per point instead of 5,
- * the renderer will create a Hi Low Close chart instead. In that case,
- * data should be supplied like:
- *
- * > dat = [['07/06/2009',139.68,135.18,135.4], ['06/29/2009',144.66,139.79,140.02], ...]
- *
- * To generate a candlestick chart instead of an OHLC chart,
- * set the "candlestick" option to true:
- *
- * > series: [{renderer:$.jqplot.OHLCRenderer, rendererOptions:{candleStick:true}}],
- *
- */
- $.jqplot.OHLCRenderer = function(){
- // subclass line renderer to make use of some of it's methods.
- $.jqplot.LineRenderer.call(this);
- // prop: candleStick
- // true to render chart as candleStick.
- // Must have an open price, cannot be a hlc chart.
- this.candleStick = false;
- // prop: tickLength
- // length of the line in pixels indicating open and close price.
- // Default will auto calculate based on plot width and
- // number of points displayed.
- this.tickLength = 'auto';
- // prop: bodyWidth
- // width of the candlestick body in pixels. Default will auto calculate
- // based on plot width and number of candlesticks displayed.
- this.bodyWidth = 'auto';
- // prop: openColor
- // color of the open price tick mark. Default is series color.
- this.openColor = null;
- // prop: closeColor
- // color of the close price tick mark. Default is series color.
- this.closeColor = null;
- // prop: wickColor
- // color of the hi-lo line thorugh the candlestick body.
- // Default is the series color.
- this.wickColor = null;
- // prop: fillUpBody
- // true to render an "up" day (close price greater than open price)
- // with a filled candlestick body.
- this.fillUpBody = false;
- // prop: fillDownBody
- // true to render a "down" day (close price lower than open price)
- // with a filled candlestick body.
- this.fillDownBody = true;
- // prop: upBodyColor
- // Color of candlestick body of an "up" day. Default is series color.
- this.upBodyColor = null;
- // prop: downBodyColor
- // Color of candlestick body on a "down" day. Default is series color.
- this.downBodyColor = null;
- // prop: hlc
- // true if is a hi-low-close chart (no open price).
- // This is determined automatically from the series data.
- this.hlc = false;
- // prop: lineWidth
- // Width of the hi-low line and open/close ticks.
- // Must be set in the rendererOptions for the series.
- this.lineWidth = 1.5;
- this._tickLength;
- this._bodyWidth;
- };
-
- $.jqplot.OHLCRenderer.prototype = new $.jqplot.LineRenderer();
- $.jqplot.OHLCRenderer.prototype.constructor = $.jqplot.OHLCRenderer;
-
- // called with scope of series.
- $.jqplot.OHLCRenderer.prototype.init = function(options) {
- options = options || {};
- // lineWidth has to be set on the series, changes in renderer
- // constructor have no effect. set the default here
- // if no renderer option for lineWidth is specified.
- this.lineWidth = options.lineWidth || 1.5;
- $.jqplot.LineRenderer.prototype.init.call(this, options);
- this._type = 'ohlc';
- // set the yaxis data bounds here to account for hi and low values
- var db = this._yaxis._dataBounds;
- var d = this._plotData;
- // if data points have less than 5 values, force a hlc chart.
- if (d[0].length < 5) {
- this.renderer.hlc = true;
-
- for (var j=0; j db.max || db.max == null) {
- db.max = d[j][1];
- }
- }
- }
- else {
- for (var j=0; j db.max || db.max == null) {
- db.max = d[j][2];
- }
- }
- }
-
- };
-
- // called within scope of series.
- $.jqplot.OHLCRenderer.prototype.draw = function(ctx, gd, options) {
- var d = this.data;
- var xmin = this._xaxis.min;
- var xmax = this._xaxis.max;
- // index of last value below range of plot.
- var xminidx = 0;
- // index of first value above range of plot.
- var xmaxidx = d.length;
- var xp = this._xaxis.series_u2p;
- var yp = this._yaxis.series_u2p;
- var i, prevColor, ops, b, h, w, a, points;
- var o;
- var r = this.renderer;
- var opts = (options != undefined) ? options : {};
- var shadow = (opts.shadow != undefined) ? opts.shadow : this.shadow;
- var fill = (opts.fill != undefined) ? opts.fill : this.fill;
- var fillAndStroke = (opts.fillAndStroke != undefined) ? opts.fillAndStroke : this.fillAndStroke;
- r.bodyWidth = (opts.bodyWidth != undefined) ? opts.bodyWidth : r.bodyWidth;
- r.tickLength = (opts.tickLength != undefined) ? opts.tickLength : r.tickLength;
- ctx.save();
- if (this.show) {
- var x, open, hi, low, close;
- // need to get widths based on number of points shown,
- // not on total number of points. Use the results
- // to speed up drawing in next step.
- for (var i=0; i open) {
- // draw wick
- if (r.wickColor) {
- o.color = r.wickColor;
- }
- else if (r.downBodyColor) {
- o.color = r.downBodyColor;
- }
- ops = $.extend(true, {}, opts, o);
- r.shapeRenderer.draw(ctx, [[x, hi], [x, open]], ops);
- r.shapeRenderer.draw(ctx, [[x, close], [x, low]], ops);
-
- o = {};
-
- b = open;
- h = close - open;
- // if color specified, use it
- if (r.fillDownBody) {
- o.fillRect = true;
- }
- else {
- o.strokeRect = true;
- w = w - this.lineWidth;
- a = x - w/2;
- }
- if (r.downBodyColor) {
- o.color = r.downBodyColor;
- o.fillStyle = r.downBodyColor;
- }
- points = [a, b, w, h];
- }
- // even, open = close
- else {
- // draw wick
- if (r.wickColor) {
- o.color = r.wickColor;
- }
- ops = $.extend(true, {}, opts, o);
- r.shapeRenderer.draw(ctx, [[x, hi], [x, low]], ops);
- o = {};
- o.fillRect = false;
- o.strokeRect = false;
- a = [x - w/2, open];
- b = [x + w/2, close];
- w = null;
- h = null;
- points = [a, b];
- }
- ops = $.extend(true, {}, opts, o);
- r.shapeRenderer.draw(ctx, points, ops);
- }
- else {
- prevColor = opts.color;
- if (r.openColor) {
- opts.color = r.openColor;
- }
- // draw open tick
- if (!r.hlc) {
- r.shapeRenderer.draw(ctx, [[x-r._tickLength, open], [x, open]], opts);
- }
- opts.color = prevColor;
- // draw wick
- if (r.wickColor) {
- opts.color = r.wickColor;
- }
- r.shapeRenderer.draw(ctx, [[x, hi], [x, low]], opts);
- opts.color = prevColor;
- // draw close tick
- if (r.closeColor) {
- opts.color = r.closeColor;
- }
- r.shapeRenderer.draw(ctx, [[x, close], [x+r._tickLength, close]], opts);
- opts.color = prevColor;
- }
- }
- }
-
- ctx.restore();
- };
-
- $.jqplot.OHLCRenderer.prototype.drawShadow = function(ctx, gd, options) {
- // This is a no-op, shadows drawn with lines.
- };
-
- // called with scope of plot.
- $.jqplot.OHLCRenderer.checkOptions = function(target, data, options) {
- // provide some sensible highlighter options by default
- // These aren't good for hlc, only for ohlc or candlestick
- if (!options.highlighter) {
- options.highlighter = {
- showMarker:false,
- tooltipAxes: 'y',
- yvalues: 4,
- formatString:'date: %s open: %s hi: %s low: %s close: %s
'
- };
- }
- };
-
- //$.jqplot.preInitHooks.push($.jqplot.OHLCRenderer.checkOptions);
-
-})(jQuery);
\ No newline at end of file
diff --git a/libreplan-webapp/src/main/webapp/jqplot/plugins/jqplot.ohlcRenderer.min.js b/libreplan-webapp/src/main/webapp/jqplot/plugins/jqplot.ohlcRenderer.min.js
deleted file mode 100644
index 0d8f89a74..000000000
--- a/libreplan-webapp/src/main/webapp/jqplot/plugins/jqplot.ohlcRenderer.min.js
+++ /dev/null
@@ -1,57 +0,0 @@
-/**
- * jqPlot
- * Pure JavaScript plotting plugin using jQuery
- *
- * Version: 1.0.0b2_r1012
- *
- * Copyright (c) 2009-2011 Chris Leonello
- * jqPlot is currently available for use in all personal or commercial projects
- * under both the MIT (http://www.opensource.org/licenses/mit-license.php) and GPL
- * version 2.0 (http://www.gnu.org/licenses/gpl-2.0.html) licenses. This means that you can
- * choose the license that best suits your project and use it accordingly.
- *
- * Although not required, the author would appreciate an email letting him
- * know of any substantial use of jqPlot. You can reach the author at:
- * chris at jqplot dot com or see http://www.jqplot.com/info.php .
- *
- * If you are feeling kind and generous, consider supporting the project by
- * making a donation at: http://www.jqplot.com/donate.php .
- *
- * sprintf functions contained in jqplot.sprintf.js by Ash Searle:
- *
- * version 2007.04.27
- * author Ash Searle
- * http://hexmen.com/blog/2007/03/printf-sprintf/
- * http://hexmen.com/js/sprintf.js
- * The author (Ash Searle) has placed this code in the public domain:
- * "This code is unrestricted: you are free to use it however you like."
- *
- * included jsDate library by Chris Leonello:
- *
- * Copyright (c) 2010-2011 Chris Leonello
- *
- * jsDate is currently available for use in all personal or commercial projects
- * under both the MIT and GPL version 2.0 licenses. This means that you can
- * choose the license that best suits your project and use it accordingly.
- *
- * jsDate borrows many concepts and ideas from the Date Instance
- * Methods by Ken Snyder along with some parts of Ken's actual code.
- *
- * Ken's origianl Date Instance Methods and copyright notice:
- *
- * Ken Snyder (ken d snyder at gmail dot com)
- * 2008-09-10
- * version 2.0.2 (http://kendsnyder.com/sandbox/date/)
- * Creative Commons Attribution License 3.0 (http://creativecommons.org/licenses/by/3.0/)
- *
- * jqplotToImage function based on Larry Siden's export-jqplot-to-png.js.
- * Larry has generously given permission to adapt his code for inclusion
- * into jqPlot.
- *
- * Larry's original code can be found here:
- *
- * https://github.com/lsiden/export-jqplot-to-png
- *
- *
- */
-(function(a){a.jqplot.OHLCRenderer=function(){a.jqplot.LineRenderer.call(this);this.candleStick=false;this.tickLength="auto";this.bodyWidth="auto";this.openColor=null;this.closeColor=null;this.wickColor=null;this.fillUpBody=false;this.fillDownBody=true;this.upBodyColor=null;this.downBodyColor=null;this.hlc=false;this.lineWidth=1.5;this._tickLength;this._bodyWidth};a.jqplot.OHLCRenderer.prototype=new a.jqplot.LineRenderer();a.jqplot.OHLCRenderer.prototype.constructor=a.jqplot.OHLCRenderer;a.jqplot.OHLCRenderer.prototype.init=function(e){e=e||{};this.lineWidth=e.lineWidth||1.5;a.jqplot.LineRenderer.prototype.init.call(this,e);this._type="ohlc";var b=this._yaxis._dataBounds;var f=this._plotData;if(f[0].length<5){this.renderer.hlc=true;for(var c=0;cb.max||b.max==null){b.max=f[c][1]}}}else{for(var c=0;cb.max||b.max==null){b.max=f[c][2]}}}};a.jqplot.OHLCRenderer.prototype.draw=function(A,N,j){var J=this.data;var v=this._xaxis.min;var z=this._xaxis.max;var l=0;var K=J.length;var p=this._xaxis.series_u2p;var G=this._yaxis.series_u2p;var D,E,f,M,F,n,O,C;var y;var u=this.renderer;var s=(j!=undefined)?j:{};var k=(s.shadow!=undefined)?s.shadow:this.shadow;var B=(s.fill!=undefined)?s.fill:this.fill;var c=(s.fillAndStroke!=undefined)?s.fillAndStroke:this.fillAndStroke;u.bodyWidth=(s.bodyWidth!=undefined)?s.bodyWidth:u.bodyWidth;u.tickLength=(s.tickLength!=undefined)?s.tickLength:u.tickLength;A.save();if(this.show){var m,q,g,Q,t;for(var D=0;Dq){if(u.wickColor){y.color=u.wickColor}else{if(u.downBodyColor){y.color=u.downBodyColor}}f=a.extend(true,{},s,y);u.shapeRenderer.draw(A,[[m,g],[m,q]],f);u.shapeRenderer.draw(A,[[m,t],[m,Q]],f);y={};M=q;F=t-q;if(u.fillDownBody){y.fillRect=true}else{y.strokeRect=true;n=n-this.lineWidth;O=m-n/2}if(u.downBodyColor){y.color=u.downBodyColor;y.fillStyle=u.downBodyColor}C=[O,M,n,F]}else{if(u.wickColor){y.color=u.wickColor}f=a.extend(true,{},s,y);u.shapeRenderer.draw(A,[[m,g],[m,Q]],f);y={};y.fillRect=false;y.strokeRect=false;O=[m-n/2,q];M=[m+n/2,t];n=null;F=null;C=[O,M]}}f=a.extend(true,{},s,y);u.shapeRenderer.draw(A,C,f)}else{E=s.color;if(u.openColor){s.color=u.openColor}if(!u.hlc){u.shapeRenderer.draw(A,[[m-u._tickLength,q],[m,q]],s)}s.color=E;if(u.wickColor){s.color=u.wickColor}u.shapeRenderer.draw(A,[[m,g],[m,Q]],s);s.color=E;if(u.closeColor){s.color=u.closeColor}u.shapeRenderer.draw(A,[[m,t],[m+u._tickLength,t]],s);s.color=E}}}A.restore()};a.jqplot.OHLCRenderer.prototype.drawShadow=function(b,d,c){};a.jqplot.OHLCRenderer.checkOptions=function(d,c,b){if(!b.highlighter){b.highlighter={showMarker:false,tooltipAxes:"y",yvalues:4,formatString:'date: %s open: %s hi: %s low: %s close: %s
'}}}})(jQuery);
\ No newline at end of file
diff --git a/libreplan-webapp/src/main/webapp/jqplot/plugins/jqplot.pieRenderer.js b/libreplan-webapp/src/main/webapp/jqplot/plugins/jqplot.pieRenderer.js
deleted file mode 100644
index e399483d3..000000000
--- a/libreplan-webapp/src/main/webapp/jqplot/plugins/jqplot.pieRenderer.js
+++ /dev/null
@@ -1,899 +0,0 @@
-/**
- * jqPlot
- * Pure JavaScript plotting plugin using jQuery
- *
- * Version: 1.0.0b2_r1012
- *
- * Copyright (c) 2009-2011 Chris Leonello
- * jqPlot is currently available for use in all personal or commercial projects
- * under both the MIT (http://www.opensource.org/licenses/mit-license.php) and GPL
- * version 2.0 (http://www.gnu.org/licenses/gpl-2.0.html) licenses. This means that you can
- * choose the license that best suits your project and use it accordingly.
- *
- * Although not required, the author would appreciate an email letting him
- * know of any substantial use of jqPlot. You can reach the author at:
- * chris at jqplot dot com or see http://www.jqplot.com/info.php .
- *
- * If you are feeling kind and generous, consider supporting the project by
- * making a donation at: http://www.jqplot.com/donate.php .
- *
- * sprintf functions contained in jqplot.sprintf.js by Ash Searle:
- *
- * version 2007.04.27
- * author Ash Searle
- * http://hexmen.com/blog/2007/03/printf-sprintf/
- * http://hexmen.com/js/sprintf.js
- * The author (Ash Searle) has placed this code in the public domain:
- * "This code is unrestricted: you are free to use it however you like."
- *
- */
-(function($) {
- /**
- * Class: $.jqplot.PieRenderer
- * Plugin renderer to draw a pie chart.
- * x values, if present, will be used as slice labels.
- * y values give slice size.
- *
- * To use this renderer, you need to include the
- * pie renderer plugin, for example:
- *
- * >
- *
- * Properties described here are passed into the $.jqplot function
- * as options on the series renderer. For example:
- *
- * > plot2 = $.jqplot('chart2', [s1, s2], {
- * > seriesDefaults: {
- * > renderer:$.jqplot.PieRenderer,
- * > rendererOptions:{
- * > sliceMargin: 2,
- * > startAngle: -90
- * > }
- * > }
- * > });
- *
- * A pie plot will trigger events on the plot target
- * according to user interaction. All events return the event object,
- * the series index, the point (slice) index, and the point data for
- * the appropriate slice.
- *
- * 'jqplotDataMouseOver' - triggered when user mouseing over a slice.
- * 'jqplotDataHighlight' - triggered the first time user mouses over a slice,
- * if highlighting is enabled.
- * 'jqplotDataUnhighlight' - triggered when a user moves the mouse out of
- * a highlighted slice.
- * 'jqplotDataClick' - triggered when the user clicks on a slice.
- * 'jqplotDataRightClick' - tiggered when the user right clicks on a slice if
- * the "captureRightClick" option is set to true on the plot.
- */
- $.jqplot.PieRenderer = function(){
- $.jqplot.LineRenderer.call(this);
- };
-
- $.jqplot.PieRenderer.prototype = new $.jqplot.LineRenderer();
- $.jqplot.PieRenderer.prototype.constructor = $.jqplot.PieRenderer;
-
- // called with scope of a series
- $.jqplot.PieRenderer.prototype.init = function(options, plot) {
- // Group: Properties
- //
- // prop: diameter
- // Outer diameter of the pie, auto computed by default
- this.diameter = null;
- // prop: padding
- // padding between the pie and plot edges, legend, etc.
- this.padding = 20;
- // prop: sliceMargin
- // angular spacing between pie slices in degrees.
- this.sliceMargin = 0;
- // prop: fill
- // true or false, wether to fil the slices.
- this.fill = true;
- // prop: shadowOffset
- // offset of the shadow from the slice and offset of
- // each succesive stroke of the shadow from the last.
- this.shadowOffset = 2;
- // prop: shadowAlpha
- // transparency of the shadow (0 = transparent, 1 = opaque)
- this.shadowAlpha = 0.07;
- // prop: shadowDepth
- // number of strokes to apply to the shadow,
- // each stroke offset shadowOffset from the last.
- this.shadowDepth = 5;
- // prop: highlightMouseOver
- // True to highlight slice when moused over.
- // This must be false to enable highlightMouseDown to highlight when clicking on a slice.
- this.highlightMouseOver = true;
- // prop: highlightMouseDown
- // True to highlight when a mouse button is pressed over a slice.
- // This will be disabled if highlightMouseOver is true.
- this.highlightMouseDown = false;
- // prop: highlightColors
- // an array of colors to use when highlighting a slice.
- this.highlightColors = [];
- // prop: dataLabels
- // Either 'label', 'value', 'percent' or an array of labels to place on the pie slices.
- // Defaults to percentage of each pie slice.
- this.dataLabels = 'percent';
- // prop: showDataLabels
- // true to show data labels on slices.
- this.showDataLabels = false;
- // prop: dataLabelFormatString
- // Format string for data labels. If none, '%s' is used for "label" and for arrays, '%d' for value and '%d%%' for percentage.
- this.dataLabelFormatString = null;
- // prop: dataLabelThreshold
- // Threshhold in percentage (0-100) of pie area, below which no label will be displayed.
- // This applies to all label types, not just to percentage labels.
- this.dataLabelThreshold = 3;
- // prop: dataLabelPositionFactor
- // A Multiplier (0-1) of the pie radius which controls position of label on slice.
- // Increasing will slide label toward edge of pie, decreasing will slide label toward center of pie.
- this.dataLabelPositionFactor = 0.52;
- // prop: dataLabelNudge
- // Number of pixels to slide the label away from (+) or toward (-) the center of the pie.
- this.dataLabelNudge = 2;
- // prop: dataLabelCenterOn
- // True to center the data label at its position.
- // False to set the inside facing edge of the label at its position.
- this.dataLabelCenterOn = true;
- // prop: startAngle
- // Angle to start drawing pie in degrees.
- // According to orientation of canvas coordinate system:
- // 0 = on the positive x axis
- // -90 = on the positive y axis.
- // 90 = on the negaive y axis.
- // 180 or - 180 = on the negative x axis.
- this.startAngle = 0;
- this.tickRenderer = $.jqplot.PieTickRenderer;
- // Used as check for conditions where pie shouldn't be drawn.
- this._drawData = true;
- this._type = 'pie';
-
- // if user has passed in highlightMouseDown option and not set highlightMouseOver, disable highlightMouseOver
- if (options.highlightMouseDown && options.highlightMouseOver == null) {
- options.highlightMouseOver = false;
- }
-
- $.extend(true, this, options);
-
- if (this.sliceMargin < 0) {
- this.sliceMargin = 0;
- }
-
- this._diameter = null;
- this._radius = null;
- // array of [start,end] angles arrays, one for each slice. In radians.
- this._sliceAngles = [];
- // index of the currenty highlighted point, if any
- this._highlightedPoint = null;
-
- // set highlight colors if none provided
- if (this.highlightColors.length == 0) {
- for (var i=0; i 570) ? newrgb[j] * 0.8 : newrgb[j] + 0.3 * (255 - newrgb[j]);
- newrgb[j] = parseInt(newrgb[j], 10);
- }
- this.highlightColors.push('rgb('+newrgb[0]+','+newrgb[1]+','+newrgb[2]+')');
- }
- }
-
- this.highlightColorGenerator = new $.jqplot.ColorGenerator(this.highlightColors);
-
- plot.postParseOptionsHooks.addOnce(postParseOptions);
- plot.postInitHooks.addOnce(postInit);
- plot.eventListenerHooks.addOnce('jqplotMouseMove', handleMove);
- plot.eventListenerHooks.addOnce('jqplotMouseDown', handleMouseDown);
- plot.eventListenerHooks.addOnce('jqplotMouseUp', handleMouseUp);
- plot.eventListenerHooks.addOnce('jqplotClick', handleClick);
- plot.eventListenerHooks.addOnce('jqplotRightClick', handleRightClick);
- plot.postDrawHooks.addOnce(postPlotDraw);
- };
-
- $.jqplot.PieRenderer.prototype.setGridData = function(plot) {
- // set gridData property. This will hold angle in radians of each data point.
- var stack = [];
- var td = [];
- var sa = this.startAngle/180*Math.PI;
- var tot = 0;
- // don't know if we have any valid data yet, so set plot to not draw.
- this._drawData = false;
- for (var i=0; i0) {
- stack[i] += stack[i-1];
- }
- tot += this.data[i][1];
- }
- var fact = Math.PI*2/stack[stack.length - 1];
-
- for (var i=0; i0) {
- stack[i] += stack[i-1];
- }
- tot += data[i][1];
- }
- var fact = Math.PI*2/stack[stack.length - 1];
-
- for (var i=0; i 0 && absang > 0.01 && absang < 6.282) {
- rprime = parseFloat(sm) / 2.0 / calcRadiusAdjustment(ang);
- }
-
- return rprime;
- }
-
- $.jqplot.PieRenderer.prototype.drawSlice = function (ctx, ang1, ang2, color, isShadow) {
- if (this._drawData) {
- var r = this._radius;
- var fill = this.fill;
- var lineWidth = this.lineWidth;
- var sm = this.sliceMargin;
- if (this.fill == false) {
- sm += this.lineWidth;
- }
- ctx.save();
- ctx.translate(this._center[0], this._center[1]);
-
- var rprime = calcRPrime(ang1, ang2, this.sliceMargin, this.fill, this.lineWidth);
-
- var transx = rprime * Math.cos((ang1 + ang2) / 2.0);
- var transy = rprime * Math.sin((ang1 + ang2) / 2.0);
-
- if ((ang2 - ang1) <= Math.PI) {
- r -= rprime;
- }
- else {
- r += rprime;
- }
-
- ctx.translate(transx, transy);
-
- if (isShadow) {
- for (var i=0, l=this.shadowDepth; i 6.282 + this.startAngle) {
- ang2 = 6.282 + this.startAngle;
- if (ang1 > ang2) {
- ang1 = 6.281 + this.startAngle;
- }
- }
- // Fix for IE, where it can't seem to handle 0 degree angles. Also avoids
- // ugly line on unfilled pies.
- if (ang1 >= ang2) {
- return;
- }
-
- ctx.beginPath();
- ctx.fillStyle = color;
- ctx.strokeStyle = color;
- ctx.lineWidth = lineWidth;
- ctx.arc(0, 0, rad, ang1, ang2, false);
- ctx.lineTo(0,0);
- ctx.closePath();
-
- if (fill) {
- ctx.fill();
- }
- else {
- ctx.stroke();
- }
- }
- };
-
- // called with scope of series
- $.jqplot.PieRenderer.prototype.draw = function (ctx, gd, options, plot) {
- var i;
- var opts = (options != undefined) ? options : {};
- // offset and direction of offset due to legend placement
- var offx = 0;
- var offy = 0;
- var trans = 1;
- var colorGenerator = new $.jqplot.ColorGenerator(this.seriesColors);
- if (options.legendInfo && options.legendInfo.placement == 'insideGrid') {
- var li = options.legendInfo;
- switch (li.location) {
- case 'nw':
- offx = li.width + li.xoffset;
- break;
- case 'w':
- offx = li.width + li.xoffset;
- break;
- case 'sw':
- offx = li.width + li.xoffset;
- break;
- case 'ne':
- offx = li.width + li.xoffset;
- trans = -1;
- break;
- case 'e':
- offx = li.width + li.xoffset;
- trans = -1;
- break;
- case 'se':
- offx = li.width + li.xoffset;
- trans = -1;
- break;
- case 'n':
- offy = li.height + li.yoffset;
- break;
- case 's':
- offy = li.height + li.yoffset;
- trans = -1;
- break;
- default:
- break;
- }
- }
-
- var shadow = (opts.shadow != undefined) ? opts.shadow : this.shadow;
- var fill = (opts.fill != undefined) ? opts.fill : this.fill;
- var cw = ctx.canvas.width;
- var ch = ctx.canvas.height;
- var w = cw - offx - 2 * this.padding;
- var h = ch - offy - 2 * this.padding;
- var mindim = Math.min(w,h);
- var d = mindim;
-
- // Fixes issue #272. Thanks hugwijst!
- // reset slice angles array.
- this._sliceAngles = [];
-
- var sm = this.sliceMargin;
- if (this.fill == false) {
- sm += this.lineWidth;
- }
-
- var rprime;
- var maxrprime = 0;
-
- var ang, ang1, ang2, shadowColor;
- var sa = this.startAngle / 180 * Math.PI;
-
- // have to pre-draw shadows, so loop throgh here and calculate some values also.
- for (var i=0, l=gd.length; i Math.PI) {
- maxrprime = Math.max(rprime, maxrprime);
- }
- }
-
- if (this.diameter != null && this.diameter > 0) {
- this._diameter = this.diameter - 2*maxrprime;
- }
- else {
- this._diameter = d - 2*maxrprime;
- }
-
- // Need to check for undersized pie. This can happen if
- // plot area too small and legend is too big.
- if (this._diameter < 6) {
- $.jqplot.log('Diameter of pie too small, not rendering.');
- return;
- }
-
- var r = this._radius = this._diameter/2;
-
- this._center = [(cw - trans * offx)/2 + trans * offx + maxrprime * Math.cos(sa), (ch - trans*offy)/2 + trans * offy + maxrprime * Math.sin(sa)];
-
- if (this.shadow) {
- for (var i=0, l=gd.length; i= this.dataLabelThreshold) {
- var fstr, avgang = (this._sliceAngles[i][0] + this._sliceAngles[i][1])/2, label;
-
- if (this.dataLabels == 'label') {
- fstr = this.dataLabelFormatString || '%s';
- label = $.jqplot.sprintf(fstr, gd[i][0]);
- }
- else if (this.dataLabels == 'value') {
- fstr = this.dataLabelFormatString || '%d';
- label = $.jqplot.sprintf(fstr, this.data[i][1]);
- }
- else if (this.dataLabels == 'percent') {
- fstr = this.dataLabelFormatString || '%d%%';
- label = $.jqplot.sprintf(fstr, gd[i][2]*100);
- }
- else if (this.dataLabels.constructor == Array) {
- fstr = this.dataLabelFormatString || '%s';
- label = $.jqplot.sprintf(fstr, this.dataLabels[i]);
- }
-
- var fact = (this._radius ) * this.dataLabelPositionFactor + this.sliceMargin + this.dataLabelNudge;
-
- var x = this._center[0] + Math.cos(avgang) * fact + this.canvas._offsets.left;
- var y = this._center[1] + Math.sin(avgang) * fact + this.canvas._offsets.top;
-
- var labelelem = $('' + label + '
').insertBefore(plot.eventCanvas._elem);
- if (this.dataLabelCenterOn) {
- x -= labelelem.width()/2;
- y -= labelelem.height()/2;
- }
- else {
- x -= labelelem.width() * Math.sin(avgang/2);
- y -= labelelem.height()/2;
- }
- x = Math.round(x);
- y = Math.round(y);
- labelelem.css({left: x, top: y});
- }
- }
- };
-
- $.jqplot.PieAxisRenderer = function() {
- $.jqplot.LinearAxisRenderer.call(this);
- };
-
- $.jqplot.PieAxisRenderer.prototype = new $.jqplot.LinearAxisRenderer();
- $.jqplot.PieAxisRenderer.prototype.constructor = $.jqplot.PieAxisRenderer;
-
-
- // There are no traditional axes on a pie chart. We just need to provide
- // dummy objects with properties so the plot will render.
- // called with scope of axis object.
- $.jqplot.PieAxisRenderer.prototype.init = function(options){
- //
- this.tickRenderer = $.jqplot.PieTickRenderer;
- $.extend(true, this, options);
- // I don't think I'm going to need _dataBounds here.
- // have to go Axis scaling in a way to fit chart onto plot area
- // and provide u2p and p2u functionality for mouse cursor, etc.
- // for convienence set _dataBounds to 0 and 100 and
- // set min/max to 0 and 100.
- this._dataBounds = {min:0, max:100};
- this.min = 0;
- this.max = 100;
- this.showTicks = false;
- this.ticks = [];
- this.showMark = false;
- this.show = false;
- };
-
-
-
-
- $.jqplot.PieLegendRenderer = function(){
- $.jqplot.TableLegendRenderer.call(this);
- };
-
- $.jqplot.PieLegendRenderer.prototype = new $.jqplot.TableLegendRenderer();
- $.jqplot.PieLegendRenderer.prototype.constructor = $.jqplot.PieLegendRenderer;
-
- /**
- * Class: $.jqplot.PieLegendRenderer
- * Legend Renderer specific to pie plots. Set by default
- * when user creates a pie plot.
- */
- $.jqplot.PieLegendRenderer.prototype.init = function(options) {
- // Group: Properties
- //
- // prop: numberRows
- // Maximum number of rows in the legend. 0 or null for unlimited.
- this.numberRows = null;
- // prop: numberColumns
- // Maximum number of columns in the legend. 0 or null for unlimited.
- this.numberColumns = null;
- $.extend(true, this, options);
- };
-
- // called with context of legend
- $.jqplot.PieLegendRenderer.prototype.draw = function() {
- var legend = this;
- if (this.show) {
- var series = this._series;
-
-
- this._elem = $(document.createElement('table'));
- this._elem.addClass('jqplot-table-legend');
-
- var ss = {position:'absolute'};
- if (this.background) {
- ss['background'] = this.background;
- }
- if (this.border) {
- ss['border'] = this.border;
- }
- if (this.fontSize) {
- ss['fontSize'] = this.fontSize;
- }
- if (this.fontFamily) {
- ss['fontFamily'] = this.fontFamily;
- }
- if (this.textColor) {
- ss['textColor'] = this.textColor;
- }
- if (this.marginTop != null) {
- ss['marginTop'] = this.marginTop;
- }
- if (this.marginBottom != null) {
- ss['marginBottom'] = this.marginBottom;
- }
- if (this.marginLeft != null) {
- ss['marginLeft'] = this.marginLeft;
- }
- if (this.marginRight != null) {
- ss['marginRight'] = this.marginRight;
- }
-
- this._elem.css(ss);
-
- // Pie charts legends don't go by number of series, but by number of data points
- // in the series. Refactor things here for that.
-
- var pad = false,
- reverse = false,
- nr,
- nc;
- var s = series[0];
- var colorGenerator = new $.jqplot.ColorGenerator(s.seriesColors);
-
- if (s.show) {
- var pd = s.data;
- if (this.numberRows) {
- nr = this.numberRows;
- if (!this.numberColumns){
- nc = Math.ceil(pd.length/nr);
- }
- else{
- nc = this.numberColumns;
- }
- }
- else if (this.numberColumns) {
- nc = this.numberColumns;
- nr = Math.ceil(pd.length/this.numberColumns);
- }
- else {
- nr = pd.length;
- nc = 1;
- }
-
- var i, j;
- var tr, td1, td2;
- var lt, rs, color;
- var idx = 0;
- var div0, div1;
-
- for (i=0; i0){
- pad = true;
- }
- else{
- pad = false;
- }
- }
- else{
- if (i == nr -1){
- pad = false;
- }
- else{
- pad = true;
- }
- }
- rs = (pad) ? this.rowSpacing : '0';
-
-
-
- td1 = $(document.createElement('td'));
- td1.addClass('jqplot-table-legend jqplot-table-legend-swatch');
- td1.css({textAlign: 'center', paddingTop: rs});
-
- div0 = $(document.createElement('div'));
- div0.addClass('jqplot-table-legend-swatch-outline');
- div1 = $(document.createElement('div'));
- div1.addClass('jqplot-table-legend-swatch');
- div1.css({backgroundColor: color, borderColor: color});
- td1.append(div0.append(div1));
-
- td2 = $(document.createElement('td'));
- td2.addClass('jqplot-table-legend jqplot-table-legend-label');
- td2.css('paddingTop', rs);
-
- if (this.escapeHtml){
- td2.text(lt);
- }
- else {
- td2.html(lt);
- }
- if (reverse) {
- td2.prependTo(tr);
- td1.prependTo(tr);
- }
- else {
- td1.appendTo(tr);
- td2.appendTo(tr);
- }
- pad = true;
- }
- idx++;
- }
- }
- }
- }
- return this._elem;
- };
-
- $.jqplot.PieRenderer.prototype.handleMove = function(ev, gridpos, datapos, neighbor, plot) {
- if (neighbor) {
- var ins = [neighbor.seriesIndex, neighbor.pointIndex, neighbor.data];
- plot.target.trigger('jqplotDataMouseOver', ins);
- if (plot.series[ins[0]].highlightMouseOver && !(ins[0] == plot.plugins.pieRenderer.highlightedSeriesIndex && ins[1] == plot.series[ins[0]]._highlightedPoint)) {
- plot.target.trigger('jqplotDataHighlight', ins);
- highlight (plot, ins[0], ins[1]);
- }
- }
- else if (neighbor == null) {
- unhighlight (plot);
- }
- };
-
-
- // this.eventCanvas._elem.bind($.jqplot.eventListenerHooks[i][0], {plot:this}, $.jqplot.eventListenerHooks[i][1]);
-
- // setup default renderers for axes and legend so user doesn't have to
- // called with scope of plot
- function preInit(target, data, options) {
- options = options || {};
- options.axesDefaults = options.axesDefaults || {};
- options.legend = options.legend || {};
- options.seriesDefaults = options.seriesDefaults || {};
- // only set these if there is a pie series
- var setopts = false;
- if (options.seriesDefaults.renderer == $.jqplot.PieRenderer) {
- setopts = true;
- }
- else if (options.series) {
- for (var i=0; i < options.series.length; i++) {
- if (options.series[i].renderer == $.jqplot.PieRenderer) {
- setopts = true;
- }
- }
- }
-
- if (setopts) {
- options.axesDefaults.renderer = $.jqplot.PieAxisRenderer;
- options.legend.renderer = $.jqplot.PieLegendRenderer;
- options.legend.preDraw = true;
- options.seriesDefaults.pointLabels = {show: false};
- }
- }
-
- function postInit(target, data, options) {
- for (var i=0; i
- *
- * By default, the last value in the data ponit array in the data series is used
- * for the label. For most series renderers, extra data can be added to the
- * data point arrays and the last value will be used as the label.
- *
- * For instance,
- * this series:
- *
- * > [[1,4], [3,5], [7,2]]
- *
- * Would, by default, use the y values in the labels.
- * Extra data can be added to the series like so:
- *
- * > [[1,4,'mid'], [3 5,'hi'], [7,2,'low']]
- *
- * And now the point labels would be 'mid', 'low', and 'hi'.
- *
- * Options to the point labels and a custom labels array can be passed into the
- * "pointLabels" option on the series option like so:
- *
- * > series:[{pointLabels:{
- * > labels:['mid', 'hi', 'low'],
- * > location:'se',
- * > ypadding: 12
- * > }
- * > }]
- *
- * A custom labels array in the options takes precendence over any labels
- * in the series data. If you have a custom labels array in the options,
- * but still want to use values from the series array as labels, set the
- * "labelsFromSeries" option to true.
- *
- * By default, html entities (<, >, etc.) are escaped in point labels.
- * If you want to include actual html markup in the labels,
- * set the "escapeHTML" option to false.
- *
- */
- $.jqplot.PointLabels = function(options) {
- // Group: Properties
- //
- // prop: show
- // show the labels or not.
- this.show = $.jqplot.config.enablePlugins;
- // prop: location
- // compass location where to position the label around the point.
- // 'n', 'ne', 'e', 'se', 's', 'sw', 'w', 'nw'
- this.location = 'n';
- // prop: labelsFromSeries
- // true to use labels within data point arrays.
- this.labelsFromSeries = false;
- // prop: seriesLabelIndex
- // array index for location of labels within data point arrays.
- // if null, will use the last element of the data point array.
- this.seriesLabelIndex = null;
- // prop: labels
- // array of arrays of labels, one array for each series.
- this.labels = [];
- // actual labels that will get displayed.
- // needed to preserve user specified labels in labels array.
- this._labels = [];
- // prop: stackedValue
- // true to display value as stacked in a stacked plot.
- // no effect if labels is specified.
- this.stackedValue = false;
- // prop: ypadding
- // vertical padding in pixels between point and label
- this.ypadding = 6;
- // prop: xpadding
- // horizontal padding in pixels between point and label
- this.xpadding = 6;
- // prop: escapeHTML
- // true to escape html entities in the labels.
- // If you want to include markup in the labels, set to false.
- this.escapeHTML = true;
- // prop: edgeTolerance
- // Number of pixels that the label must be away from an axis
- // boundary in order to be drawn. Negative values will allow overlap
- // with the grid boundaries.
- this.edgeTolerance = -5;
- // prop: formatter
- // A class of a formatter for the tick text. sprintf by default.
- this.formatter = $.jqplot.DefaultTickFormatter;
- // prop: formatString
- // string passed to the formatter.
- this.formatString = '';
- // prop: hideZeros
- // true to not show a label for a value which is 0.
- this.hideZeros = false;
- this._elems = [];
-
- $.extend(true, this, options);
- };
-
- var locations = ['nw', 'n', 'ne', 'e', 'se', 's', 'sw', 'w'];
- var locationIndicies = {'nw':0, 'n':1, 'ne':2, 'e':3, 'se':4, 's':5, 'sw':6, 'w':7};
- var oppositeLocations = ['se', 's', 'sw', 'w', 'nw', 'n', 'ne', 'e'];
-
- // called with scope of a series
- $.jqplot.PointLabels.init = function (target, data, seriesDefaults, opts, plot){
- var options = $.extend(true, {}, seriesDefaults, opts);
- options.pointLabels = options.pointLabels || {};
- if (this.renderer.constructor === $.jqplot.BarRenderer && this.barDirection === 'horizontal' && !options.pointLabels.location) {
- options.pointLabels.location = 'e';
- }
- // add a pointLabels attribute to the series plugins
- this.plugins.pointLabels = new $.jqplot.PointLabels(options.pointLabels);
- this.plugins.pointLabels.setLabels.call(this);
- };
-
- // called with scope of series
- $.jqplot.PointLabels.prototype.setLabels = function() {
- var p = this.plugins.pointLabels;
- var labelIdx;
- if (p.seriesLabelIndex != null) {
- labelIdx = p.seriesLabelIndex;
- }
- else if (this.renderer.constructor === $.jqplot.BarRenderer && this.barDirection === 'horizontal') {
- labelIdx = 0;
- }
- else {
- labelIdx = (this._plotData.length === 0) ? 0 : this._plotData[0].length -1;
- }
- p._labels = [];
- if (p.labels.length === 0 || p.labelsFromSeries) {
- if (p.stackedValue) {
- if (this._plotData.length && this._plotData[0].length){
- // var idx = p.seriesLabelIndex || this._plotData[0].length -1;
- for (var i=0; i scr || elb + et > scb) {
- elem.remove();
- }
-
- elem = null;
- helem = null;
- }
-
- // finally, animate them if the series is animated
- // if (this.renderer.animation && this.renderer.animation._supported && this.renderer.animation.show && plot._drawCount < 2) {
- // var sel = '.jqplot-point-label.jqplot-series-'+this.index;
- // $(sel).hide();
- // $(sel).fadeIn(1000);
- // }
-
- }
- };
-
- $.jqplot.postSeriesInitHooks.push($.jqplot.PointLabels.init);
- $.jqplot.postDrawSeriesHooks.push($.jqplot.PointLabels.draw);
-})(jQuery);
\ No newline at end of file
diff --git a/libreplan-webapp/src/main/webapp/jqplot/plugins/jqplot.pointLabels.min.js b/libreplan-webapp/src/main/webapp/jqplot/plugins/jqplot.pointLabels.min.js
deleted file mode 100644
index 7cf02ea9f..000000000
--- a/libreplan-webapp/src/main/webapp/jqplot/plugins/jqplot.pointLabels.min.js
+++ /dev/null
@@ -1,57 +0,0 @@
-/**
- * jqPlot
- * Pure JavaScript plotting plugin using jQuery
- *
- * Version: 1.0.0b2_r1012
- *
- * Copyright (c) 2009-2011 Chris Leonello
- * jqPlot is currently available for use in all personal or commercial projects
- * under both the MIT (http://www.opensource.org/licenses/mit-license.php) and GPL
- * version 2.0 (http://www.gnu.org/licenses/gpl-2.0.html) licenses. This means that you can
- * choose the license that best suits your project and use it accordingly.
- *
- * Although not required, the author would appreciate an email letting him
- * know of any substantial use of jqPlot. You can reach the author at:
- * chris at jqplot dot com or see http://www.jqplot.com/info.php .
- *
- * If you are feeling kind and generous, consider supporting the project by
- * making a donation at: http://www.jqplot.com/donate.php .
- *
- * sprintf functions contained in jqplot.sprintf.js by Ash Searle:
- *
- * version 2007.04.27
- * author Ash Searle
- * http://hexmen.com/blog/2007/03/printf-sprintf/
- * http://hexmen.com/js/sprintf.js
- * The author (Ash Searle) has placed this code in the public domain:
- * "This code is unrestricted: you are free to use it however you like."
- *
- * included jsDate library by Chris Leonello:
- *
- * Copyright (c) 2010-2011 Chris Leonello
- *
- * jsDate is currently available for use in all personal or commercial projects
- * under both the MIT and GPL version 2.0 licenses. This means that you can
- * choose the license that best suits your project and use it accordingly.
- *
- * jsDate borrows many concepts and ideas from the Date Instance
- * Methods by Ken Snyder along with some parts of Ken's actual code.
- *
- * Ken's origianl Date Instance Methods and copyright notice:
- *
- * Ken Snyder (ken d snyder at gmail dot com)
- * 2008-09-10
- * version 2.0.2 (http://kendsnyder.com/sandbox/date/)
- * Creative Commons Attribution License 3.0 (http://creativecommons.org/licenses/by/3.0/)
- *
- * jqplotToImage function based on Larry Siden's export-jqplot-to-png.js.
- * Larry has generously given permission to adapt his code for inclusion
- * into jqPlot.
- *
- * Larry's original code can be found here:
- *
- * https://github.com/lsiden/export-jqplot-to-png
- *
- *
- */
-(function(c){c.jqplot.PointLabels=function(e){this.show=c.jqplot.config.enablePlugins;this.location="n";this.labelsFromSeries=false;this.seriesLabelIndex=null;this.labels=[];this._labels=[];this.stackedValue=false;this.ypadding=6;this.xpadding=6;this.escapeHTML=true;this.edgeTolerance=-5;this.formatter=c.jqplot.DefaultTickFormatter;this.formatString="";this.hideZeros=false;this._elems=[];c.extend(true,this,e)};var a=["nw","n","ne","e","se","s","sw","w"];var d={nw:0,n:1,ne:2,e:3,se:4,s:5,sw:6,w:7};var b=["se","s","sw","w","nw","n","ne","e"];c.jqplot.PointLabels.init=function(j,h,f,g,i){var e=c.extend(true,{},f,g);e.pointLabels=e.pointLabels||{};if(this.renderer.constructor===c.jqplot.BarRenderer&&this.barDirection==="horizontal"&&!e.pointLabels.location){e.pointLabels.location="e"}this.plugins.pointLabels=new c.jqplot.PointLabels(e.pointLabels);this.plugins.pointLabels.setLabels.call(this)};c.jqplot.PointLabels.prototype.setLabels=function(){var f=this.plugins.pointLabels;var h;if(f.seriesLabelIndex!=null){h=f.seriesLabelIndex}else{if(this.renderer.constructor===c.jqplot.BarRenderer&&this.barDirection==="horizontal"){h=0}else{h=(this._plotData.length===0)?0:this._plotData[0].length-1}}f._labels=[];if(f.labels.length===0||f.labelsFromSeries){if(f.stackedValue){if(this._plotData.length&&this._plotData[0].length){for(var e=0;eB||s+C>m){z.remove()}z=null;f=null}}};c.jqplot.postSeriesInitHooks.push(c.jqplot.PointLabels.init);c.jqplot.postDrawSeriesHooks.push(c.jqplot.PointLabels.draw)})(jQuery);
\ No newline at end of file
diff --git a/libreplan-webapp/src/main/webapp/jqplot/plugins/jqplot.pyramidAxisRenderer.js b/libreplan-webapp/src/main/webapp/jqplot/plugins/jqplot.pyramidAxisRenderer.js
deleted file mode 100644
index d4eb93bd7..000000000
--- a/libreplan-webapp/src/main/webapp/jqplot/plugins/jqplot.pyramidAxisRenderer.js
+++ /dev/null
@@ -1,730 +0,0 @@
-/**
- * jqPlot
- * Pure JavaScript plotting plugin using jQuery
- *
- * Version: 1.0.0b2_r1012
- *
- * Copyright (c) 2009-2011 Chris Leonello
- * jqPlot is currently available for use in all personal or commercial projects
- * under both the MIT (http://www.opensource.org/licenses/mit-license.php) and GPL
- * version 2.0 (http://www.gnu.org/licenses/gpl-2.0.html) licenses. This means that you can
- * choose the license that best suits your project and use it accordingly.
- *
- * Although not required, the author would appreciate an email letting him
- * know of any substantial use of jqPlot. You can reach the author at:
- * chris at jqplot dot com or see http://www.jqplot.com/info.php .
- *
- * If you are feeling kind and generous, consider supporting the project by
- * making a donation at: http://www.jqplot.com/donate.php .
- *
- * sprintf functions contained in jqplot.sprintf.js by Ash Searle:
- *
- * version 2007.04.27
- * author Ash Searle
- * http://hexmen.com/blog/2007/03/printf-sprintf/
- * http://hexmen.com/js/sprintf.js
- * The author (Ash Searle) has placed this code in the public domain:
- * "This code is unrestricted: you are free to use it however you like."
- *
- */
-(function($) {
- $.jqplot.PyramidAxisRenderer = function() {
- $.jqplot.LinearAxisRenderer.call(this);
- };
-
- $.jqplot.PyramidAxisRenderer.prototype = new $.jqplot.LinearAxisRenderer();
- $.jqplot.PyramidAxisRenderer.prototype.constructor = $.jqplot.PyramidAxisRenderer;
-
- // called with scope of axis
- $.jqplot.PyramidAxisRenderer.prototype.init = function(options){
- // Group: Properties
- //
- // prop: position
- // Position of axis. Values are: top, bottom , left, center, right.
- // By default, x and x2 axes are bottom, y axis is center.
- this.position = null;
- // prop: drawBaseline
- // True to draw the axis baseline.
- this.drawBaseline = true;
- // prop: baselineWidth
- // width of the baseline in pixels.
- this.baselineWidth = null;
- // prop: baselineColor
- // CSS color spec for the baseline.
- this.baselineColor = null;
- this.tickSpacingFactor = 25;
- this._type = 'pyramid';
- this._splitAxis = false;
- this._splitLength = null;
- this.category = false;
- this._autoFormatString = '';
- this._overrideFormatString = false;
-
- $.extend(true, this, options);
- this.renderer.options = options;
-
- this.resetDataBounds = this.renderer.resetDataBounds;
- this.resetDataBounds();
-
- };
-
- $.jqplot.PyramidAxisRenderer.prototype.resetDataBounds = function() {
- // Go through all the series attached to this axis and find
- // the min/max bounds for this axis.
- var db = this._dataBounds;
- db.min = null;
- db.max = null;
- var temp;
- for (var i=0; i db.max) || db.max === null) {
- db.max = temp;
- }
- }
- else {
- temp = d[j][0];
- if ((temp !== null && temp < db.min) || db.min === null) {
- db.min = temp;
- }
- if ((temp !== null && temp > db.max) || db.max === null) {
- db.max = temp;
- }
- }
- }
- }
- };
-
- // called with scope of axis
- $.jqplot.PyramidAxisRenderer.prototype.draw = function(ctx, plot) {
- if (this.show) {
- // populate the axis label and value properties.
- // createTicks is a method on the renderer, but
- // call it within the scope of the axis.
- this.renderer.createTicks.call(this, plot);
- // fill a div with axes labels in the right direction.
- // Need to pregenerate each axis to get it's bounds and
- // position it and the labels correctly on the plot.
- var dim=0;
- var temp;
- // Added for theming.
- if (this._elem) {
- // Memory Leaks patch
- //this._elem.empty();
- this._elem.emptyForce();
- this._elem = null;
- }
-
- this._elem = $(document.createElement('div'));
- this._elem.addClass('jqplot-axis jqplot-'+this.name);
- this._elem.css('position', 'absolute');
-
-
- if (this.name == 'xaxis' || this.name == 'x2axis') {
- this._elem.width(this._plotDimensions.width);
- }
- else {
- this._elem.height(this._plotDimensions.height);
- }
-
- // create a _label object.
- this.labelOptions.axis = this.name;
- this._label = new this.labelRenderer(this.labelOptions);
- if (this._label.show) {
- var elem = this._label.draw(ctx, plot);
- elem.appendTo(this._elem);
- elem = null;
- }
-
- var t = this._ticks;
- var tick;
- for (var i=0; i maxVisibleTicks) {
- // check for number of ticks we can skip
- temp = this.numberTicks - 1;
- for (i=2; i0; i--) {
- t = new this.tickRenderer(this.tickOptions);
- t.value = this._ticks[i-1].value + this.tickInterval/2.0;
- t.label = '';
- t.showLabel = false;
- t.axis = this.name;
- this._ticks[i].showGridline = false;
- this._ticks[i].showMark = false;
- this._ticks.splice(i, 0, t);
- // temp.push(t);
- }
-
- // merge in the new ticks
- // for (i=1, l=temp.length; i tumax) {
- tumin = min - range*(this.padMin - 1);
- tumax = max + range*(this.padMax - 1);
- ret = $.jqplot.LinearTickGenerator(tumin, tumax, scalefact);
- console.log(tumin, tumax, scalefact, ret);
- }
-
- this.min = ret[0];
- this.max = ret[1];
- this.numberTicks = ret[2];
- this._autoFormatString = ret[3];
- this.tickInterval = ret[4];
- }
- else {
- dim = this._plotDimensions.height;
-
- // ticks will be on whole integers like 1, 2, 3, ... or 1, 4, 7, ...
- min = db.min;
- max = db.max;
- s = this._series[0];
- this._ticks = [];
-
- range = max - min;
-
- // if range is a prime, will get only 2 ticks, expand range in that case.
- if (_primesHash[range]) {
- range += 1;
- max += 1;
- }
-
- this.max = max;
- this.min = min;
-
- maxVisibleTicks = Math.round(2.0 + dim/this.tickSpacingFactor);
-
- if (range + 1 <= maxVisibleTicks) {
- this.numberTicks = range + 1;
- this.tickInterval = 1.0;
- }
-
- else {
- // figure out a round number of ticks to skip in every interval
- // range / ti + 1 = nt
- // ti = range / (nt - 1)
- for (var i=maxVisibleTicks; i>1; i--) {
- if (range/(i - 1) === Math.round(range/(i - 1))) {
- this.numberTicks = i;
- this.tickInterval = range/(i - 1);
- break;
- }
-
- }
- }
- }
-
- if (this._overrideFormatString && this._autoFormatString != '') {
- this.tickOptions = this.tickOptions || {};
- this.tickOptions.formatString = this._autoFormatString;
- }
-
- var labelval;
- for (i=0; i dim) {
- dim = temp;
- }
- }
- }
-
- if (this.name === 'yMidAxis') {
- for (i=0; i w) ? dim : w;
- var temp = dim/2.0 - w/2.0;
- this._elem.css({'width':dim+'px', top:'0px'});
- if (lshow && this._label.constructor == $.jqplot.AxisLabelRenderer) {
- this._label._elem.css({width: w, left: temp, top: 0});
- }
- }
- else {
- dim = dim + w;
- this._elem.css({'width':dim+'px', right:'0px', top:'0px'});
- if (lshow && this._label.constructor == $.jqplot.AxisLabelRenderer) {
- this._label._elem.css('width', w+'px');
- }
- }
- }
- };
-
- $.jqplot.PyramidAxisRenderer.prototype.pack = function(pos, offsets) {
- // Add defaults for repacking from resetTickValues function.
- pos = pos || {};
- offsets = offsets || this._offsets;
-
- var ticks = this._ticks;
- var max = this.max;
- var min = this.min;
- var offmax = offsets.max;
- var offmin = offsets.min;
- var lshow = (this._label == null) ? false : this._label.show;
-
- for (var p in pos) {
- this._elem.css(p, pos[p]);
- }
-
- this._offsets = offsets;
- // pixellength will be + for x axes and - for y axes becasue pixels always measured from top left.
- var pixellength = offmax - offmin;
- var unitlength = max - min;
- var sl = this._splitLength;
-
- // point to unit and unit to point conversions references to Plot DOM element top left corner.
- if (this._splitAxis) {
- pixellength -= this._splitLength;
-
- // don't know that this one is correct.
- this.p2u = function(p){
- return (p - offmin) * unitlength / pixellength + min;
- };
-
- this.u2p = function(u){
- if (u <= 0) {
- return (u - min) * pixellength / unitlength + offmin;
- }
- else {
- return (u - min) * pixellength / unitlength + offmin + sl;
- }
- };
-
- this.series_u2p = function(u){
- if (u <= 0) {
- return (u - min) * pixellength / unitlength;
- }
- else {
- return (u - min) * pixellength / unitlength + sl;
- }
- };
-
- // don't know that this one is correct.
- this.series_p2u = function(p){
- return p * unitlength / pixellength + min;
- };
- }
- else {
- this.p2u = function(p){
- return (p - offmin) * unitlength / pixellength + min;
- };
-
- this.u2p = function(u){
- return (u - min) * pixellength / unitlength + offmin;
- };
-
- if (this.name.charAt(0) === 'x'){
- this.series_u2p = function(u){
- return (u - min) * pixellength / unitlength;
- };
- this.series_p2u = function(p){
- return p * unitlength / pixellength + min;
- };
- }
-
- else {
- this.series_u2p = function(u){
- return (u - max) * pixellength / unitlength;
- };
- this.series_p2u = function(p){
- return p * unitlength / pixellength + max;
- };
- }
- }
-
- if (this.show) {
- if (this.name.charAt(0) === 'x') {
- for (var i=0; i 0) {
- shim = -t._textRenderer.height * Math.cos(-t._textRenderer.angle) / 2;
- }
- else {
- shim = -t.getHeight() + t._textRenderer.height * Math.cos(t._textRenderer.angle) / 2;
- }
- break;
- case 'middle':
- // if (t.angle > 0) {
- // shim = -t.getHeight()/2 + t._textRenderer.height * Math.sin(-t._textRenderer.angle) / 2;
- // }
- // else {
- // shim = -t.getHeight()/2 - t._textRenderer.height * Math.sin(t._textRenderer.angle) / 2;
- // }
- shim = -t.getHeight()/2;
- break;
- default:
- shim = -t.getHeight()/2;
- break;
- }
- }
- else {
- shim = -t.getHeight()/2;
- }
-
- var val = this.u2p(t.value) + shim + 'px';
- t._elem.css('top', val);
- t.pack();
- }
- }
- if (lshow) {
- var h = this._label._elem.outerHeight(true);
- if (this.name !== 'yMidAxis') {
- this._label._elem.css('top', offmax - pixellength/2 - h/2 + 'px');
- }
- if (this.name == 'yaxis') {
- this._label._elem.css('left', '0px');
- }
- else if (this.name !== 'yMidAxis') {
- this._label._elem.css('right', '0px');
- }
- this._label.pack();
- }
- }
- }
-
- ticks = null;
- };
-})(jQuery);
\ No newline at end of file
diff --git a/libreplan-webapp/src/main/webapp/jqplot/plugins/jqplot.pyramidAxisRenderer.min.js b/libreplan-webapp/src/main/webapp/jqplot/plugins/jqplot.pyramidAxisRenderer.min.js
deleted file mode 100644
index c71dee2b5..000000000
--- a/libreplan-webapp/src/main/webapp/jqplot/plugins/jqplot.pyramidAxisRenderer.min.js
+++ /dev/null
@@ -1,57 +0,0 @@
-/**
- * jqPlot
- * Pure JavaScript plotting plugin using jQuery
- *
- * Version: 1.0.0b2_r1012
- *
- * Copyright (c) 2009-2011 Chris Leonello
- * jqPlot is currently available for use in all personal or commercial projects
- * under both the MIT (http://www.opensource.org/licenses/mit-license.php) and GPL
- * version 2.0 (http://www.gnu.org/licenses/gpl-2.0.html) licenses. This means that you can
- * choose the license that best suits your project and use it accordingly.
- *
- * Although not required, the author would appreciate an email letting him
- * know of any substantial use of jqPlot. You can reach the author at:
- * chris at jqplot dot com or see http://www.jqplot.com/info.php .
- *
- * If you are feeling kind and generous, consider supporting the project by
- * making a donation at: http://www.jqplot.com/donate.php .
- *
- * sprintf functions contained in jqplot.sprintf.js by Ash Searle:
- *
- * version 2007.04.27
- * author Ash Searle
- * http://hexmen.com/blog/2007/03/printf-sprintf/
- * http://hexmen.com/js/sprintf.js
- * The author (Ash Searle) has placed this code in the public domain:
- * "This code is unrestricted: you are free to use it however you like."
- *
- * included jsDate library by Chris Leonello:
- *
- * Copyright (c) 2010-2011 Chris Leonello
- *
- * jsDate is currently available for use in all personal or commercial projects
- * under both the MIT and GPL version 2.0 licenses. This means that you can
- * choose the license that best suits your project and use it accordingly.
- *
- * jsDate borrows many concepts and ideas from the Date Instance
- * Methods by Ken Snyder along with some parts of Ken's actual code.
- *
- * Ken's origianl Date Instance Methods and copyright notice:
- *
- * Ken Snyder (ken d snyder at gmail dot com)
- * 2008-09-10
- * version 2.0.2 (http://kendsnyder.com/sandbox/date/)
- * Creative Commons Attribution License 3.0 (http://creativecommons.org/licenses/by/3.0/)
- *
- * jqplotToImage function based on Larry Siden's export-jqplot-to-png.js.
- * Larry has generously given permission to adapt his code for inclusion
- * into jqPlot.
- *
- * Larry's original code can be found here:
- *
- * https://github.com/lsiden/export-jqplot-to-png
- *
- *
- */
-(function(e){e.jqplot.PyramidAxisRenderer=function(){e.jqplot.LinearAxisRenderer.call(this)};e.jqplot.PyramidAxisRenderer.prototype=new e.jqplot.LinearAxisRenderer();e.jqplot.PyramidAxisRenderer.prototype.constructor=e.jqplot.PyramidAxisRenderer;e.jqplot.PyramidAxisRenderer.prototype.init=function(f){this.position=null;this.drawBaseline=true;this.baselineWidth=null;this.baselineColor=null;this.tickSpacingFactor=25;this._type="pyramid";this._splitAxis=false;this._splitLength=null;this.category=false;this._autoFormatString="";this._overrideFormatString=false;e.extend(true,this,f);this.renderer.options=f;this.resetDataBounds=this.renderer.resetDataBounds;this.resetDataBounds()};e.jqplot.PyramidAxisRenderer.prototype.resetDataBounds=function(){var h=this._dataBounds;h.min=null;h.max=null;var g;for(var m=0;mh.max)||h.max===null){h.max=g}}else{g=o[k][0];if((g!==null&&gh.max)||h.max===null){h.max=g}}}}};e.jqplot.PyramidAxisRenderer.prototype.draw=function(f,n){if(this.show){this.renderer.createTicks.call(this,n);var m=0;var g;if(this._elem){this._elem.emptyForce();this._elem=null}this._elem=e(document.createElement("div"));this._elem.addClass("jqplot-axis jqplot-"+this.name);this._elem.css("position","absolute");if(this.name=="xaxis"||this.name=="x2axis"){this._elem.width(this._plotDimensions.width)}else{this._elem.height(this._plotDimensions.height)}this.labelOptions.axis=this.name;this._label=new this.labelRenderer(this.labelOptions);if(this._label.show){var l=this._label.draw(f,n);l.appendTo(this._elem);l=null}var k=this._ticks;var j;for(var h=0;hr){I=this.numberTicks-1;for(H=2;H0;H--){v=new this.tickRenderer(this.tickOptions);v.value=this._ticks[H-1].value+this.tickInterval/2;v.label="";v.showLabel=false;v.axis=this.name;this._ticks[H].showGridline=false;this._ticks[H].showMark=false;this._ticks.splice(H,0,v)}v=new this.tickRenderer(this.tickOptions);v.value=this._ticks[0].value-this.tickInterval/2;v.label="";v.showLabel=false;v.axis=this.name;this._ticks.unshift(v);v=new this.tickRenderer(this.tickOptions);v.value=this._ticks[this._ticks.length-1].value+this.tickInterval/2;v.label="";v.showLabel=false;v.axis=this.name;this._ticks.push(v);this.tickInterval=this.tickInterval/2;this.numberTicks=this._ticks.length;this.min=this._ticks[0].value;this.max=this._ticks[this._ticks.length-1].value}}else{if(this.name.charAt(0)==="x"){E=this._plotDimensions.width;var w=Math.max(M.max,Math.abs(M.min));var u=Math.min(M.min,-w);B=u;G=w;y=G-B;if(this.tickOptions==null||!this.tickOptions.formatString){this._overrideFormatString=true}m=30;g=Math.max(E,m+1);j=(g-m)/300;O=e.jqplot.LinearTickGenerator(B,G,j);console.log(B,G,j,O);console.log(O[0].toString(),O[1].toString());A=B+y*(this.padMin-1);F=G-y*(this.padMax-1);if(BF){A=B-y*(this.padMin-1);F=G+y*(this.padMax-1);O=e.jqplot.LinearTickGenerator(A,F,j);console.log(A,F,j,O)}this.min=O[0];this.max=O[1];this.numberTicks=O[2];this._autoFormatString=O[3];this.tickInterval=O[4]}else{E=this._plotDimensions.height;B=M.min;G=M.max;x=this._series[0];this._ticks=[];y=G-B;if(d[y]){y+=1;G+=1}this.max=G;this.min=B;r=Math.round(2+E/this.tickSpacingFactor);if(y+1<=r){this.numberTicks=y+1;this.tickInterval=1}else{for(var H=r;H>1;H--){if(y/(H-1)===Math.round(y/(H-1))){this.numberTicks=H;this.tickInterval=y/(H-1);break}}}}if(this._overrideFormatString&&this._autoFormatString!=""){this.tickOptions=this.tickOptions||{};this.tickOptions.formatString=this._autoFormatString}var f;for(H=0;Ho){o=j}}}if(this.name==="yMidAxis"){for(m=0;m0){f=-q._textRenderer.height*Math.cos(-q._textRenderer.angle)/2}else{f=-q.getHeight()+q._textRenderer.height*Math.cos(q._textRenderer.angle)/2}break;case"middle":f=-q.getHeight()/2;break;default:f=-q.getHeight()/2;break}}else{f=-q.getHeight()/2}var C=this.u2p(q.value)+f+"px";q._elem.css("top",C);q.pack()}}if(r){var y=this._label._elem.outerHeight(true);if(this.name!=="yMidAxis"){this._label._elem.css("top",o-k/2-y/2+"px")}if(this.name=="yaxis"){this._label._elem.css("left","0px")}else{if(this.name!=="yMidAxis"){this._label._elem.css("right","0px")}}this._label.pack()}}}B=null}})(jQuery);
\ No newline at end of file
diff --git a/libreplan-webapp/src/main/webapp/jqplot/plugins/jqplot.pyramidGridRenderer.js b/libreplan-webapp/src/main/webapp/jqplot/plugins/jqplot.pyramidGridRenderer.js
deleted file mode 100644
index ce44ede60..000000000
--- a/libreplan-webapp/src/main/webapp/jqplot/plugins/jqplot.pyramidGridRenderer.js
+++ /dev/null
@@ -1,423 +0,0 @@
-/**
- * jqPlot
- * Pure JavaScript plotting plugin using jQuery
- *
- * Version: 1.0.0b2_r1012
- *
- * Copyright (c) 2009-2011 Chris Leonello
- * jqPlot is currently available for use in all personal or commercial projects
- * under both the MIT (http://www.opensource.org/licenses/mit-license.php) and GPL
- * version 2.0 (http://www.gnu.org/licenses/gpl-2.0.html) licenses. This means that you can
- * choose the license that best suits your project and use it accordingly.
- *
- * Although not required, the author would appreciate an email letting him
- * know of any substantial use of jqPlot. You can reach the author at:
- * chris at jqplot dot com or see http://www.jqplot.com/info.php .
- *
- * If you are feeling kind and generous, consider supporting the project by
- * making a donation at: http://www.jqplot.com/donate.php .
- *
- * sprintf functions contained in jqplot.sprintf.js by Ash Searle:
- *
- * version 2007.04.27
- * author Ash Searle
- * http://hexmen.com/blog/2007/03/printf-sprintf/
- * http://hexmen.com/js/sprintf.js
- * The author (Ash Searle) has placed this code in the public domain:
- * "This code is unrestricted: you are free to use it however you like."
- *
- */
-(function($) {
- // Class: $.jqplot.CanvasGridRenderer
- // The default jqPlot grid renderer, creating a grid on a canvas element.
- // The renderer has no additional options beyond the class.
- $.jqplot.PyramidGridRenderer = function(){
- $.jqplot.CanvasGridRenderer.call(this);
- };
-
- $.jqplot.PyramidGridRenderer.prototype = new $.jqplot.CanvasGridRenderer();
- $.jqplot.PyramidGridRenderer.prototype.constructor = $.jqplot.PyramidGridRenderer;
-
- // called with context of Grid object
- $.jqplot.CanvasGridRenderer.prototype.init = function(options) {
- this._ctx;
- this.plotBands = {
- show: false,
- color: 'rgb(230, 219, 179)',
- axis: 'y',
- start: null,
- interval: 10
- };
- $.extend(true, this, options);
- // set the shadow renderer options
- var sopts = {lineJoin:'miter', lineCap:'round', fill:false, isarc:false, angle:this.shadowAngle, offset:this.shadowOffset, alpha:this.shadowAlpha, depth:this.shadowDepth, lineWidth:this.shadowWidth, closePath:false, strokeStyle:this.shadowColor};
- this.renderer.shadowRenderer.init(sopts);
- };
-
- $.jqplot.PyramidGridRenderer.prototype.draw = function() {
- this._ctx = this._elem.get(0).getContext("2d");
- var ctx = this._ctx;
- var axes = this._axes;
- var xp = axes.xaxis.u2p;
- var yp = axes.yMidAxis.u2p;
- var xnudge = axes.xaxis.max/1000.0;
- var xp0 = xp(0);
- var xpn = xp(xnudge);
- var ax = ['xaxis', 'yaxis', 'x2axis', 'y2axis','yMidAxis'];
- // Add the grid onto the grid canvas. This is the bottom most layer.
- ctx.save();
- ctx.clearRect(0, 0, this._plotDimensions.width, this._plotDimensions.height);
- ctx.fillStyle = this.backgroundColor || this.background;
-
- ctx.fillRect(this._left, this._top, this._width, this._height);
-
- if (this.plotBands.show) {
- ctx.save();
- var pb = this.plotBands;
- ctx.fillStyle = pb.color;
- var axis;
- var x, y, w, h;
- // find axis to work with
- if (pb.axis.charAt(0) === 'x') {
- if (axes.xaxis.show) {
- axis = axes.xaxis;
- }
- }
- else if (pb.axis.charAt(0) === 'y') {
- if (axes.yaxis.show) {
- axis = axes.yaxis;
- }
- else if (axes.y2axis.show) {
- axis = axes.y2axis;
- }
- else if (axes.yMidAxis.show) {
- axis = axes.yMidAxis;
- }
- }
-
- if (axis !== undefined) {
- // draw some rectangles
- var start = pb.start;
- if (start === null) {
- start = axis.min;
- }
- for (var i = start; i < axis.max; i += 2 * pb.interval) {
- if (axis.name.charAt(0) === 'y') {
- x = this._left;
- y = axis.series_u2p(i + pb.interval) + this._top;
- w = this._right - this._left;
- h = axis.series_u2p(start) - axis.series_u2p(start + pb.interval);
- ctx.fillRect(x, y, w, h);
- }
- // else {
- // y = 0;
- // x = axis.series_u2p(i);
- // h = this._height;
- // w = axis.series_u2p(start + pb.interval) - axis.series_u2p(start);
- // }
-
- }
- }
- ctx.restore();
- }
-
- ctx.save();
- ctx.lineJoin = 'miter';
- ctx.lineCap = 'butt';
- ctx.lineWidth = this.gridLineWidth;
- ctx.strokeStyle = this.gridLineColor;
- var b, e, s, m;
- for (var i=5; i>0; i--) {
- var name = ax[i-1];
- var axis = axes[name];
- var ticks = axis._ticks;
- var numticks = ticks.length;
- if (axis.show) {
- if (axis.drawBaseline) {
- var bopts = {};
- if (axis.baselineWidth !== null) {
- bopts.lineWidth = axis.baselineWidth;
- }
- if (axis.baselineColor !== null) {
- bopts.strokeStyle = axis.baselineColor;
- }
- switch (name) {
- case 'xaxis':
- if (axes.yMidAxis.show) {
- drawLine (this._left, this._bottom, xp0, this._bottom, bopts);
- drawLine (xpn, this._bottom, this._right, this._bottom, bopts);
- }
- else {
- drawLine (this._left, this._bottom, this._right, this._bottom, bopts);
- }
- break;
- case 'yaxis':
- drawLine (this._left, this._bottom, this._left, this._top, bopts);
- break;
- case 'yMidAxis':
- drawLine(xp0, this._bottom, xp0, this._top, bopts);
- drawLine(xpn, this._bottom, xpn, this._top, bopts);
- break;
- case 'x2axis':
- if (axes.yMidAxis.show) {
- drawLine (this._left, this._top, xp0, this._top, bopts);
- drawLine (xpn, this._top, this._right, this._top, bopts);
- }
- else {
- drawLine (this._left, this._bottom, this._right, this._bottom, bopts);
- }
- break;
- case 'y2axis':
- drawLine (this._right, this._bottom, this._right, this._top, bopts);
- break;
-
- }
- }
- for (var j=numticks; j>0; j--) {
- var t = ticks[j-1];
- if (t.show) {
- var pos = Math.round(axis.u2p(t.value)) + 0.5;
- switch (name) {
- case 'xaxis':
- // draw the grid line if we should
- if (t.showGridline && this.drawGridlines && (!t.isMinorTick || axis.showMinorTicks)) {
- drawLine(pos, this._top, pos, this._bottom);
- }
-
- // draw the mark
- if (t.showMark && t.mark && (!t.isMinorTick || axis.showMinorTicks)) {
- s = t.markSize;
- m = t.mark;
- var pos = Math.round(axis.u2p(t.value)) + 0.5;
- switch (m) {
- case 'outside':
- b = this._bottom;
- e = this._bottom+s;
- break;
- case 'inside':
- b = this._bottom-s;
- e = this._bottom;
- break;
- case 'cross':
- b = this._bottom-s;
- e = this._bottom+s;
- break;
- default:
- b = this._bottom;
- e = this._bottom+s;
- break;
- }
- // draw the shadow
- if (this.shadow) {
- this.renderer.shadowRenderer.draw(ctx, [[pos,b],[pos,e]], {lineCap:'butt', lineWidth:this.gridLineWidth, offset:this.gridLineWidth*0.75, depth:2, fill:false, closePath:false});
- }
- // draw the line
- drawLine(pos, b, pos, e);
- }
- break;
- case 'yaxis':
- // draw the grid line
- if (t.showGridline && this.drawGridlines && (!t.isMinorTick || axis.showMinorTicks)) {
- drawLine(this._right, pos, this._left, pos);
- }
-
- // draw the mark
- if (t.showMark && t.mark && (!t.isMinorTick || axis.showMinorTicks)) {
- s = t.markSize;
- m = t.mark;
- var pos = Math.round(axis.u2p(t.value)) + 0.5;
- switch (m) {
- case 'outside':
- b = this._left-s;
- e = this._left;
- break;
- case 'inside':
- b = this._left;
- e = this._left+s;
- break;
- case 'cross':
- b = this._left-s;
- e = this._left+s;
- break;
- default:
- b = this._left-s;
- e = this._left;
- break;
- }
- // draw the shadow
- if (this.shadow) {
- this.renderer.shadowRenderer.draw(ctx, [[b, pos], [e, pos]], {lineCap:'butt', lineWidth:this.gridLineWidth*1.5, offset:this.gridLineWidth*0.75, fill:false, closePath:false});
- }
- drawLine(b, pos, e, pos, {strokeStyle:axis.borderColor});
- }
- break;
- case 'yMidAxis':
- // draw the grid line
- if (t.showGridline && this.drawGridlines && (!t.isMinorTick || axis.showMinorTicks)) {
- drawLine(this._left, pos, xp0, pos);
- drawLine(xpn, pos, this._right, pos);
- }
- // draw the mark
- if (t.showMark && t.mark && (!t.isMinorTick || axis.showMinorTicks)) {
- s = t.markSize;
- m = t.mark;
- var pos = Math.round(axis.u2p(t.value)) + 0.5;
-
- b = xp0;
- e = xp0 + s;
- // draw the shadow
- if (this.shadow) {
- this.renderer.shadowRenderer.draw(ctx, [[b, pos], [e, pos]], {lineCap:'butt', lineWidth:this.gridLineWidth*1.5, offset:this.gridLineWidth*0.75, fill:false, closePath:false});
- }
- drawLine(b, pos, e, pos, {strokeStyle:axis.borderColor});
-
- b = xpn - s;
- e = xpn;
- // draw the shadow
- if (this.shadow) {
- this.renderer.shadowRenderer.draw(ctx, [[b, pos], [e, pos]], {lineCap:'butt', lineWidth:this.gridLineWidth*1.5, offset:this.gridLineWidth*0.75, fill:false, closePath:false});
- }
- drawLine(b, pos, e, pos, {strokeStyle:axis.borderColor});
- }
- break;
- case 'x2axis':
- // draw the grid line
- if (t.showGridline && this.drawGridlines && (!t.isMinorTick || axis.showMinorTicks)) {
- drawLine(pos, this._bottom, pos, this._top);
- }
-
- // draw the mark
- if (t.showMark && t.mark && (!t.isMinorTick || axis.showMinorTicks)) {
- s = t.markSize;
- m = t.mark;
- var pos = Math.round(axis.u2p(t.value)) + 0.5;
- switch (m) {
- case 'outside':
- b = this._top-s;
- e = this._top;
- break;
- case 'inside':
- b = this._top;
- e = this._top+s;
- break;
- case 'cross':
- b = this._top-s;
- e = this._top+s;
- break;
- default:
- b = this._top-s;
- e = this._top;
- break;
- }
- // draw the shadow
- if (this.shadow) {
- this.renderer.shadowRenderer.draw(ctx, [[pos,b],[pos,e]], {lineCap:'butt', lineWidth:this.gridLineWidth, offset:this.gridLineWidth*0.75, depth:2, fill:false, closePath:false});
- }
- drawLine(pos, b, pos, e);
- }
- break;
- case 'y2axis':
- // draw the grid line
- if (t.showGridline && this.drawGridlines && (!t.isMinorTick || axis.showMinorTicks)) {
- drawLine(this._left, pos, this._right, pos);
- }
-
- // draw the mark
- if (t.showMark && t.mark && (!t.isMinorTick || axis.showMinorTicks)) {
- s = t.markSize;
- m = t.mark;
- var pos = Math.round(axis.u2p(t.value)) + 0.5;
- switch (m) {
- case 'outside':
- b = this._right;
- e = this._right+s;
- break;
- case 'inside':
- b = this._right-s;
- e = this._right;
- break;
- case 'cross':
- b = this._right-s;
- e = this._right+s;
- break;
- default:
- b = this._right;
- e = this._right+s;
- break;
- }
- // draw the shadow
- if (this.shadow) {
- this.renderer.shadowRenderer.draw(ctx, [[b, pos], [e, pos]], {lineCap:'butt', lineWidth:this.gridLineWidth*1.5, offset:this.gridLineWidth*0.75, fill:false, closePath:false});
- }
- drawLine(b, pos, e, pos, {strokeStyle:axis.borderColor});
- }
- break;
- default:
- break;
- }
- }
- }
- t = null;
- }
- axis = null;
- ticks = null;
- }
-
- ctx.restore();
-
- function drawLine(bx, by, ex, ey, opts) {
- ctx.save();
- opts = opts || {};
- if (opts.lineWidth == null || opts.lineWidth != 0){
- $.extend(true, ctx, opts);
- ctx.beginPath();
- ctx.moveTo(bx, by);
- ctx.lineTo(ex, ey);
- ctx.stroke();
- }
- ctx.restore();
- }
-
- if (this.shadow) {
- if (axes.yMidAxis.show) {
- var points = [[this._left, this._bottom], [xp0, this._bottom]];
- this.renderer.shadowRenderer.draw(ctx, points);
- var points = [[xpn, this._bottom], [this._right, this._bottom], [this._right, this._top]];
- this.renderer.shadowRenderer.draw(ctx, points);
- var points = [[xp0, this._bottom], [xp0, this._top]];
- this.renderer.shadowRenderer.draw(ctx, points);
- }
- else {
- var points = [[this._left, this._bottom], [this._right, this._bottom], [this._right, this._top]];
- this.renderer.shadowRenderer.draw(ctx, points);
- }
- }
- // Now draw border around grid. Use axis border definitions. start at
- // upper left and go clockwise.
- if (this.borderWidth != 0 && this.drawBorder) {
- if (axes.yMidAxis.show) {
- drawLine (this._left, this._top, xp0, this._top, {lineCap:'round', strokeStyle:axes.x2axis.borderColor, lineWidth:axes.x2axis.borderWidth});
- drawLine (xpn, this._top, this._right, this._top, {lineCap:'round', strokeStyle:axes.x2axis.borderColor, lineWidth:axes.x2axis.borderWidth});
- drawLine (this._right, this._top, this._right, this._bottom, {lineCap:'round', strokeStyle:axes.y2axis.borderColor, lineWidth:axes.y2axis.borderWidth});
- drawLine (this._right, this._bottom, xpn, this._bottom, {lineCap:'round', strokeStyle:axes.xaxis.borderColor, lineWidth:axes.xaxis.borderWidth});
- drawLine (xp0, this._bottom, this._left, this._bottom, {lineCap:'round', strokeStyle:axes.xaxis.borderColor, lineWidth:axes.xaxis.borderWidth});
- drawLine (this._left, this._bottom, this._left, this._top, {lineCap:'round', strokeStyle:axes.yaxis.borderColor, lineWidth:axes.yaxis.borderWidth});
- drawLine (xp0, this._bottom, xp0, this._top, {lineCap:'round', strokeStyle:axes.yaxis.borderColor, lineWidth:axes.yaxis.borderWidth});
- drawLine (xpn, this._bottom, xpn, this._top, {lineCap:'round', strokeStyle:axes.yaxis.borderColor, lineWidth:axes.yaxis.borderWidth});
- }
- else {
- drawLine (this._left, this._top, this._right, this._top, {lineCap:'round', strokeStyle:axes.x2axis.borderColor, lineWidth:axes.x2axis.borderWidth});
- drawLine (this._right, this._top, this._right, this._bottom, {lineCap:'round', strokeStyle:axes.y2axis.borderColor, lineWidth:axes.y2axis.borderWidth});
- drawLine (this._right, this._bottom, this._left, this._bottom, {lineCap:'round', strokeStyle:axes.xaxis.borderColor, lineWidth:axes.xaxis.borderWidth});
- drawLine (this._left, this._bottom, this._left, this._top, {lineCap:'round', strokeStyle:axes.yaxis.borderColor, lineWidth:axes.yaxis.borderWidth});
- }
- }
- // ctx.lineWidth = this.borderWidth;
- // ctx.strokeStyle = this.borderColor;
- // ctx.strokeRect(this._left, this._top, this._width, this._height);
-
- ctx.restore();
- ctx = null;
- axes = null;
- };
-})(jQuery);
\ No newline at end of file
diff --git a/libreplan-webapp/src/main/webapp/jqplot/plugins/jqplot.pyramidGridRenderer.min.js b/libreplan-webapp/src/main/webapp/jqplot/plugins/jqplot.pyramidGridRenderer.min.js
deleted file mode 100644
index 26d8276b6..000000000
--- a/libreplan-webapp/src/main/webapp/jqplot/plugins/jqplot.pyramidGridRenderer.min.js
+++ /dev/null
@@ -1,57 +0,0 @@
-/**
- * jqPlot
- * Pure JavaScript plotting plugin using jQuery
- *
- * Version: 1.0.0b2_r1012
- *
- * Copyright (c) 2009-2011 Chris Leonello
- * jqPlot is currently available for use in all personal or commercial projects
- * under both the MIT (http://www.opensource.org/licenses/mit-license.php) and GPL
- * version 2.0 (http://www.gnu.org/licenses/gpl-2.0.html) licenses. This means that you can
- * choose the license that best suits your project and use it accordingly.
- *
- * Although not required, the author would appreciate an email letting him
- * know of any substantial use of jqPlot. You can reach the author at:
- * chris at jqplot dot com or see http://www.jqplot.com/info.php .
- *
- * If you are feeling kind and generous, consider supporting the project by
- * making a donation at: http://www.jqplot.com/donate.php .
- *
- * sprintf functions contained in jqplot.sprintf.js by Ash Searle:
- *
- * version 2007.04.27
- * author Ash Searle
- * http://hexmen.com/blog/2007/03/printf-sprintf/
- * http://hexmen.com/js/sprintf.js
- * The author (Ash Searle) has placed this code in the public domain:
- * "This code is unrestricted: you are free to use it however you like."
- *
- * included jsDate library by Chris Leonello:
- *
- * Copyright (c) 2010-2011 Chris Leonello
- *
- * jsDate is currently available for use in all personal or commercial projects
- * under both the MIT and GPL version 2.0 licenses. This means that you can
- * choose the license that best suits your project and use it accordingly.
- *
- * jsDate borrows many concepts and ideas from the Date Instance
- * Methods by Ken Snyder along with some parts of Ken's actual code.
- *
- * Ken's origianl Date Instance Methods and copyright notice:
- *
- * Ken Snyder (ken d snyder at gmail dot com)
- * 2008-09-10
- * version 2.0.2 (http://kendsnyder.com/sandbox/date/)
- * Creative Commons Attribution License 3.0 (http://creativecommons.org/licenses/by/3.0/)
- *
- * jqplotToImage function based on Larry Siden's export-jqplot-to-png.js.
- * Larry has generously given permission to adapt his code for inclusion
- * into jqPlot.
- *
- * Larry's original code can be found here:
- *
- * https://github.com/lsiden/export-jqplot-to-png
- *
- *
- */
-(function(a){a.jqplot.PyramidGridRenderer=function(){a.jqplot.CanvasGridRenderer.call(this)};a.jqplot.PyramidGridRenderer.prototype=new a.jqplot.CanvasGridRenderer();a.jqplot.PyramidGridRenderer.prototype.constructor=a.jqplot.PyramidGridRenderer;a.jqplot.CanvasGridRenderer.prototype.init=function(c){this._ctx;this.plotBands={show:false,color:"rgb(230, 219, 179)",axis:"y",start:null,interval:10};a.extend(true,this,c);var b={lineJoin:"miter",lineCap:"round",fill:false,isarc:false,angle:this.shadowAngle,offset:this.shadowOffset,alpha:this.shadowAlpha,depth:this.shadowDepth,lineWidth:this.shadowWidth,closePath:false,strokeStyle:this.shadowColor};this.renderer.shadowRenderer.init(b)};a.jqplot.PyramidGridRenderer.prototype.draw=function(){this._ctx=this._elem.get(0).getContext("2d");var D=this._ctx;var G=this._axes;var q=G.xaxis.u2p;var J=G.yMidAxis.u2p;var l=G.xaxis.max/1000;var u=q(0);var f=q(l);var r=["xaxis","yaxis","x2axis","y2axis","yMidAxis"];D.save();D.clearRect(0,0,this._plotDimensions.width,this._plotDimensions.height);D.fillStyle=this.backgroundColor||this.background;D.fillRect(this._left,this._top,this._width,this._height);if(this.plotBands.show){D.save();var c=this.plotBands;D.fillStyle=c.color;var d;var o,n,p,I;if(c.axis.charAt(0)==="x"){if(G.xaxis.show){d=G.xaxis}}else{if(c.axis.charAt(0)==="y"){if(G.yaxis.show){d=G.yaxis}else{if(G.y2axis.show){d=G.y2axis}else{if(G.yMidAxis.show){d=G.yMidAxis}}}}}if(d!==undefined){var g=c.start;if(g===null){g=d.min}for(var H=g;H0;H--){var O=r[H-1];var d=G[O];var M=d._ticks;var B=M.length;if(d.show){if(d.drawBaseline){var N={};if(d.baselineWidth!==null){N.lineWidth=d.baselineWidth}if(d.baselineColor!==null){N.strokeStyle=d.baselineColor}switch(O){case"xaxis":if(G.yMidAxis.show){z(this._left,this._bottom,u,this._bottom,N);z(f,this._bottom,this._right,this._bottom,N)}else{z(this._left,this._bottom,this._right,this._bottom,N)}break;case"yaxis":z(this._left,this._bottom,this._left,this._top,N);break;case"yMidAxis":z(u,this._bottom,u,this._top,N);z(f,this._bottom,f,this._top,N);break;case"x2axis":if(G.yMidAxis.show){z(this._left,this._top,u,this._top,N);z(f,this._top,this._right,this._top,N)}else{z(this._left,this._bottom,this._right,this._bottom,N)}break;case"y2axis":z(this._right,this._bottom,this._right,this._top,N);break}}for(var E=B;E>0;E--){var v=M[E-1];if(v.show){var k=Math.round(d.u2p(v.value))+0.5;switch(O){case"xaxis":if(v.showGridline&&this.drawGridlines&&(!v.isMinorTick||d.showMinorTicks)){z(k,this._top,k,this._bottom)}if(v.showMark&&v.mark&&(!v.isMinorTick||d.showMinorTicks)){A=v.markSize;C=v.mark;var k=Math.round(d.u2p(v.value))+0.5;switch(C){case"outside":L=this._bottom;K=this._bottom+A;break;case"inside":L=this._bottom-A;K=this._bottom;break;case"cross":L=this._bottom-A;K=this._bottom+A;break;default:L=this._bottom;K=this._bottom+A;break}if(this.shadow){this.renderer.shadowRenderer.draw(D,[[k,L],[k,K]],{lineCap:"butt",lineWidth:this.gridLineWidth,offset:this.gridLineWidth*0.75,depth:2,fill:false,closePath:false})}z(k,L,k,K)}break;case"yaxis":if(v.showGridline&&this.drawGridlines&&(!v.isMinorTick||d.showMinorTicks)){z(this._right,k,this._left,k)}if(v.showMark&&v.mark&&(!v.isMinorTick||d.showMinorTicks)){A=v.markSize;C=v.mark;var k=Math.round(d.u2p(v.value))+0.5;switch(C){case"outside":L=this._left-A;K=this._left;break;case"inside":L=this._left;K=this._left+A;break;case"cross":L=this._left-A;K=this._left+A;break;default:L=this._left-A;K=this._left;break}if(this.shadow){this.renderer.shadowRenderer.draw(D,[[L,k],[K,k]],{lineCap:"butt",lineWidth:this.gridLineWidth*1.5,offset:this.gridLineWidth*0.75,fill:false,closePath:false})}z(L,k,K,k,{strokeStyle:d.borderColor})}break;case"yMidAxis":if(v.showGridline&&this.drawGridlines&&(!v.isMinorTick||d.showMinorTicks)){z(this._left,k,u,k);z(f,k,this._right,k)}if(v.showMark&&v.mark&&(!v.isMinorTick||d.showMinorTicks)){A=v.markSize;C=v.mark;var k=Math.round(d.u2p(v.value))+0.5;L=u;K=u+A;if(this.shadow){this.renderer.shadowRenderer.draw(D,[[L,k],[K,k]],{lineCap:"butt",lineWidth:this.gridLineWidth*1.5,offset:this.gridLineWidth*0.75,fill:false,closePath:false})}z(L,k,K,k,{strokeStyle:d.borderColor});L=f-A;K=f;if(this.shadow){this.renderer.shadowRenderer.draw(D,[[L,k],[K,k]],{lineCap:"butt",lineWidth:this.gridLineWidth*1.5,offset:this.gridLineWidth*0.75,fill:false,closePath:false})}z(L,k,K,k,{strokeStyle:d.borderColor})}break;case"x2axis":if(v.showGridline&&this.drawGridlines&&(!v.isMinorTick||d.showMinorTicks)){z(k,this._bottom,k,this._top)}if(v.showMark&&v.mark&&(!v.isMinorTick||d.showMinorTicks)){A=v.markSize;C=v.mark;var k=Math.round(d.u2p(v.value))+0.5;switch(C){case"outside":L=this._top-A;K=this._top;break;case"inside":L=this._top;K=this._top+A;break;case"cross":L=this._top-A;K=this._top+A;break;default:L=this._top-A;K=this._top;break}if(this.shadow){this.renderer.shadowRenderer.draw(D,[[k,L],[k,K]],{lineCap:"butt",lineWidth:this.gridLineWidth,offset:this.gridLineWidth*0.75,depth:2,fill:false,closePath:false})}z(k,L,k,K)}break;case"y2axis":if(v.showGridline&&this.drawGridlines&&(!v.isMinorTick||d.showMinorTicks)){z(this._left,k,this._right,k)}if(v.showMark&&v.mark&&(!v.isMinorTick||d.showMinorTicks)){A=v.markSize;C=v.mark;var k=Math.round(d.u2p(v.value))+0.5;switch(C){case"outside":L=this._right;K=this._right+A;break;case"inside":L=this._right-A;K=this._right;break;case"cross":L=this._right-A;K=this._right+A;break;default:L=this._right;K=this._right+A;break}if(this.shadow){this.renderer.shadowRenderer.draw(D,[[L,k],[K,k]],{lineCap:"butt",lineWidth:this.gridLineWidth*1.5,offset:this.gridLineWidth*0.75,fill:false,closePath:false})}z(L,k,K,k,{strokeStyle:d.borderColor})}break;default:break}}}v=null}d=null;M=null}D.restore();function z(j,i,e,b,h){D.save();h=h||{};if(h.lineWidth==null||h.lineWidth!=0){a.extend(true,D,h);D.beginPath();D.moveTo(j,i);D.lineTo(e,b);D.stroke()}D.restore()}if(this.shadow){if(G.yMidAxis.show){var F=[[this._left,this._bottom],[u,this._bottom]];this.renderer.shadowRenderer.draw(D,F);var F=[[f,this._bottom],[this._right,this._bottom],[this._right,this._top]];this.renderer.shadowRenderer.draw(D,F);var F=[[u,this._bottom],[u,this._top]];this.renderer.shadowRenderer.draw(D,F)}else{var F=[[this._left,this._bottom],[this._right,this._bottom],[this._right,this._top]];this.renderer.shadowRenderer.draw(D,F)}}if(this.borderWidth!=0&&this.drawBorder){if(G.yMidAxis.show){z(this._left,this._top,u,this._top,{lineCap:"round",strokeStyle:G.x2axis.borderColor,lineWidth:G.x2axis.borderWidth});z(f,this._top,this._right,this._top,{lineCap:"round",strokeStyle:G.x2axis.borderColor,lineWidth:G.x2axis.borderWidth});z(this._right,this._top,this._right,this._bottom,{lineCap:"round",strokeStyle:G.y2axis.borderColor,lineWidth:G.y2axis.borderWidth});z(this._right,this._bottom,f,this._bottom,{lineCap:"round",strokeStyle:G.xaxis.borderColor,lineWidth:G.xaxis.borderWidth});z(u,this._bottom,this._left,this._bottom,{lineCap:"round",strokeStyle:G.xaxis.borderColor,lineWidth:G.xaxis.borderWidth});z(this._left,this._bottom,this._left,this._top,{lineCap:"round",strokeStyle:G.yaxis.borderColor,lineWidth:G.yaxis.borderWidth});z(u,this._bottom,u,this._top,{lineCap:"round",strokeStyle:G.yaxis.borderColor,lineWidth:G.yaxis.borderWidth});z(f,this._bottom,f,this._top,{lineCap:"round",strokeStyle:G.yaxis.borderColor,lineWidth:G.yaxis.borderWidth})}else{z(this._left,this._top,this._right,this._top,{lineCap:"round",strokeStyle:G.x2axis.borderColor,lineWidth:G.x2axis.borderWidth});z(this._right,this._top,this._right,this._bottom,{lineCap:"round",strokeStyle:G.y2axis.borderColor,lineWidth:G.y2axis.borderWidth});z(this._right,this._bottom,this._left,this._bottom,{lineCap:"round",strokeStyle:G.xaxis.borderColor,lineWidth:G.xaxis.borderWidth});z(this._left,this._bottom,this._left,this._top,{lineCap:"round",strokeStyle:G.yaxis.borderColor,lineWidth:G.yaxis.borderWidth})}}D.restore();D=null;G=null}})(jQuery);
\ No newline at end of file
diff --git a/libreplan-webapp/src/main/webapp/jqplot/plugins/jqplot.pyramidRenderer.js b/libreplan-webapp/src/main/webapp/jqplot/plugins/jqplot.pyramidRenderer.js
deleted file mode 100644
index f64fb2e96..000000000
--- a/libreplan-webapp/src/main/webapp/jqplot/plugins/jqplot.pyramidRenderer.js
+++ /dev/null
@@ -1,490 +0,0 @@
-/**
- * jqPlot
- * Pure JavaScript plotting plugin using jQuery
- *
- * Version: 1.0.0b2_r1012
- *
- * Copyright (c) 2009-2011 Chris Leonello
- * jqPlot is currently available for use in all personal or commercial projects
- * under both the MIT (http://www.opensource.org/licenses/mit-license.php) and GPL
- * version 2.0 (http://www.gnu.org/licenses/gpl-2.0.html) licenses. This means that you can
- * choose the license that best suits your project and use it accordingly.
- *
- * Although not required, the author would appreciate an email letting him
- * know of any substantial use of jqPlot. You can reach the author at:
- * chris at jqplot dot com or see http://www.jqplot.com/info.php .
- *
- * If you are feeling kind and generous, consider supporting the project by
- * making a donation at: http://www.jqplot.com/donate.php .
- *
- * sprintf functions contained in jqplot.sprintf.js by Ash Searle:
- *
- * version 2007.04.27
- * author Ash Searle
- * http://hexmen.com/blog/2007/03/printf-sprintf/
- * http://hexmen.com/js/sprintf.js
- * The author (Ash Searle) has placed this code in the public domain:
- * "This code is unrestricted: you are free to use it however you like."
- *
- */
-(function($) {
-
- // Need to ensure pyramid axis and grid renderers are loaded.
- // You should load these with script tags in the html head, that is more efficient
- // as the browser will cache the request.
- // Note, have to block with synchronous request in order to execute bar renderer code.
- if ($.jqplot.PyramidAxisRenderer === undefined) {
- $.ajax({
- url: $.jqplot.pluginLocation + 'jqplot.pyramidAxisRenderer.js',
- dataType: "script",
- async: false
- });
- }
-
- if ($.jqplot.PyramidGridRenderer === undefined) {
- $.ajax({
- url: $.jqplot.pluginLocation + 'jqplot.pyramidGridRenderer.js',
- dataType: "script",
- async: false
- });
- }
-
- $.jqplot.PyramidRenderer = function(){
- $.jqplot.LineRenderer.call(this);
- };
-
- $.jqplot.PyramidRenderer.prototype = new $.jqplot.LineRenderer();
- $.jqplot.PyramidRenderer.prototype.constructor = $.jqplot.PyramidRenderer;
-
- // called with scope of a series
- $.jqplot.PyramidRenderer.prototype.init = function(options, plot) {
- options = options || {};
- this._type = 'pyramid';
- // Group: Properties
- //
- // prop: barPadding
- this.barPadding = 10;
- this.barWidth = null;
- // prop: fill
- // True to fill the bars.
- this.fill = true;
- // prop: highlightMouseOver
- // True to highlight slice when moused over.
- // This must be false to enable highlightMouseDown to highlight when clicking on a slice.
- this.highlightMouseOver = true;
- // prop: highlightMouseDown
- // True to highlight when a mouse button is pressed over a slice.
- // This will be disabled if highlightMouseOver is true.
- this.highlightMouseDown = false;
- // prop: highlightColors
- // an array of colors to use when highlighting a slice.
- this.highlightColors = [];
- // prop: offsetBars
- // False will center bars on their y value.
- // True will push bars up by 1/2 bar width to fill between their y values.
- // If true, there needs to be 1 more tick than there are bars.
- this.offsetBars = false;
-
- // if user has passed in highlightMouseDown option and not set highlightMouseOver, disable highlightMouseOver
- if (options.highlightMouseDown && options.highlightMouseOver == null) {
- options.highlightMouseOver = false;
- }
-
- this.side = 'right';
-
- $.extend(true, this, options);
-
- // if (this.fill === false) {
- // this.shadow = false;
- // }
-
- this.renderer.options = options;
- // index of the currenty highlighted point, if any
- this._highlightedPoint = null;
- // Array of actual data colors used for each data point.
- this._dataColors = [];
- this._barPoints = [];
- this.fillAxis = 'y';
- this._primaryAxis = '_yaxis';
- this._xnudge = 0;
-
- // set the shape renderer options
- var opts = {lineJoin:'miter', lineCap:'butt', fill:this.fill, fillRect:this.fill, isarc:false, strokeStyle:this.color, fillStyle:this.color, closePath:this.fill, lineWidth: this.lineWidth};
- this.renderer.shapeRenderer.init(opts);
- // set the shadow renderer options
- var shadow_offset = options.shadowOffset;
- // set the shadow renderer options
- if (shadow_offset == null) {
- // scale the shadowOffset to the width of the line.
- if (this.lineWidth > 2.5) {
- shadow_offset = 1.25 * (1 + (Math.atan((this.lineWidth/2.5))/0.785398163 - 1)*0.6);
- // var shadow_offset = this.shadowOffset;
- }
- // for skinny lines, don't make such a big shadow.
- else {
- shadow_offset = 1.25 * Math.atan((this.lineWidth/2.5))/0.785398163;
- }
- }
- var sopts = {lineJoin:'miter', lineCap:'butt', fill:this.fill, fillRect:this.fill, isarc:false, angle:this.shadowAngle, offset:shadow_offset, alpha:this.shadowAlpha, depth:this.shadowDepth, closePath:this.fill, lineWidth: this.lineWidth};
- this.renderer.shadowRenderer.init(sopts);
-
- plot.postDrawHooks.addOnce(postPlotDraw);
- plot.eventListenerHooks.addOnce('jqplotMouseMove', handleMove);
-
- // if this is the left side of pyramid, set y values to negative.
- if (this.side === 'left') {
- for (var i=0, l=this.data.length; i= 0) {
- // xstart = this._xaxis.series_u2p(this._xnudge);
- w = gridData[i][0] - xstart;
- h = this.barWidth;
- points = [xstart, base - bw2 - yadj, w, h];
- }
- else {
- // xstart = this._xaxis.series_u2p(0);
- w = xstart - gridData[i][0];
- h = this.barWidth;
- points = [gridData[i][0], base - bw2 - yadj, w, h];
- }
-
- this._barPoints.push([[points[0], points[1] + h], [points[0], points[1]], [points[0] + w, points[1]], [points[0] + w, points[1] + h]]);
-
- if (shadow) {
- this.renderer.shadowRenderer.draw(ctx, points);
- }
- var clr = opts.fillStyle || this.color;
- this._dataColors.push(clr);
- this.renderer.shapeRenderer.draw(ctx, points, opts);
- }
-
- else {
- if (i === 0) {
- points =[[xstart, ystart], [gridData[i][0], ystart], [gridData[i][0], gridData[i][1] - bw2 - yadj]];
- }
-
- else if (i < l-1) {
- points = points.concat([[gridData[i-1][0], gridData[i-1][1] - bw2 - yadj], [gridData[i][0], gridData[i][1] + bw2 - yadj], [gridData[i][0], gridData[i][1] - bw2 - yadj]]);
- }
-
- // finally, draw the line
- else {
- points = points.concat([[gridData[i-1][0], gridData[i-1][1] - bw2 - yadj], [gridData[i][0], gridData[i][1] + bw2 - yadj], [gridData[i][0], yend], [xstart, yend]]);
-
- if (shadow) {
- this.renderer.shadowRenderer.draw(ctx, points);
- }
- var clr = opts.fillStyle || this.color;
- this._dataColors.push(clr);
- this.renderer.shapeRenderer.draw(ctx, points, opts);
- }
- }
- }
- }
-
- if (this.highlightColors.length == 0) {
- this.highlightColors = $.jqplot.computeHighlightColors(this._dataColors);
- }
-
- else if (typeof(this.highlightColors) == 'string') {
- this.highlightColors = [];
- for (var i=0; i2.5){m=1.25*(1+(Math.atan((this.lineWidth/2.5))/0.785398163-1)*0.6)}else{m=1.25*Math.atan((this.lineWidth/2.5))/0.785398163}}var h={lineJoin:"miter",lineCap:"butt",fill:this.fill,fillRect:this.fill,isarc:false,angle:this.shadowAngle,offset:m,alpha:this.shadowAlpha,depth:this.shadowDepth,closePath:this.fill,lineWidth:this.lineWidth};this.renderer.shadowRenderer.init(h);o.postDrawHooks.addOnce(f);o.eventListenerHooks.addOnce("jqplotMouseMove",e);if(this.side==="left"){for(var k=0,g=this.data.length;k=0){s=I[E][0]-L;F=this.barWidth;D=[L,n-y-r,s,F]}else{s=L-I[E][0];F=this.barWidth;D=[I[E][0],n-y-r,s,F]}this._barPoints.push([[D[0],D[1]+F],[D[0],D[1]],[D[0]+s,D[1]],[D[0]+s,D[1]+F]]);if(p){this.renderer.shadowRenderer.draw(B,D)}var g=u.fillStyle||this.color;this._dataColors.push(g);this.renderer.shapeRenderer.draw(B,D,u)}else{if(E===0){D=[[L,j],[I[E][0],j],[I[E][0],I[E][1]-y-r]]}else{if(E