http://git-wip-us.apache.org/repos/asf/camel/blob/9f5e32db/components/camel-web/src/main/webapp/js/dojox/charting/widget/Chart2D.js.uncompressed.js ---------------------------------------------------------------------- diff --git a/components/camel-web/src/main/webapp/js/dojox/charting/widget/Chart2D.js.uncompressed.js b/components/camel-web/src/main/webapp/js/dojox/charting/widget/Chart2D.js.uncompressed.js deleted file mode 100644 index d51e93a..0000000 --- a/components/camel-web/src/main/webapp/js/dojox/charting/widget/Chart2D.js.uncompressed.js +++ /dev/null @@ -1,8043 +0,0 @@ -/* - Copyright (c) 2004-2009, The Dojo Foundation All Rights Reserved. - Available via Academic Free License >= 2.1 OR the modified BSD license. - see: http://dojotoolkit.org/license for details -*/ - -/* - This is a compiled version of Dojo, built for deployment and not for - development. To get an editable version, please visit: - - http://dojotoolkit.org - - for documentation and information on getting the source. -*/ - -if(!dojo._hasResource["dojox.gfx.matrix"]){ //_hasResource checks added by build. Do not use _hasResource directly in your code. -dojo._hasResource["dojox.gfx.matrix"] = true; -dojo.provide("dojox.gfx.matrix"); - -(function(){ - var m = dojox.gfx.matrix; - - // candidates for dojox.math: - m._degToRad = function(degree){ return Math.PI * degree / 180; }; - m._radToDeg = function(radian){ return radian / Math.PI * 180; }; - - m.Matrix2D = function(arg){ - // summary: a 2D matrix object - // description: Normalizes a 2D matrix-like object. If arrays is passed, - // all objects of the array are normalized and multiplied sequentially. - // arg: Object - // a 2D matrix-like object, a number, or an array of such objects - if(arg){ - if(typeof arg == "number"){ - this.xx = this.yy = arg; - }else if(arg instanceof Array){ - if(arg.length > 0){ - var matrix = m.normalize(arg[0]); - // combine matrices - for(var i = 1; i < arg.length; ++i){ - var l = matrix, r = dojox.gfx.matrix.normalize(arg[i]); - matrix = new m.Matrix2D(); - matrix.xx = l.xx * r.xx + l.xy * r.yx; - matrix.xy = l.xx * r.xy + l.xy * r.yy; - matrix.yx = l.yx * r.xx + l.yy * r.yx; - matrix.yy = l.yx * r.xy + l.yy * r.yy; - matrix.dx = l.xx * r.dx + l.xy * r.dy + l.dx; - matrix.dy = l.yx * r.dx + l.yy * r.dy + l.dy; - } - dojo.mixin(this, matrix); - } - }else{ - dojo.mixin(this, arg); - } - } - }; - - // the default (identity) matrix, which is used to fill in missing values - dojo.extend(m.Matrix2D, {xx: 1, xy: 0, yx: 0, yy: 1, dx: 0, dy: 0}); - - dojo.mixin(m, { - // summary: class constants, and methods of dojox.gfx.matrix - - // matrix constants - - // identity: dojox.gfx.matrix.Matrix2D - // an identity matrix constant: identity * (x, y) == (x, y) - identity: new m.Matrix2D(), - - // flipX: dojox.gfx.matrix.Matrix2D - // a matrix, which reflects points at x = 0 line: flipX * (x, y) == (-x, y) - flipX: new m.Matrix2D({xx: -1}), - - // flipY: dojox.gfx.matrix.Matrix2D - // a matrix, which reflects points at y = 0 line: flipY * (x, y) == (x, -y) - flipY: new m.Matrix2D({yy: -1}), - - // flipXY: dojox.gfx.matrix.Matrix2D - // a matrix, which reflects points at the origin of coordinates: flipXY * (x, y) == (-x, -y) - flipXY: new m.Matrix2D({xx: -1, yy: -1}), - - // matrix creators - - translate: function(a, b){ - // summary: forms a translation matrix - // description: The resulting matrix is used to translate (move) points by specified offsets. - // a: Number: an x coordinate value - // b: Number: a y coordinate value - if(arguments.length > 1){ - return new m.Matrix2D({dx: a, dy: b}); // dojox.gfx.matrix.Matrix2D - } - // branch - // a: dojox.gfx.Point: a point-like object, which specifies offsets for both dimensions - // b: null - return new m.Matrix2D({dx: a.x, dy: a.y}); // dojox.gfx.matrix.Matrix2D - }, - scale: function(a, b){ - // summary: forms a scaling matrix - // description: The resulting matrix is used to scale (magnify) points by specified offsets. - // a: Number: a scaling factor used for the x coordinate - // b: Number: a scaling factor used for the y coordinate - if(arguments.length > 1){ - return new m.Matrix2D({xx: a, yy: b}); // dojox.gfx.matrix.Matrix2D - } - if(typeof a == "number"){ - // branch - // a: Number: a uniform scaling factor used for the both coordinates - // b: null - return new m.Matrix2D({xx: a, yy: a}); // dojox.gfx.matrix.Matrix2D - } - // branch - // a: dojox.gfx.Point: a point-like object, which specifies scale factors for both dimensions - // b: null - return new m.Matrix2D({xx: a.x, yy: a.y}); // dojox.gfx.matrix.Matrix2D - }, - rotate: function(angle){ - // summary: forms a rotating matrix - // description: The resulting matrix is used to rotate points - // around the origin of coordinates (0, 0) by specified angle. - // angle: Number: an angle of rotation in radians (>0 for CW) - var c = Math.cos(angle); - var s = Math.sin(angle); - return new m.Matrix2D({xx: c, xy: -s, yx: s, yy: c}); // dojox.gfx.matrix.Matrix2D - }, - rotateg: function(degree){ - // summary: forms a rotating matrix - // description: The resulting matrix is used to rotate points - // around the origin of coordinates (0, 0) by specified degree. - // See dojox.gfx.matrix.rotate() for comparison. - // degree: Number: an angle of rotation in degrees (>0 for CW) - return m.rotate(m._degToRad(degree)); // dojox.gfx.matrix.Matrix2D - }, - skewX: function(angle) { - // summary: forms an x skewing matrix - // description: The resulting matrix is used to skew points in the x dimension - // around the origin of coordinates (0, 0) by specified angle. - // angle: Number: an skewing angle in radians - return new m.Matrix2D({xy: Math.tan(angle)}); // dojox.gfx.matrix.Matrix2D - }, - skewXg: function(degree){ - // summary: forms an x skewing matrix - // description: The resulting matrix is used to skew points in the x dimension - // around the origin of coordinates (0, 0) by specified degree. - // See dojox.gfx.matrix.skewX() for comparison. - // degree: Number: an skewing angle in degrees - return m.skewX(m._degToRad(degree)); // dojox.gfx.matrix.Matrix2D - }, - skewY: function(angle){ - // summary: forms a y skewing matrix - // description: The resulting matrix is used to skew points in the y dimension - // around the origin of coordinates (0, 0) by specified angle. - // angle: Number: an skewing angle in radians - return new m.Matrix2D({yx: Math.tan(angle)}); // dojox.gfx.matrix.Matrix2D - }, - skewYg: function(degree){ - // summary: forms a y skewing matrix - // description: The resulting matrix is used to skew points in the y dimension - // around the origin of coordinates (0, 0) by specified degree. - // See dojox.gfx.matrix.skewY() for comparison. - // degree: Number: an skewing angle in degrees - return m.skewY(m._degToRad(degree)); // dojox.gfx.matrix.Matrix2D - }, - reflect: function(a, b){ - // summary: forms a reflection matrix - // description: The resulting matrix is used to reflect points around a vector, - // which goes through the origin. - // a: dojox.gfx.Point: a point-like object, which specifies a vector of reflection - // b: null - if(arguments.length == 1){ - b = a.y; - a = a.x; - } - // branch - // a: Number: an x coordinate value - // b: Number: a y coordinate value - - // make a unit vector - var a2 = a * a, b2 = b * b, n2 = a2 + b2, xy = 2 * a * b / n2; - return new m.Matrix2D({xx: 2 * a2 / n2 - 1, xy: xy, yx: xy, yy: 2 * b2 / n2 - 1}); // dojox.gfx.matrix.Matrix2D - }, - project: function(a, b){ - // summary: forms an orthogonal projection matrix - // description: The resulting matrix is used to project points orthogonally on a vector, - // which goes through the origin. - // a: dojox.gfx.Point: a point-like object, which specifies a vector of projection - // b: null - if(arguments.length == 1){ - b = a.y; - a = a.x; - } - // branch - // a: Number: an x coordinate value - // b: Number: a y coordinate value - - // make a unit vector - var a2 = a * a, b2 = b * b, n2 = a2 + b2, xy = a * b / n2; - return new m.Matrix2D({xx: a2 / n2, xy: xy, yx: xy, yy: b2 / n2}); // dojox.gfx.matrix.Matrix2D - }, - - // ensure matrix 2D conformance - normalize: function(matrix){ - // summary: converts an object to a matrix, if necessary - // description: Converts any 2D matrix-like object or an array of - // such objects to a valid dojox.gfx.matrix.Matrix2D object. - // matrix: Object: an object, which is converted to a matrix, if necessary - return (matrix instanceof m.Matrix2D) ? matrix : new m.Matrix2D(matrix); // dojox.gfx.matrix.Matrix2D - }, - - // common operations - - clone: function(matrix){ - // summary: creates a copy of a 2D matrix - // matrix: dojox.gfx.matrix.Matrix2D: a 2D matrix-like object to be cloned - var obj = new m.Matrix2D(); - for(var i in matrix){ - if(typeof(matrix[i]) == "number" && typeof(obj[i]) == "number" && obj[i] != matrix[i]) obj[i] = matrix[i]; - } - return obj; // dojox.gfx.matrix.Matrix2D - }, - invert: function(matrix){ - // summary: inverts a 2D matrix - // matrix: dojox.gfx.matrix.Matrix2D: a 2D matrix-like object to be inverted - var M = m.normalize(matrix), - D = M.xx * M.yy - M.xy * M.yx, - M = new m.Matrix2D({ - xx: M.yy/D, xy: -M.xy/D, - yx: -M.yx/D, yy: M.xx/D, - dx: (M.xy * M.dy - M.yy * M.dx) / D, - dy: (M.yx * M.dx - M.xx * M.dy) / D - }); - return M; // dojox.gfx.matrix.Matrix2D - }, - _multiplyPoint: function(matrix, x, y){ - // summary: applies a matrix to a point - // matrix: dojox.gfx.matrix.Matrix2D: a 2D matrix object to be applied - // x: Number: an x coordinate of a point - // y: Number: a y coordinate of a point - return {x: matrix.xx * x + matrix.xy * y + matrix.dx, y: matrix.yx * x + matrix.yy * y + matrix.dy}; // dojox.gfx.Point - }, - multiplyPoint: function(matrix, /* Number||Point */ a, /* Number, optional */ b){ - // summary: applies a matrix to a point - // matrix: dojox.gfx.matrix.Matrix2D: a 2D matrix object to be applied - // a: Number: an x coordinate of a point - // b: Number: a y coordinate of a point - var M = m.normalize(matrix); - if(typeof a == "number" && typeof b == "number"){ - return m._multiplyPoint(M, a, b); // dojox.gfx.Point - } - // branch - // matrix: dojox.gfx.matrix.Matrix2D: a 2D matrix object to be applied - // a: dojox.gfx.Point: a point - // b: null - return m._multiplyPoint(M, a.x, a.y); // dojox.gfx.Point - }, - multiply: function(matrix){ - // summary: combines matrices by multiplying them sequentially in the given order - // matrix: dojox.gfx.matrix.Matrix2D...: a 2D matrix-like object, - // all subsequent arguments are matrix-like objects too - var M = m.normalize(matrix); - // combine matrices - for(var i = 1; i < arguments.length; ++i){ - var l = M, r = m.normalize(arguments[i]); - M = new m.Matrix2D(); - M.xx = l.xx * r.xx + l.xy * r.yx; - M.xy = l.xx * r.xy + l.xy * r.yy; - M.yx = l.yx * r.xx + l.yy * r.yx; - M.yy = l.yx * r.xy + l.yy * r.yy; - M.dx = l.xx * r.dx + l.xy * r.dy + l.dx; - M.dy = l.yx * r.dx + l.yy * r.dy + l.dy; - } - return M; // dojox.gfx.matrix.Matrix2D - }, - - // high level operations - - _sandwich: function(matrix, x, y){ - // summary: applies a matrix at a centrtal point - // matrix: dojox.gfx.matrix.Matrix2D: a 2D matrix-like object, which is applied at a central point - // x: Number: an x component of the central point - // y: Number: a y component of the central point - return m.multiply(m.translate(x, y), matrix, m.translate(-x, -y)); // dojox.gfx.matrix.Matrix2D - }, - scaleAt: function(a, b, c, d){ - // summary: scales a picture using a specified point as a center of scaling - // description: Compare with dojox.gfx.matrix.scale(). - // a: Number: a scaling factor used for the x coordinate - // b: Number: a scaling factor used for the y coordinate - // c: Number: an x component of a central point - // d: Number: a y component of a central point - - // accepts several signatures: - // 1) uniform scale factor, Point - // 2) uniform scale factor, x, y - // 3) x scale, y scale, Point - // 4) x scale, y scale, x, y - - switch(arguments.length){ - case 4: - // a and b are scale factor components, c and d are components of a point - return m._sandwich(m.scale(a, b), c, d); // dojox.gfx.matrix.Matrix2D - case 3: - if(typeof c == "number"){ - // branch - // a: Number: a uniform scaling factor used for both coordinates - // b: Number: an x component of a central point - // c: Number: a y component of a central point - // d: null - return m._sandwich(m.scale(a), b, c); // dojox.gfx.matrix.Matrix2D - } - // branch - // a: Number: a scaling factor used for the x coordinate - // b: Number: a scaling factor used for the y coordinate - // c: dojox.gfx.Point: a central point - // d: null - return m._sandwich(m.scale(a, b), c.x, c.y); // dojox.gfx.matrix.Matrix2D - } - // branch - // a: Number: a uniform scaling factor used for both coordinates - // b: dojox.gfx.Point: a central point - // c: null - // d: null - return m._sandwich(m.scale(a), b.x, b.y); // dojox.gfx.matrix.Matrix2D - }, - rotateAt: function(angle, a, b){ - // summary: rotates a picture using a specified point as a center of rotation - // description: Compare with dojox.gfx.matrix.rotate(). - // angle: Number: an angle of rotation in radians (>0 for CW) - // a: Number: an x component of a central point - // b: Number: a y component of a central point - - // accepts several signatures: - // 1) rotation angle in radians, Point - // 2) rotation angle in radians, x, y - - if(arguments.length > 2){ - return m._sandwich(m.rotate(angle), a, b); // dojox.gfx.matrix.Matrix2D - } - - // branch - // angle: Number: an angle of rotation in radians (>0 for CCW) - // a: dojox.gfx.Point: a central point - // b: null - return m._sandwich(m.rotate(angle), a.x, a.y); // dojox.gfx.matrix.Matrix2D - }, - rotategAt: function(degree, a, b){ - // summary: rotates a picture using a specified point as a center of rotation - // description: Compare with dojox.gfx.matrix.rotateg(). - // degree: Number: an angle of rotation in degrees (>0 for CW) - // a: Number: an x component of a central point - // b: Number: a y component of a central point - - // accepts several signatures: - // 1) rotation angle in degrees, Point - // 2) rotation angle in degrees, x, y - - if(arguments.length > 2){ - return m._sandwich(m.rotateg(degree), a, b); // dojox.gfx.matrix.Matrix2D - } - - // branch - // degree: Number: an angle of rotation in degrees (>0 for CCW) - // a: dojox.gfx.Point: a central point - // b: null - return m._sandwich(m.rotateg(degree), a.x, a.y); // dojox.gfx.matrix.Matrix2D - }, - skewXAt: function(angle, a, b){ - // summary: skews a picture along the x axis using a specified point as a center of skewing - // description: Compare with dojox.gfx.matrix.skewX(). - // angle: Number: an skewing angle in radians - // a: Number: an x component of a central point - // b: Number: a y component of a central point - - // accepts several signatures: - // 1) skew angle in radians, Point - // 2) skew angle in radians, x, y - - if(arguments.length > 2){ - return m._sandwich(m.skewX(angle), a, b); // dojox.gfx.matrix.Matrix2D - } - - // branch - // angle: Number: an skewing angle in radians - // a: dojox.gfx.Point: a central point - // b: null - return m._sandwich(m.skewX(angle), a.x, a.y); // dojox.gfx.matrix.Matrix2D - }, - skewXgAt: function(degree, a, b){ - // summary: skews a picture along the x axis using a specified point as a center of skewing - // description: Compare with dojox.gfx.matrix.skewXg(). - // degree: Number: an skewing angle in degrees - // a: Number: an x component of a central point - // b: Number: a y component of a central point - - // accepts several signatures: - // 1) skew angle in degrees, Point - // 2) skew angle in degrees, x, y - - if(arguments.length > 2){ - return m._sandwich(m.skewXg(degree), a, b); // dojox.gfx.matrix.Matrix2D - } - - // branch - // degree: Number: an skewing angle in degrees - // a: dojox.gfx.Point: a central point - // b: null - return m._sandwich(m.skewXg(degree), a.x, a.y); // dojox.gfx.matrix.Matrix2D - }, - skewYAt: function(angle, a, b){ - // summary: skews a picture along the y axis using a specified point as a center of skewing - // description: Compare with dojox.gfx.matrix.skewY(). - // angle: Number: an skewing angle in radians - // a: Number: an x component of a central point - // b: Number: a y component of a central point - - // accepts several signatures: - // 1) skew angle in radians, Point - // 2) skew angle in radians, x, y - - if(arguments.length > 2){ - return m._sandwich(m.skewY(angle), a, b); // dojox.gfx.matrix.Matrix2D - } - - // branch - // angle: Number: an skewing angle in radians - // a: dojox.gfx.Point: a central point - // b: null - return m._sandwich(m.skewY(angle), a.x, a.y); // dojox.gfx.matrix.Matrix2D - }, - skewYgAt: function(/* Number */ degree, /* Number||Point */ a, /* Number, optional */ b){ - // summary: skews a picture along the y axis using a specified point as a center of skewing - // description: Compare with dojox.gfx.matrix.skewYg(). - // degree: Number: an skewing angle in degrees - // a: Number: an x component of a central point - // b: Number: a y component of a central point - - // accepts several signatures: - // 1) skew angle in degrees, Point - // 2) skew angle in degrees, x, y - - if(arguments.length > 2){ - return m._sandwich(m.skewYg(degree), a, b); // dojox.gfx.matrix.Matrix2D - } - - // branch - // degree: Number: an skewing angle in degrees - // a: dojox.gfx.Point: a central point - // b: null - return m._sandwich(m.skewYg(degree), a.x, a.y); // dojox.gfx.matrix.Matrix2D - } - - //TODO: rect-to-rect mapping, scale-to-fit (isotropic and anisotropic versions) - - }); -})(); - -// propagate Matrix2D up -dojox.gfx.Matrix2D = dojox.gfx.matrix.Matrix2D; - -} - -if(!dojo._hasResource["dojox.gfx._base"]){ //_hasResource checks added by build. Do not use _hasResource directly in your code. -dojo._hasResource["dojox.gfx._base"] = true; -dojo.provide("dojox.gfx._base"); - -(function(){ - var g = dojox.gfx, b = g._base; - - // candidates for dojox.style (work on VML and SVG nodes) - g._hasClass = function(/*DomNode*/node, /*String*/classStr){ - // summary: - // Returns whether or not the specified classes are a portion of the - // class list currently applied to the node. - // return (new RegExp('(^|\\s+)'+classStr+'(\\s+|$)')).test(node.className) // Boolean - var cls = node.getAttribute("className"); - return cls && (" " + cls + " ").indexOf(" " + classStr + " ") >= 0; // Boolean - } - g._addClass = function(/*DomNode*/node, /*String*/classStr){ - // summary: - // Adds the specified classes to the end of the class list on the - // passed node. - var cls = node.getAttribute("className") || ""; - if(!cls || (" " + cls + " ").indexOf(" " + classStr + " ") < 0){ - node.setAttribute("className", cls + (cls ? " " : "") + classStr); - } - } - g._removeClass = function(/*DomNode*/node, /*String*/classStr){ - // summary: Removes classes from node. - var cls = node.getAttribute("className"); - if(cls){ - node.setAttribute("className", cls.replace(new RegExp('(^|\\s+)' + classStr + '(\\s+|$)'), "$1$2")); - } - } - - // candidate for dojox.html.metrics (dynamic font resize handler is not implemented here) - - // derived from Morris John's emResized measurer - b._getFontMeasurements = function(){ - // summary - // Returns an object that has pixel equivilents of standard font size values. - var heights = { - '1em':0, '1ex':0, '100%':0, '12pt':0, '16px':0, 'xx-small':0, 'x-small':0, - 'small':0, 'medium':0, 'large':0, 'x-large':0, 'xx-large':0 - }; - - if(dojo.isIE){ - // we do a font-size fix if and only if one isn't applied already. - // NOTE: If someone set the fontSize on the HTML Element, this will kill it. - dojo.doc.documentElement.style.fontSize="100%"; - } - - // set up the measuring node. - var div=dojo.doc.createElement("div"); - div.style.position="absolute"; - div.style.left="-100px"; - div.style.top="0"; - div.style.width="30px"; - div.style.height="1000em"; - div.style.border="0"; - div.style.margin="0"; - div.style.padding="0"; - div.style.outline="0"; - div.style.lineHeight="1"; - div.style.overflow="hidden"; - dojo.body().appendChild(div); - - // do the measurements. - for(var p in heights){ - div.style.fontSize = p; - heights[p] = Math.round(div.offsetHeight * 12/16) * 16/12 / 1000; - } - - dojo.body().removeChild(div); - div = null; - return heights; // object - }; - - var fontMeasurements = null; - - b._getCachedFontMeasurements = function(recalculate){ - if(recalculate || !fontMeasurements){ - fontMeasurements = b._getFontMeasurements(); - } - return fontMeasurements; - }; - - // candidate for dojox.html.metrics - - var measuringNode = null, empty = {}; - b._getTextBox = function(/* String */ text, /* Object */ style, /* String? */ className){ - var m; - if(!measuringNode){ - m = measuringNode = dojo.doc.createElement("div"); - m.style.position = "absolute"; - m.style.left = "-10000px"; - m.style.top = "0"; - dojo.body().appendChild(m); - }else{ - m = measuringNode; - } - // reset styles - m.className = ""; - m.style.border = "0"; - m.style.margin = "0"; - m.style.padding = "0"; - m.style.outline = "0"; - // set new style - if(arguments.length > 1 && style){ - for(var i in style){ - if(i in empty){ continue; } - m.style[i] = style[i]; - } - } - // set classes - if(arguments.length > 2 && className){ - m.className = className; - } - // take a measure - m.innerHTML = text; - return dojo.marginBox(m); - }; - - // candidate for dojo.dom - - var uniqueId = 0; - b._getUniqueId = function(){ - // summary: returns a unique string for use with any DOM element - var id; - do{ - id = dojo._scopeName + "Unique" + (++uniqueId); - }while(dojo.byId(id)); - return id; - }; -})(); - -dojo.mixin(dojox.gfx, { - // summary: defines constants, prototypes, and utility functions - - // default shapes, which are used to fill in missing parameters - defaultPath: {type: "path", path: ""}, - defaultPolyline: {type: "polyline", points: []}, - defaultRect: {type: "rect", x: 0, y: 0, width: 100, height: 100, r: 0}, - defaultEllipse: {type: "ellipse", cx: 0, cy: 0, rx: 200, ry: 100}, - defaultCircle: {type: "circle", cx: 0, cy: 0, r: 100}, - defaultLine: {type: "line", x1: 0, y1: 0, x2: 100, y2: 100}, - defaultImage: {type: "image", x: 0, y: 0, width: 0, height: 0, src: ""}, - defaultText: {type: "text", x: 0, y: 0, text: "", - align: "start", decoration: "none", rotated: false, kerning: true }, - defaultTextPath: {type: "textpath", text: "", - align: "start", decoration: "none", rotated: false, kerning: true }, - - // default geometric attributes - defaultStroke: {type: "stroke", color: "black", style: "solid", width: 1, cap: "butt", join: 4}, - defaultLinearGradient: {type: "linear", x1: 0, y1: 0, x2: 100, y2: 100, - colors: [{offset: 0, color: "black"}, {offset: 1, color: "white"}]}, - defaultRadialGradient: {type: "radial", cx: 0, cy: 0, r: 100, - colors: [{offset: 0, color: "black"}, {offset: 1, color: "white"}]}, - defaultPattern: {type: "pattern", x: 0, y: 0, width: 0, height: 0, src: ""}, - defaultFont: {type: "font", style: "normal", variant: "normal", weight: "normal", - size: "10pt", family: "serif"}, - - normalizeColor: function(/*Color*/ color){ - // summary: converts any legal color representation to normalized dojo.Color object - return (color instanceof dojo.Color) ? color : new dojo.Color(color); // dojo.Color - }, - normalizeParameters: function(existed, update){ - // summary: updates an existing object with properties from an "update" object - // existed: Object: the "target" object to be updated - // update: Object: the "update" object, whose properties will be used to update the existed object - if(update){ - var empty = {}; - for(var x in existed){ - if(x in update && !(x in empty)){ - existed[x] = update[x]; - } - } - } - return existed; // Object - }, - makeParameters: function(defaults, update){ - // summary: copies the original object, and all copied properties from the "update" object - // defaults: Object: the object to be cloned before updating - // update: Object: the object, which properties are to be cloned during updating - if(!update) return dojo.clone(defaults); - var result = {}; - for(var i in defaults){ - if(!(i in result)){ - result[i] = dojo.clone((i in update) ? update[i] : defaults[i]); - } - } - return result; // Object - }, - formatNumber: function(x, addSpace){ - // summary: converts a number to a string using a fixed notation - // x: Number: number to be converted - // addSpace: Boolean?: if it is true, add a space before a positive number - var val = x.toString(); - if(val.indexOf("e") >= 0){ - val = x.toFixed(4); - }else{ - var point = val.indexOf("."); - if(point >= 0 && val.length - point > 5){ - val = x.toFixed(4); - } - } - if(x < 0){ - return val; // String - } - return addSpace ? " " + val : val; // String - }, - // font operations - makeFontString: function(font){ - // summary: converts a font object to a CSS font string - // font: Object: font object (see dojox.gfx.defaultFont) - return font.style + " " + font.variant + " " + font.weight + " " + font.size + " " + font.family; // Object - }, - splitFontString: function(str){ - // summary: converts a CSS font string to a font object - // str: String: a CSS font string - var font = dojo.clone(dojox.gfx.defaultFont); - var t = str.split(/\s+/); - do{ - if(t.length < 5){ break; } - font.style = t[0]; - font.varian = t[1]; - font.weight = t[2]; - var i = t[3].indexOf("/"); - font.size = i < 0 ? t[3] : t[3].substring(0, i); - var j = 4; - if(i < 0){ - if(t[4] == "/"){ - j = 6; - break; - } - if(t[4].substr(0, 1) == "/"){ - j = 5; - break; - } - } - if(j + 3 > t.length){ break; } - font.size = t[j]; - font.family = t[j + 1]; - }while(false); - return font; // Object - }, - // length operations - cm_in_pt: 72 / 2.54, // Number: points per centimeter - mm_in_pt: 7.2 / 2.54, // Number: points per millimeter - px_in_pt: function(){ - // summary: returns a number of pixels per point - return dojox.gfx._base._getCachedFontMeasurements()["12pt"] / 12; // Number - }, - pt2px: function(len){ - // summary: converts points to pixels - // len: Number: a value in points - return len * dojox.gfx.px_in_pt(); // Number - }, - px2pt: function(len){ - // summary: converts pixels to points - // len: Number: a value in pixels - return len / dojox.gfx.px_in_pt(); // Number - }, - normalizedLength: function(len) { - // summary: converts any length value to pixels - // len: String: a length, e.g., "12pc" - if(len.length == 0) return 0; - if(len.length > 2){ - var px_in_pt = dojox.gfx.px_in_pt(); - var val = parseFloat(len); - switch(len.slice(-2)){ - case "px": return val; - case "pt": return val * px_in_pt; - case "in": return val * 72 * px_in_pt; - case "pc": return val * 12 * px_in_pt; - case "mm": return val * dojox.gfx.mm_in_pt * px_in_pt; - case "cm": return val * dojox.gfx.cm_in_pt * px_in_pt; - } - } - return parseFloat(len); // Number - }, - - // a constant used to split a SVG/VML path into primitive components - pathVmlRegExp: /([A-Za-z]+)|(\d+(\.\d+)?)|(\.\d+)|(-\d+(\.\d+)?)|(-\.\d+)/g, - pathSvgRegExp: /([A-Za-z])|(\d+(\.\d+)?)|(\.\d+)|(-\d+(\.\d+)?)|(-\.\d+)/g, - - equalSources: function(a, b){ - // summary: compares event sources, returns true if they are equal - return a && b && a == b; - } -}); - -} - -if(!dojo._hasResource["dojox.gfx"]){ //_hasResource checks added by build. Do not use _hasResource directly in your code. -dojo._hasResource["dojox.gfx"] = true; -dojo.provide("dojox.gfx"); - - - - -dojo.loadInit(function(){ - //Since loaderInit can be fired before any dojo.provide/require calls, - //make sure the dojox.gfx object exists and only run this logic if dojox.gfx.renderer - //has not been defined yet. - var gfx = dojo.getObject("dojox.gfx", true), sl, flag, match; - if(!gfx.renderer){ - var renderers = (typeof dojo.config.gfxRenderer == "string" ? - dojo.config.gfxRenderer : "svg,vml,silverlight,canvas").split(","); - - // mobile platform detection - // TODO: move to the base? - - var ua = navigator.userAgent, iPhoneOsBuild = 0, androidVersion = 0; - if(dojo.isSafari >= 3){ - // detect mobile version of WebKit starting with "version 3" - - // comprehensive iPhone test. Have to figure out whether it's SVG or Canvas based on the build. - // iPhone OS build numbers from en.wikipedia.org. - if(ua.indexOf("iPhone") >= 0 || ua.indexOf("iPod") >= 0){ - // grab the build out of this. Expression is a little nasty because we want - // to be sure we have the whole version string. - match = ua.match(/Version\/(\d(\.\d)?(\.\d)?)\sMobile\/([^\s]*)\s?/); - if(match){ - // grab the build out of the match. Only use the first three because of specific builds. - iPhoneOsBuild = parseInt(match[4].substr(0,3), 16); - } - } - } - if(dojo.isWebKit){ - // Android detection - if(!iPhoneOsBuild){ - match = ua.match(/Android\s+(\d+\.\d+)/); - if(match){ - androidVersion = parseFloat(match[1]); - // Android 1.0-1.1 doesn't support SVG but supports Canvas - } - } - } - - for(var i = 0; i < renderers.length; ++i){ - switch(renderers[i]){ - case "svg": - // iPhone OS builds greater than 5F1 should have SVG. - if(!dojo.isIE && (!iPhoneOsBuild || iPhoneOsBuild >= 0x5f1) && !androidVersion && !dojo.isAIR){ - dojox.gfx.renderer = "svg"; - } - break; - case "vml": - if(dojo.isIE){ - dojox.gfx.renderer = "vml"; - } - break; - case "silverlight": - try{ - if(dojo.isIE){ - sl = new ActiveXObject("AgControl.AgControl"); - if(sl && sl.IsVersionSupported("1.0")){ - flag = true; - } - }else{ - if(navigator.plugins["Silverlight Plug-In"]){ - flag = true; - } - } - }catch(e){ - flag = false; - }finally{ - sl = null; - } - if(flag){ dojox.gfx.renderer = "silverlight"; } - break; - case "canvas": - //TODO: need more comprehensive test for Canvas - if(!dojo.isIE){ - dojox.gfx.renderer = "canvas"; - } - break; - } - if(dojox.gfx.renderer){ break; } - } - if(dojo.config.isDebug){ - - } - } -}); - -// include a renderer conditionally -dojo.requireIf(dojox.gfx.renderer == "svg", "dojox.gfx.svg"); -dojo.requireIf(dojox.gfx.renderer == "vml", "dojox.gfx.vml"); -dojo.requireIf(dojox.gfx.renderer == "silverlight", "dojox.gfx.silverlight"); -dojo.requireIf(dojox.gfx.renderer == "canvas", "dojox.gfx.canvas"); - -} - -if(!dojo._hasResource["dojox.lang.functional.lambda"]){ //_hasResource checks added by build. Do not use _hasResource directly in your code. -dojo._hasResource["dojox.lang.functional.lambda"] = true; -dojo.provide("dojox.lang.functional.lambda"); - -// This module adds high-level functions and related constructs: -// - anonymous functions built from the string - -// Acknoledgements: -// - lambda() is based on work by Oliver Steele -// (http://osteele.com/sources/javascript/functional/functional.js) -// which was published under MIT License - -// Notes: -// - lambda() produces functions, which after the compilation step are -// as fast as regular JS functions (at least theoretically). - -// Lambda input values: -// - returns functions unchanged -// - converts strings to functions -// - converts arrays to a functional composition - -(function(){ - var df = dojox.lang.functional, lcache = {}; - - // split() is augmented on IE6 to ensure the uniform behavior - var split = "ab".split(/a*/).length > 1 ? String.prototype.split : - function(sep){ - var r = this.split.call(this, sep), - m = sep.exec(this); - if(m && m.index == 0){ r.unshift(""); } - return r; - }; - - var lambda = function(/*String*/ s){ - var args = [], sects = split.call(s, /\s*->\s*/m); - if(sects.length > 1){ - while(sects.length){ - s = sects.pop(); - args = sects.pop().split(/\s*,\s*|\s+/m); - if(sects.length){ sects.push("(function(" + args + "){return (" + s + ")})"); } - } - }else if(s.match(/\b_\b/)){ - args = ["_"]; - }else{ - var l = s.match(/^\s*(?:[+*\/%&|\^\.=<>]|!=)/m), - r = s.match(/[+\-*\/%&|\^\.=<>!]\s*$/m); - if(l || r){ - if(l){ - args.push("$1"); - s = "$1" + s; - } - if(r){ - args.push("$2"); - s = s + "$2"; - } - }else{ - // the point of the long regex below is to exclude all well-known - // lower-case words from the list of potential arguments - var vars = s. - replace(/(?:\b[A-Z]|\.[a-zA-Z_$])[a-zA-Z_$\d]*|[a-zA-Z_$][a-zA-Z_$\d]*:|this|true|false|null|undefined|typeof|instanceof|in|delete|new|void|arguments|decodeURI|decodeURIComponent|encodeURI|encodeURIComponent|escape|eval|isFinite|isNaN|parseFloat|parseInt|unescape|dojo|dijit|dojox|window|document|'(?:[^'\\]|\\.)*'|"(?:[^"\\]|\\.)*"/g, ""). - match(/([a-z_$][a-z_$\d]*)/gi) || [], t = {}; - dojo.forEach(vars, function(v){ - if(!(v in t)){ - args.push(v); - t[v] = 1; - } - }); - } - } - return {args: args, body: s}; // Object - }; - - var compose = function(/*Array*/ a){ - return a.length ? - function(){ - var i = a.length - 1, x = df.lambda(a[i]).apply(this, arguments); - for(--i; i >= 0; --i){ x = df.lambda(a[i]).call(this, x); } - return x; - } - : - // identity - function(x){ return x; }; - }; - - dojo.mixin(df, { - // lambda - rawLambda: function(/*String*/ s){ - // summary: - // builds a function from a snippet, or array (composing), - // returns an object describing the function; functions are - // passed through unmodified. - // description: - // This method is to normalize a functional representation (a - // text snippet) to an object that contains an array of - // arguments, and a body , which is used to calculate the - // returning value. - return lambda(s); // Object - }, - buildLambda: function(/*String*/ s){ - // summary: - // builds a function from a snippet, returns a string, which - // represents the function. - // description: - // This method returns a textual representation of a function - // built from the snippet. It is meant to be evaled in the - // proper context, so local variables can be pulled from the - // environment. - s = lambda(s); - return "function(" + s.args.join(",") + "){return (" + s.body + ");}"; // String - }, - lambda: function(/*Function|String|Array*/ s){ - // summary: - // builds a function from a snippet, or array (composing), - // returns a function object; functions are passed through - // unmodified. - // description: - // This method is used to normalize a functional - // representation (a text snippet, an array, or a function) to - // a function object. - if(typeof s == "function"){ return s; } - if(s instanceof Array){ return compose(s); } - if(s in lcache){ return lcache[s]; } - s = lambda(s); - return lcache[s] = new Function(s.args, "return (" + s.body + ");"); // Function - }, - clearLambdaCache: function(){ - // summary: - // clears internal cache of lambdas - lcache = {}; - } - }); -})(); - -} - -if(!dojo._hasResource["dojox.lang.functional.array"]){ //_hasResource checks added by build. Do not use _hasResource directly in your code. -dojo._hasResource["dojox.lang.functional.array"] = true; -dojo.provide("dojox.lang.functional.array"); - - - -// This module adds high-level functions and related constructs: -// - array-processing functions similar to standard JS functions - -// Notes: -// - this module provides JS standard methods similar to high-level functions in dojo/_base/array.js: -// forEach, map, filter, every, some - -// Defined methods: -// - take any valid lambda argument as the functional argument -// - operate on dense arrays -// - take a string as the array argument -// - take an iterator objects as the array argument - -(function(){ - var d = dojo, df = dojox.lang.functional, empty = {}; - - d.mixin(df, { - // JS 1.6 standard array functions, which can take a lambda as a parameter. - // Consider using dojo._base.array functions, if you don't need the lambda support. - filter: function(/*Array|String|Object*/ a, /*Function|String|Array*/ f, /*Object?*/ o){ - // summary: creates a new array with all elements that pass the test - // implemented by the provided function. - if(typeof a == "string"){ a = a.split(""); } - o = o || d.global; f = df.lambda(f); - var t = [], v, i, n; - if(d.isArray(a)){ - // array - for(i = 0, n = a.length; i < n; ++i){ - v = a[i]; - if(f.call(o, v, i, a)){ t.push(v); } - } - }else if(typeof a.hasNext == "function" && typeof a.next == "function"){ - // iterator - for(i = 0; a.hasNext();){ - v = a.next(); - if(f.call(o, v, i++, a)){ t.push(v); } - } - }else{ - // object/dictionary - for(i in a){ - if(!(i in empty)){ - v = a[i]; - if(f.call(o, v, i, a)){ t.push(v); } - } - } - } - return t; // Array - }, - forEach: function(/*Array|String|Object*/ a, /*Function|String|Array*/ f, /*Object?*/ o){ - // summary: executes a provided function once per array element. - if(typeof a == "string"){ a = a.split(""); } - o = o || d.global; f = df.lambda(f); - var i, n; - if(d.isArray(a)){ - // array - for(i = 0, n = a.length; i < n; f.call(o, a[i], i, a), ++i); - }else if(typeof a.hasNext == "function" && typeof a.next == "function"){ - // iterator - for(i = 0; a.hasNext(); f.call(o, a.next(), i++, a)); - }else{ - // object/dictionary - for(i in a){ - if(!(i in empty)){ - f.call(o, a[i], i, a); - } - } - } - return o; // Object - }, - map: function(/*Array|String|Object*/ a, /*Function|String|Array*/ f, /*Object?*/ o){ - // summary: creates a new array with the results of calling - // a provided function on every element in this array. - if(typeof a == "string"){ a = a.split(""); } - o = o || d.global; f = df.lambda(f); - var t, n, i; - if(d.isArray(a)){ - // array - t = new Array(n = a.length); - for(i = 0; i < n; t[i] = f.call(o, a[i], i, a), ++i); - }else if(typeof a.hasNext == "function" && typeof a.next == "function"){ - // iterator - t = []; - for(i = 0; a.hasNext(); t.push(f.call(o, a.next(), i++, a))); - }else{ - // object/dictionary - t = []; - for(i in a){ - if(!(i in empty)){ - t.push(f.call(o, a[i], i, a)); - } - } - } - return t; // Array - }, - every: function(/*Array|String|Object*/ a, /*Function|String|Array*/ f, /*Object?*/ o){ - // summary: tests whether all elements in the array pass the test - // implemented by the provided function. - if(typeof a == "string"){ a = a.split(""); } - o = o || d.global; f = df.lambda(f); - var i, n; - if(d.isArray(a)){ - // array - for(i = 0, n = a.length; i < n; ++i){ - if(!f.call(o, a[i], i, a)){ - return false; // Boolean - } - } - }else if(typeof a.hasNext == "function" && typeof a.next == "function"){ - // iterator - for(i = 0; a.hasNext();){ - if(!f.call(o, a.next(), i++, a)){ - return false; // Boolean - } - } - }else{ - // object/dictionary - for(i in a){ - if(!(i in empty)){ - if(!f.call(o, a[i], i, a)){ - return false; // Boolean - } - } - } - } - return true; // Boolean - }, - some: function(/*Array|String|Object*/ a, /*Function|String|Array*/ f, /*Object?*/ o){ - // summary: tests whether some element in the array passes the test - // implemented by the provided function. - if(typeof a == "string"){ a = a.split(""); } - o = o || d.global; f = df.lambda(f); - var i, n; - if(d.isArray(a)){ - // array - for(i = 0, n = a.length; i < n; ++i){ - if(f.call(o, a[i], i, a)){ - return true; // Boolean - } - } - }else if(typeof a.hasNext == "function" && typeof a.next == "function"){ - // iterator - for(i = 0; a.hasNext();){ - if(f.call(o, a.next(), i++, a)){ - return true; // Boolean - } - } - }else{ - // object/dictionary - for(i in a){ - if(!(i in empty)){ - if(f.call(o, a[i], i, a)){ - return true; // Boolean - } - } - } - } - return false; // Boolean - } - }); -})(); - -} - -if(!dojo._hasResource["dojox.lang.functional.object"]){ //_hasResource checks added by build. Do not use _hasResource directly in your code. -dojo._hasResource["dojox.lang.functional.object"] = true; -dojo.provide("dojox.lang.functional.object"); - - - -// This module adds high-level functions and related constructs: -// - object/dictionary helpers - -// Defined methods: -// - take any valid lambda argument as the functional argument -// - skip all attributes that are present in the empty object -// (IE and/or 3rd-party libraries). - -(function(){ - var d = dojo, df = dojox.lang.functional, empty = {}; - - d.mixin(df, { - // object helpers - keys: function(/*Object*/ obj){ - // summary: returns an array of all keys in the object - var t = []; - for(var i in obj){ - if(!(i in empty)){ - t.push(i); - } - } - return t; // Array - }, - values: function(/*Object*/ obj){ - // summary: returns an array of all values in the object - var t = []; - for(var i in obj){ - if(!(i in empty)){ - t.push(obj[i]); - } - } - return t; // Array - }, - filterIn: function(/*Object*/ obj, /*Function|String|Array*/ f, /*Object?*/ o){ - // summary: creates new object with all attributes that pass the test - // implemented by the provided function. - o = o || d.global; f = df.lambda(f); - var t = {}, v, i; - for(i in obj){ - if(!(i in empty)){ - v = obj[i]; - if(f.call(o, v, i, obj)){ t[i] = v; } - } - } - return t; // Object - }, - forIn: function(/*Object*/ obj, /*Function|String|Array*/ f, /*Object?*/ o){ - // summary: iterates over all object attributes. - o = o || d.global; f = df.lambda(f); - for(var i in obj){ - if(!(i in empty)){ - f.call(o, obj[i], i, obj); - } - } - return o; // Object - }, - mapIn: function(/*Object*/ obj, /*Function|String|Array*/ f, /*Object?*/ o){ - // summary: creates new object with the results of calling - // a provided function on every attribute in this object. - o = o || d.global; f = df.lambda(f); - var t = {}, i; - for(i in obj){ - if(!(i in empty)){ - t[i] = f.call(o, obj[i], i, obj); - } - } - return t; // Object - } - }); -})(); - -} - -if(!dojo._hasResource["dojox.lang.functional"]){ //_hasResource checks added by build. Do not use _hasResource directly in your code. -dojo._hasResource["dojox.lang.functional"] = true; -dojo.provide("dojox.lang.functional"); - - - - - -} - -if(!dojo._hasResource["dojox.lang.functional.fold"]){ //_hasResource checks added by build. Do not use _hasResource directly in your code. -dojo._hasResource["dojox.lang.functional.fold"] = true; -dojo.provide("dojox.lang.functional.fold"); - - - -// This module adds high-level functions and related constructs: -// - "fold" family of functions - -// Notes: -// - missing high-level functions are provided with the compatible API: -// foldl, foldl1, foldr, foldr1 -// - missing JS standard functions are provided with the compatible API: -// reduce, reduceRight -// - the fold's counterpart: unfold - -// Defined methods: -// - take any valid lambda argument as the functional argument -// - operate on dense arrays -// - take a string as the array argument -// - take an iterator objects as the array argument (only foldl, foldl1, and reduce) - -(function(){ - var d = dojo, df = dojox.lang.functional, empty = {}; - - d.mixin(df, { - // classic reduce-class functions - foldl: function(/*Array|String|Object*/ a, /*Function*/ f, /*Object*/ z, /*Object?*/ o){ - // summary: repeatedly applies a binary function to an array from left - // to right using a seed value as a starting point; returns the final - // value. - if(typeof a == "string"){ a = a.split(""); } - o = o || d.global; f = df.lambda(f); - var i, n; - if(d.isArray(a)){ - // array - for(i = 0, n = a.length; i < n; z = f.call(o, z, a[i], i, a), ++i); - }else if(typeof a.hasNext == "function" && typeof a.next == "function"){ - // iterator - for(i = 0; a.hasNext(); z = f.call(o, z, a.next(), i++, a)); - }else{ - // object/dictionary - for(i in a){ - if(!(i in empty)){ - z = f.call(o, z, a[i], i, a); - } - } - } - return z; // Object - }, - foldl1: function(/*Array|String|Object*/ a, /*Function|String|Array*/ f, /*Object?*/ o){ - // summary: repeatedly applies a binary function to an array from left - // to right; returns the final value. - if(typeof a == "string"){ a = a.split(""); } - o = o || d.global; f = df.lambda(f); - var z, i, n; - if(d.isArray(a)){ - // array - z = a[0]; - for(i = 1, n = a.length; i < n; z = f.call(o, z, a[i], i, a), ++i); - }else if(typeof a.hasNext == "function" && typeof a.next == "function"){ - // iterator - if(a.hasNext()){ - z = a.next(); - for(i = 1; a.hasNext(); z = f.call(o, z, a.next(), i++, a)); - } - }else{ - // object/dictionary - var first = true; - for(i in a){ - if(!(i in empty)){ - if(first){ - z = a[i]; - first = false; - }else{ - z = f.call(o, z, a[i], i, a); - } - } - } - } - return z; // Object - }, - foldr: function(/*Array|String*/ a, /*Function|String|Array*/ f, /*Object*/ z, /*Object?*/ o){ - // summary: repeatedly applies a binary function to an array from right - // to left using a seed value as a starting point; returns the final - // value. - if(typeof a == "string"){ a = a.split(""); } - o = o || d.global; f = df.lambda(f); - for(var i = a.length; i > 0; --i, z = f.call(o, z, a[i], i, a)); - return z; // Object - }, - foldr1: function(/*Array|String*/ a, /*Function|String|Array*/ f, /*Object?*/ o){ - // summary: repeatedly applies a binary function to an array from right - // to left; returns the final value. - if(typeof a == "string"){ a = a.split(""); } - o = o || d.global; f = df.lambda(f); - var n = a.length, z = a[n - 1], i = n - 1; - for(; i > 0; --i, z = f.call(o, z, a[i], i, a)); - return z; // Object - }, - // JS 1.8 standard array functions, which can take a lambda as a parameter. - reduce: function(/*Array|String|Object*/ a, /*Function|String|Array*/ f, /*Object?*/ z){ - // summary: apply a function simultaneously against two values of the array - // (from left-to-right) as to reduce it to a single value. - return arguments.length < 3 ? df.foldl1(a, f) : df.foldl(a, f, z); // Object - }, - reduceRight: function(/*Array|String*/ a, /*Function|String|Array*/ f, /*Object?*/ z){ - // summary: apply a function simultaneously against two values of the array - // (from right-to-left) as to reduce it to a single value. - return arguments.length < 3 ? df.foldr1(a, f) : df.foldr(a, f, z); // Object - }, - // the fold's counterpart: unfold - unfold: function(/*Function|String|Array*/ pr, /*Function|String|Array*/ f, - /*Function|String|Array*/ g, /*Object*/ z, /*Object?*/ o){ - // summary: builds an array by unfolding a value - o = o || d.global; f = df.lambda(f); g = df.lambda(g); pr = df.lambda(pr); - var t = []; - for(; !pr.call(o, z); t.push(f.call(o, z)), z = g.call(o, z)); - return t; // Array - } - }); -})(); - -} - -if(!dojo._hasResource["dojox.lang.functional.reversed"]){ //_hasResource checks added by build. Do not use _hasResource directly in your code. -dojo._hasResource["dojox.lang.functional.reversed"] = true; -dojo.provide("dojox.lang.functional.reversed"); - - - -// This module adds high-level functions and related constructs: -// - reversed versions of array-processing functions similar to standard JS functions - -// Notes: -// - this module provides reversed versions of standard array-processing functions: -// forEachRev, mapRev, filterRev - -// Defined methods: -// - take any valid lambda argument as the functional argument -// - operate on dense arrays -// - take a string as the array argument - -(function(){ - var d = dojo, df = dojox.lang.functional; - - d.mixin(df, { - // JS 1.6 standard array functions, which can take a lambda as a parameter. - // Consider using dojo._base.array functions, if you don't need the lambda support. - filterRev: function(/*Array|String*/ a, /*Function|String|Array*/ f, /*Object?*/ o){ - // summary: creates a new array with all elements that pass the test - // implemented by the provided function. - if(typeof a == "string"){ a = a.split(""); } - o = o || d.global; f = df.lambda(f); - var t = [], v, i = a.length - 1; - for(; i >= 0; --i){ - v = a[i]; - if(f.call(o, v, i, a)){ t.push(v); } - } - return t; // Array - }, - forEachRev: function(/*Array|String*/ a, /*Function|String|Array*/ f, /*Object?*/ o){ - // summary: executes a provided function once per array element. - if(typeof a == "string"){ a = a.split(""); } - o = o || d.global; f = df.lambda(f); - for(var i = a.length - 1; i >= 0; f.call(o, a[i], i, a), --i); - }, - mapRev: function(/*Array|String*/ a, /*Function|String|Array*/ f, /*Object?*/ o){ - // summary: creates a new array with the results of calling - // a provided function on every element in this array. - if(typeof a == "string"){ a = a.split(""); } - o = o || d.global; f = df.lambda(f); - var n = a.length, t = new Array(n), i = n - 1, j = 0; - for(; i >= 0; t[j++] = f.call(o, a[i], i, a), --i); - return t; // Array - }, - everyRev: function(/*Array|String*/ a, /*Function|String|Array*/ f, /*Object?*/ o){ - // summary: tests whether all elements in the array pass the test - // implemented by the provided function. - if(typeof a == "string"){ a = a.split(""); } - o = o || d.global; f = df.lambda(f); - for(var i = a.length - 1; i >= 0; --i){ - if(!f.call(o, a[i], i, a)){ - return false; // Boolean - } - } - return true; // Boolean - }, - someRev: function(/*Array|String*/ a, /*Function|String|Array*/ f, /*Object?*/ o){ - // summary: tests whether some element in the array passes the test - // implemented by the provided function. - if(typeof a == "string"){ a = a.split(""); } - o = o || d.global; f = df.lambda(f); - for(var i = a.length - 1; i >= 0; --i){ - if(f.call(o, a[i], i, a)){ - return true; // Boolean - } - } - return false; // Boolean - } - }); -})(); - -} - -if(!dojo._hasResource["dojo.colors"]){ //_hasResource checks added by build. Do not use _hasResource directly in your code. -dojo._hasResource["dojo.colors"] = true; -dojo.provide("dojo.colors"); - -//TODO: this module appears to break naming conventions - -/*===== -dojo.colors = { - // summary: Color utilities -} -=====*/ - -(function(){ - // this is a standard conversion prescribed by the CSS3 Color Module - var hue2rgb = function(m1, m2, h){ - if(h < 0){ ++h; } - if(h > 1){ --h; } - var h6 = 6 * h; - if(h6 < 1){ return m1 + (m2 - m1) * h6; } - if(2 * h < 1){ return m2; } - if(3 * h < 2){ return m1 + (m2 - m1) * (2 / 3 - h) * 6; } - return m1; - }; - - dojo.colorFromRgb = function(/*String*/ color, /*dojo.Color?*/ obj){ - // summary: - // get rgb(a) array from css-style color declarations - // description: - // this function can handle all 4 CSS3 Color Module formats: rgb, - // rgba, hsl, hsla, including rgb(a) with percentage values. - var m = color.toLowerCase().match(/^(rgba?|hsla?)\(([\s\.\-,%0-9]+)\)/); - if(m){ - var c = m[2].split(/\s*,\s*/), l = c.length, t = m[1], a; - if((t == "rgb" && l == 3) || (t == "rgba" && l == 4)){ - var r = c[0]; - if(r.charAt(r.length - 1) == "%"){ - // 3 rgb percentage values - a = dojo.map(c, function(x){ - return parseFloat(x) * 2.56; - }); - if(l == 4){ a[3] = c[3]; } - return dojo.colorFromArray(a, obj); // dojo.Color - } - return dojo.colorFromArray(c, obj); // dojo.Color - } - if((t == "hsl" && l == 3) || (t == "hsla" && l == 4)){ - // normalize hsl values - var H = ((parseFloat(c[0]) % 360) + 360) % 360 / 360, - S = parseFloat(c[1]) / 100, - L = parseFloat(c[2]) / 100, - // calculate rgb according to the algorithm - // recommended by the CSS3 Color Module - m2 = L <= 0.5 ? L * (S + 1) : L + S - L * S, - m1 = 2 * L - m2; - a = [ - hue2rgb(m1, m2, H + 1 / 3) * 256, - hue2rgb(m1, m2, H) * 256, - hue2rgb(m1, m2, H - 1 / 3) * 256, - 1 - ]; - if(l == 4){ a[3] = c[3]; } - return dojo.colorFromArray(a, obj); // dojo.Color - } - } - return null; // dojo.Color - }; - - var confine = function(c, low, high){ - // summary: - // sanitize a color component by making sure it is a number, - // and clamping it to valid values - c = Number(c); - return isNaN(c) ? high : c < low ? low : c > high ? high : c; // Number - }; - - dojo.Color.prototype.sanitize = function(){ - // summary: makes sure that the object has correct attributes - var t = this; - t.r = Math.round(confine(t.r, 0, 255)); - t.g = Math.round(confine(t.g, 0, 255)); - t.b = Math.round(confine(t.b, 0, 255)); - t.a = confine(t.a, 0, 1); - return this; // dojo.Color - }; -})(); - - -dojo.colors.makeGrey = function(/*Number*/ g, /*Number?*/ a){ - // summary: creates a greyscale color with an optional alpha - return dojo.colorFromArray([g, g, g, a]); -}; - -// mixin all CSS3 named colors not already in _base, along with SVG 1.0 variant spellings -dojo.mixin(dojo.Color.named, { - aliceblue: [240,248,255], - antiquewhite: [250,235,215], - aquamarine: [127,255,212], - azure: [240,255,255], - beige: [245,245,220], - bisque: [255,228,196], - blanchedalmond: [255,235,205], - blueviolet: [138,43,226], - brown: [165,42,42], - burlywood: [222,184,135], - cadetblue: [95,158,160], - chartreuse: [127,255,0], - chocolate: [210,105,30], - coral: [255,127,80], - cornflowerblue: [100,149,237], - cornsilk: [255,248,220], - crimson: [220,20,60], - cyan: [0,255,255], - darkblue: [0,0,139], - darkcyan: [0,139,139], - darkgoldenrod: [184,134,11], - darkgray: [169,169,169], - darkgreen: [0,100,0], - darkgrey: [169,169,169], - darkkhaki: [189,183,107], - darkmagenta: [139,0,139], - darkolivegreen: [85,107,47], - darkorange: [255,140,0], - darkorchid: [153,50,204], - darkred: [139,0,0], - darksalmon: [233,150,122], - darkseagreen: [143,188,143], - darkslateblue: [72,61,139], - darkslategray: [47,79,79], - darkslategrey: [47,79,79], - darkturquoise: [0,206,209], - darkviolet: [148,0,211], - deeppink: [255,20,147], - deepskyblue: [0,191,255], - dimgray: [105,105,105], - dimgrey: [105,105,105], - dodgerblue: [30,144,255], - firebrick: [178,34,34], - floralwhite: [255,250,240], - forestgreen: [34,139,34], - gainsboro: [220,220,220], - ghostwhite: [248,248,255], - gold: [255,215,0], - goldenrod: [218,165,32], - greenyellow: [173,255,47], - grey: [128,128,128], - honeydew: [240,255,240], - hotpink: [255,105,180], - indianred: [205,92,92], - indigo: [75,0,130], - ivory: [255,255,240], - khaki: [240,230,140], - lavender: [230,230,250], - lavenderblush: [255,240,245], - lawngreen: [124,252,0], - lemonchiffon: [255,250,205], - lightblue: [173,216,230], - lightcoral: [240,128,128], - lightcyan: [224,255,255], - lightgoldenrodyellow: [250,250,210], - lightgray: [211,211,211], - lightgreen: [144,238,144], - lightgrey: [211,211,211], - lightpink: [255,182,193], - lightsalmon: [255,160,122], - lightseagreen: [32,178,170], - lightskyblue: [135,206,250], - lightslategray: [119,136,153], - lightslategrey: [119,136,153], - lightsteelblue: [176,196,222], - lightyellow: [255,255,224], - limegreen: [50,205,50], - linen: [250,240,230], - magenta: [255,0,255], - mediumaquamarine: [102,205,170], - mediumblue: [0,0,205], - mediumorchid: [186,85,211], - mediumpurple: [147,112,219], - mediumseagreen: [60,179,113], - mediumslateblue: [123,104,238], - mediumspringgreen: [0,250,154], - mediumturquoise: [72,209,204], - mediumvioletred: [199,21,133], - midnightblue: [25,25,112], - mintcream: [245,255,250], - mistyrose: [255,228,225], - moccasin: [255,228,181], - navajowhite: [255,222,173], - oldlace: [253,245,230], - olivedrab: [107,142,35], - orange: [255,165,0], - orangered: [255,69,0], - orchid: [218,112,214], - palegoldenrod: [238,232,170], - palegreen: [152,251,152], - paleturquoise: [175,238,238], - palevioletred: [219,112,147], - papayawhip: [255,239,213], - peachpuff: [255,218,185], - peru: [205,133,63], - pink: [255,192,203], - plum: [221,160,221], - powderblue: [176,224,230], - rosybrown: [188,143,143], - royalblue: [65,105,225], - saddlebrown: [139,69,19], - salmon: [250,128,114], - sandybrown: [244,164,96], - seagreen: [46,139,87], - seashell: [255,245,238], - sienna: [160,82,45], - skyblue: [135,206,235], - slateblue: [106,90,205], - slategray: [112,128,144], - slategrey: [112,128,144], - snow: [255,250,250], - springgreen: [0,255,127], - steelblue: [70,130,180], - tan: [210,180,140], - thistle: [216,191,216], - tomato: [255,99,71], - transparent: [0, 0, 0, 0], - turquoise: [64,224,208], - violet: [238,130,238], - wheat: [245,222,179], - whitesmoke: [245,245,245], - yellowgreen: [154,205,50] -}); - -} - -if(!dojo._hasResource["dojox.color._base"]){ //_hasResource checks added by build. Do not use _hasResource directly in your code. -dojo._hasResource["dojox.color._base"] = true; -dojo.provide("dojox.color._base"); - - -// alias all the dojo.Color mechanisms -dojox.color.Color=dojo.Color; -dojox.color.blend=dojo.blendColors; -dojox.color.fromRgb=dojo.colorFromRgb; -dojox.color.fromHex=dojo.colorFromHex; -dojox.color.fromArray=dojo.colorFromArray; -dojox.color.fromString=dojo.colorFromString; - -// alias the dojo.colors mechanisms -dojox.color.greyscale=dojo.colors.makeGrey; - -// static methods -dojo.mixin(dojox.color, { - fromCmy: function(/* Object|Array|int */cyan, /*int*/magenta, /*int*/yellow){ - // summary - // Create a dojox.color.Color from a CMY defined color. - // All colors should be expressed as 0-100 (percentage) - - if(dojo.isArray(cyan)){ - magenta=cyan[1], yellow=cyan[2], cyan=cyan[0]; - } else if(dojo.isObject(cyan)){ - magenta=cyan.m, yellow=cyan.y, cyan=cyan.c; - } - cyan/=100, magenta/=100, yellow/=100; - - var r=1-cyan, g=1-magenta, b=1-yellow; - return new dojox.color.Color({ r:Math.round(r*255), g:Math.round(g*255), b:Math.round(b*255) }); // dojox.color.Color - }, - - fromCmyk: function(/* Object|Array|int */cyan, /*int*/magenta, /*int*/yellow, /*int*/black){ - // summary - // Create a dojox.color.Color from a CMYK defined color. - // All colors should be expressed as 0-100 (percentage) - - if(dojo.isArray(cyan)){ - magenta=cyan[1], yellow=cyan[2], black=cyan[3], cyan=cyan[0]; - } else if(dojo.isObject(cyan)){ - magenta=cyan.m, yellow=cyan.y, black=cyan.b, cyan=cyan.c; - } - cyan/=100, magenta/=100, yellow/=100, black/=100; - var r,g,b; - r = 1-Math.min(1, cyan*(1-black)+black); - g = 1-Math.min(1, magenta*(1-black)+black); - b = 1-Math.min(1, yellow*(1-black)+black); - return new dojox.color.Color({ r:Math.round(r*255), g:Math.round(g*255), b:Math.round(b*255) }); // dojox.color.Color - }, - - fromHsl: function(/* Object|Array|int */hue, /* int */saturation, /* int */luminosity){ - // summary - // Create a dojox.color.Color from an HSL defined color. - // hue from 0-359 (degrees), saturation and luminosity 0-100. - - if(dojo.isArray(hue)){ - saturation=hue[1], luminosity=hue[2], hue=hue[0]; - } else if(dojo.isObject(hue)){ - saturation=hue.s, luminosity=hue.l, hue=hue.h; - } - saturation/=100; - luminosity/=100; - - while(hue<0){ hue+=360; } - while(hue>=360){ hue-=360; } - - var r, g, b; - if(hue<120){ - r=(120-hue)/60, g=hue/60, b=0; - } else if (hue<240){ - r=0, g=(240-hue)/60, b=(hue-120)/60; - } else { - r=(hue-240)/60, g=0, b=(360-hue)/60; - } - - r=2*saturation*Math.min(r, 1)+(1-saturation); - g=2*saturation*Math.min(g, 1)+(1-saturation); - b=2*saturation*Math.min(b, 1)+(1-saturation); - if(luminosity<0.5){ - r*=luminosity, g*=luminosity, b*=luminosity; - }else{ - r=(1-luminosity)*r+2*luminosity-1; - g=(1-luminosity)*g+2*luminosity-1; - b=(1-luminosity)*b+2*luminosity-1; - } - return new dojox.color.Color({ r:Math.round(r*255), g:Math.round(g*255), b:Math.round(b*255) }); // dojox.color.Color - }, - - fromHsv: function(/* Object|Array|int */hue, /* int */saturation, /* int */value){ - // summary - // Create a dojox.color.Color from an HSV defined color. - // hue from 0-359 (degrees), saturation and value 0-100. - - if(dojo.isArray(hue)){ - saturation=hue[1], value=hue[2], hue=hue[0]; - } else if (dojo.isObject(hue)){ - saturation=hue.s, value=hue.v, hue=hue.h; - } - - if(hue==360){ hue=0; } - saturation/=100; - value/=100; - - var r, g, b; - if(saturation==0){ - r=value, b=value, g=value; - }else{ - var hTemp=hue/60, i=Math.floor(hTemp), f=hTemp-i; - var p=value*(1-saturation); - var q=value*(1-(saturation*f)); - var t=value*(1-(saturation*(1-f))); - switch(i){ - case 0:{ r=value, g=t, b=p; break; } - case 1:{ r=q, g=value, b=p; break; } - case 2:{ r=p, g=value, b=t; break; } - case 3:{ r=p, g=q, b=value; break; } - case 4:{ r=t, g=p, b=value; break; } - case 5:{ r=value, g=p, b=q; break; } - } - } - return new dojox.color.Color({ r:Math.round(r*255), g:Math.round(g*255), b:Math.round(b*255) }); // dojox.color.Color - } -}); - -// Conversions directly on dojox.color.Color -dojo.extend(dojox.color.Color, { - toCmy: function(){ - // summary - // Convert this Color to a CMY definition. - var cyan=1-(this.r/255), magenta=1-(this.g/255), yellow=1-(this.b/255); - return { c:Math.round(cyan*100), m:Math.round(magenta*100), y:Math.round(yellow*100) }; // Object - }, - - toCmyk: function(){ - // summary - // Convert this Color to a CMYK definition. - var cyan, magenta, yellow, black; - var r=this.r/255, g=this.g/255, b=this.b/255; - black = Math.min(1-r, 1-g, 1-b); - cyan = (1-r-black)/(1-black); - magenta = (1-g-black)/(1-black); - yellow = (1-b-black)/(1-black); - return { c:Math.round(cyan*100), m:Math.round(magenta*100), y:Math.round(yellow*100), b:Math.round(black*100) }; // Object - }, - - toHsl: function(){ - // summary - // Convert this Color to an HSL definition. - var r=this.r/255, g=this.g/255, b=this.b/255; - var min = Math.min(r, b, g), max = Math.max(r, g, b); - var delta = max-min; - var h=0, s=0, l=(min+max)/2; - if(l>0 && l<1){ - s = delta/((l<0.5)?(2*l):(2-2*l)); - } - if(delta>0){ - if(max==r && max!=g){ - h+=(g-b)/delta; - } - if(max==g && max!=b){ - h+=(2+(b-r)/delta); - } - if(max==b && max!=r){ - h+=(4+(r-g)/delta); - } - h*=60; - } - return { h:h, s:Math.round(s*100), l:Math.round(l*100) }; // Object - }, - - toHsv: function(){ - // summary - // Convert this Color to an HSV definition. - var r=this.r/255, g=this.g/255, b=this.b/255; - var min = Math.min(r, b, g), max = Math.max(r, g, b); - var delta = max-min; - var h = null, s = (max==0)?0:(delta/max); - if(s==0){ - h = 0; - }else{ - if(r==max){ - h = 60*(g-b)/delta; - }else if(g==max){ - h = 120 + 60*(b-r)/delta; - }else{ - h = 240 + 60*(r-g)/delta; - } - - if(h<0){ h+=360; } - } - return { h:h, s:Math.round(s*100), v:Math.round(max*100) }; // Object - } -}); - -} - -if(!dojo._hasResource["dojox.color"]){ //_hasResource checks added by build. Do not use _hasResource directly in your code. -dojo._hasResource["dojox.color"] = true; -dojo.provide("dojox.color"); - - -} - -if(!dojo._hasResource["dojox.color.Palette"]){ //_hasResource checks added by build. Do not use _hasResource directly in your code. -dojo._hasResource["dojox.color.Palette"] = true; -dojo.provide("dojox.color.Palette"); - - -(function(){ - var dxc = dojox.color; - /*************************************************************** - * dojox.color.Palette - * - * The Palette object is loosely based on the color palettes - * at Kuler (http://kuler.adobe.com). They are 5 color palettes - * with the base color considered to be the third color in the - * palette (for generation purposes). - * - * Palettes can be generated from well-known algorithms or they - * can be manually created by passing an array to the constructor. - * - * Palettes can be transformed, using a set of specific params - * similar to the way shapes can be transformed with dojox.gfx. - * However, unlike with transformations in dojox.gfx, transforming - * a palette will return you a new Palette object, in effect - * a clone of the original. - ***************************************************************/ - - // ctor ---------------------------------------------------------------------------- - dxc.Palette = function(/* String|Array|dojox.color.Color|dojox.color.Palette */base){ - // summary - // An object that represents a palette of colors. - // description - // A Palette is a representation of a set of colors. While the standard - // number of colors contained in a palette is 5, it can really handle any - // number of colors. - // - // A palette is useful for the ability to transform all the colors in it - // using a simple object-based approach. In addition, you can generate - // palettes using dojox.color.Palette.generate; these generated palettes - // are based on the palette generators at http://kuler.adobe.com. - // - // colors: dojox.color.Color[] - // The actual color references in this palette. - this.colors = []; - if(base instanceof dojox.color.Palette){ - this.colors = base.colors.slice(0); - } - else if(base instanceof dojox.color.Color){ - this.colors = [ null, null, base, null, null ]; - } - else if(dojo.isArray(base)){ - this.colors = dojo.map(base.slice(0), function(item){ - if(dojo.isString(item)){ return new dojox.color.Color(item); } - return item; - }); - } - else if (dojo.isString(base)){ - this.colors = [ null, null, new dojox.color.Color(base), null, null ]; - } - } - - // private functions --------------------------------------------------------------- - - // transformations - function tRGBA(p, param, val){ - var ret = new dojox.color.Palette(); - ret.colors = []; - dojo.forEach(p.colors, function(item){ - var r=(param=="dr")?item.r+val:item.r, - g=(param=="dg")?item.g+val:item.g, - b=(param=="db")?item.b+val:item.b, - a=(param=="da")?item.a+val:item.a - ret.colors.push(new dojox.color.Color({ - r: Math.min(255, Math.max(0, r)), - g: Math.min(255, Math.max(0, g)), - b: Math.min(255, Math.max(0, b)), - a: Math.min(1, Math.max(0, a)) - })); - }); - - return ret; - } - - function tCMY(p, param, val){ - var ret = new dojox.color.Palette(); - ret.colors = []; - dojo.forEach(p.colors, function(item){ - var o=item.toCmy(), - c=(param=="dc")?o.c+val:o.c, - m=(param=="dm")?o.m+val:o.m, - y=(param=="dy")?o.y+val:o.y; - ret.colors.push(dojox.color.fromCmy( - Math.min(100, Math.max(0, c)), - Math.min(100, Math.max(0, m)), - Math.min(100, Math.max(0, y)) - )); - }); - return ret; - } - - function tCMYK(p, param, val){ - var ret = new dojox.color.Palette(); - ret.colors = []; - dojo.forEach(p.colors, function(item){ - var o=item.toCmyk(), - c=(param=="dc")?o.c+val:o.c, - m=(param=="dm")?o.m+val:o.m, - y=(param=="dy")?o.y+val:o.y, - k=(param=="dk")?o.b+val:o.b; - ret.colors.push(dojox.color.fromCmyk( - Math.min(100, Math.max(0, c)), - Math.min(100, Math.max(0, m)), - Math.min(100, Math.max(0, y)), - Math.min(100, Math.max(0, k)) - )); - }); - return ret; - } - - function tHSL(p, param, val){ - var ret = new dojox.color.Palette(); - ret.colors = []; - dojo.forEach(p.colors, function(item){ - var o=item.toHsl(), - h=(param=="dh")?o.h+val:o.h, - s=(param=="ds")?o.s+val:o.s, - l=(param=="dl")?o.l+val:o.l; - ret.colors.push(dojox.color.fromHsl(h%360, Math.min(100, Math.max(0, s)), Math.min(100, Math.max(0, l)))); - }); - return ret; - } - - function tHSV(p, param, val){ - var ret = new dojox.color.Palette(); - ret.colors = []; - dojo.forEach(p.colors, function(item){ - var o=item.toHsv(), - h=(param=="dh")?o.h+val:o.h, - s=(param=="ds")?o.s+val:o.s, - v=(param=="dv")?o.v+val:o.v; - ret.colors.push(dojox.color.fromHsv(h%360, Math.min(100, Math.max(0, s)), Math.min(100, Math.max(0, v)))); - }); - return ret; - } - - // helper functions - function rangeDiff(val, low, high){ - // given the value in a range from 0 to high, find the equiv - // using the range low to high. - return high-((high-val)*((high-low)/high)); - } - - // object methods --------------------------------------------------------------- - dojo.extend(dxc.Palette, { - transform: function(/* Object */kwArgs){ - // summary - // Transform the palette using a specific transformation function - // and a set of transformation parameters. - // description - // {palette}.transform is a simple way to uniformly transform - // all of the colors in a palette using any of 5 formulae: - // RGBA, HSL, HSV, CMYK or CMY. - // - // Once the forumula to be used is determined, you can pass any - // number of parameters based on the formula "d"[param]; for instance, - // { use: "rgba", dr: 20, dg: -50 } will take all of the colors in - // palette, add 20 to the R value and subtract 50 from the G value. - // - // Unlike other types of transformations, transform does *not* alter - // the original palette but will instead return a new one. - var fn=tRGBA; // the default transform function. - if(kwArgs.use){ - // we are being specific about the algo we want to use. - var use=kwArgs.use.toLowerCase(); - if(use.indexOf("hs")==0){ - if(use.charAt(2)=="l"){ fn=tHSL; } - else { fn=tHSV; } - } - else if(use.indexOf("cmy")==0){ - if(use.charAt(3)=="k"){ fn=tCMYK; } - else { fn=tCMY; } - } - } - // try to guess the best choice. - else if("dc" in kwArgs || "dm" in kwArgs || "dy" in kwArgs){ - if("dk" in kwArgs){ fn = tCMYK; } - else { fn = tCMY; } - } - else if("dh" in kwArgs || "ds" in kwArgs){ - if("dv" in kwArgs){ fn = tHSV; } - else { fn = tHSL; } - } - - var palette = this; - for(var p in kwArgs){ - // ignore use - if(p=="use"){ continue; } - palette = fn(palette, p, kwArgs[p]); - } - return palette; // dojox.color.Palette - }, - clone: function(){ - // summary - // Clones the current palette. - return new dxc.Palette(this); // dojox.color.Palette - } - }); - - // static methods --------------------------------------------------------------- - dojo.mixin(dxc.Palette, { - generators: { - analogous:function(/* Object */args){ - var high=args.high||60, // delta between base hue and highest hue (subtracted from base) - low=args.low||18, // delta between base hue and lowest hue (added to base) - base = dojo.isString(args.base)?new dojox.color.Color(args.base):args.base, - hsv=base.toHsv(); - - // generate our hue angle differences - var h=[ - (hsv.h+low+360)%360, - (hsv.h+Math.round(low/2)+360)%360, - hsv.h, - (hsv.h-Math.round(high/2)+360)%360, - (hsv.h-high+360)%360 - ]; - - var s1=Math.max(10, (hsv.s<=95)?hsv.s+5:(100-(hsv.s-95))), - s2=(hsv.s>1)?hsv.s-1:21-hsv.s, - v1=(hsv.v>=92)?hsv.v-9:Math.max(hsv.v+9, 20), - v2=(hsv.v<=90)?Math.max(hsv.v+5, 20):(95+Math.ceil((hsv.v-90)/2)), - s=[ s1, s2, hsv.s, s1, s1 ], - v=[ v1, v2, hsv.v, v1, v2 ] - - return new dxc.Palette(dojo.map(h, function(hue, i){ - return dojox.color.fromHsv(hue, s[i], v[i]); - })); // dojox.color.Palette - }, - - monochromatic: function(/* Object */args){ - var base = dojo.isString(args.base)?new dojox.color.Color(args.base):args.base, - hsv = base.toHsv(); - - // figure out the saturation and value - var s1 = (hsv.s-30>9)?hsv.s-30:hsv.s+30, - s2 = hsv.s, - v1 = rangeDiff(hsv.v, 20, 100), - v2 = (hsv.v-20>20)?hsv.v-20:hsv.v+60, - v3 = (hsv.v-50>20)?hsv.v-50:hsv.v+30; - - return new dxc.Palette([ - dojox.color.fromHsv(hsv.h, s1, v1), - dojox.color.fromHsv(hsv.h, s2, v3), - base, - dojox.color.fromHsv(hsv.h, s1, v3), - dojox.color.fromHsv(hsv.h, s2, v2) - ]); // dojox.color.Palette - }, - - triadic: function(/* Object */args){ - var base = dojo.isString(args.base)?new dojox.color.Color(args.base):args.base, - hsv = base.toHsv(); - - var h1 = (hsv.h+57+360)%360, - h2 = (hsv.h-157+360)%360, - s1 = (hsv.s>20)?hsv.s-10:hsv.s+10, - s2 = (hsv.s>90)?hsv.s-10:hsv.s+10, - s3 = (hsv.s>95)?hsv.s-5:hsv.s+5, - v1 = (hsv.v-20>20)?hsv.v-20:hsv.v+20, - v2 = (hsv.v-30>20)?hsv.v-30:hsv.v+30, - v3 = (hsv.v-30>70)?hsv.v-30:hsv.v+30; - - return new dxc.Palette([ - dojox.color.fromHsv(h1, s1, hsv.v), - dojox.color.fromHsv(hsv.h, s2, v2), - base, - dojox.color.fromHsv(h2, s2, v1), - dojox.color.fromHsv(h2, s3, v3) - ]); // dojox.color.Palette - }, - - complementary: function(/* Object */args){ - var base = dojo.isString(args.base)?new dojox.color.Color(args.base):args.base, - hsv = base.toHsv(); - - var h1 = ((hsv.h*2)+137<360)?(hsv.h*2)+137:Math.floor(hsv.h/2)-137, - s1 = Math.max(hsv.s-10, 0), - s2 = rangeDiff(hsv.s, 10, 100), - s3 = Math.min(100, hsv.s+20), - v1 = Math.min(100, hsv.v+30), - v2 = (hsv.v>20)?hsv.v-30:hsv.v+30; - - return new dxc.Palette([ - dojox.color.fromHsv(hsv.h, s1, v1), - dojox.color.fromHsv(hsv.h, s2, v2), - base, - dojox.color.fromHsv(h1, s3, v2), - dojox.color.fromHsv(h1, hsv.s, hsv.v) - ]); // dojox.color.Palette - }, - - splitComplementary: function(/* Object */args){ - var base = dojo.isString(args.base)?new dojox.color.Color(args.base):args.base, - dangle = args.da || 30, - hsv = base.toHsv(); - - var baseh = ((hsv.h*2)+137<360)?(hsv.h*2)+137:Math.floor(hsv.h/2)-137, - h1 = (baseh-dangle+360)%360, - h2 = (baseh+dangle)%360, - s1 = Math.max(hsv.s-10, 0), - s2 = rangeDiff(hsv.s, 10, 100), - s3 = Math.min(100, hsv.s+20), - v1 = Math.min(100, hsv.v+30), - v2 = (hsv.v>20)?hsv.v-30:hsv.v+30; - - return new dxc.Palette([ - dojox.color.fromHsv(h1, s1, v1), - dojox.color.fromHsv(h1, s2, v2), - base, - dojox.color.fromHsv(h2, s3, v2), - dojox.color.fromHsv(h2, hsv.s, hsv.v) - ]); // dojox.color.Palette - }, - - compound: function(/* Object */args){ - var base = dojo.isString(args.base)?new dojox.color.Color(args.base):args.base, - hsv = base.toHsv(); - - var h1 = ((hsv.h*2)+18<360)?(hsv.h*2)+18:Math.floor(hsv.h/2)-18, - h2 = ((hsv.h*2)+120<360)?(hsv.h*2)+120:Math.floor(hsv.h/2)-120, - h3 = ((hsv.h*2)+99<360)?(hsv.h*2)+99:Math.floor(hsv.h/2)-99, - s1 = (hsv.s-40>10)?hsv.s-40:hsv.s+40, - s2 = (hsv.s-10>80)?hsv.s-10:hsv.s+10, - s3 = (hsv.s-25>10)?hsv.s-25:hsv.s+25, - v1 = (hsv.v-40>10)?hsv.v-40:hsv.v+40, - v2 = (hsv.v-20>80)?hsv.v-20:hsv.v+20, - v3 = Math.max(hsv.v, 20); - - return new dxc.Palette([ - dojox.color.fromHsv(h1, s1, v1), - dojox.color.fromHsv(h1, s2, v2), - base, - dojox.color.fromHsv(h2, s3, v3), - dojox.color.fromHsv(h3, s2, v2) - ]); // dojox.color.Palette - }, - - shades: function(/* Object */args){ - var base = dojo.isString(args.base)?new dojox.color.Color(args.base):args.base, - hsv = base.toHsv(); - - var s = (hsv.s==100 && hsv.v==0)?0:hsv.s, - v1 = (hsv.v-50>20)?hsv.v-50:hsv.v+30, - v2 = (hsv.v-25>=20)?hsv.v-25:hsv.v+55, - v3 = (hsv.v-75>=20)?hsv.v-75:hsv.v+5, - v4 = Math.max(hsv.v-10, 20); - - return new dxc.Palette([ - new dojox.color.fromHsv(hsv.h, s, v1), - new dojox.color.fromHsv(hsv.h, s, v2), - base, - new dojox.color.fromHsv(hsv.h, s, v3), - new dojox.color.fromHsv(hsv.h, s, v4) - ]); // dojox.color.Palette - } - }, - generate: function(/* String|dojox.color.Color */base, /* Function|String */type){ - // summary - // Generate a new Palette using any of the named functions in - // dojox.color.Palette.generators or an optional function definition. - if(dojo.isFunction(type)){ - return type({ base: base }); // dojox.color.Palette - } - else if(dxc.Palette.generators[type]){ - return dxc.Palette.generators[type]({ base: base }); // dojox.color.Palette - } - throw new Error("dojox.color.Palette.generate: the specified generator ('" + type + "') does not exist."); - } - }); -})(); - -} - -if(!dojo._hasResource["dojox.charting.Theme"]){ //_hasResource checks added by build. Do not use _hasResource directly in your code. -dojo._hasResource["dojox.charting.Theme"] = true; -dojo.provide("dojox.charting.Theme"); - - - -(function(){ - var dxc=dojox.charting; - // TODO: Legend information - - dxc.Theme = function(/*Object?*/ kwArgs){ - kwArgs=kwArgs||{}; - var def = dxc.Theme._def; - dojo.forEach(["chart", "plotarea", "axis", "series", "marker"], function(n){ - this[n] = dojo.delegate(def[n], kwArgs[n]||{}); - }, this); - this.markers = dojo.delegate(dxc.Theme.Markers, kwArgs.markers||{}); - this.colors = []; - this.antiAlias = ("antiAlias" in kwArgs)?kwArgs.antiAlias:true; - this.assignColors = ("assignColors" in kwArgs)?kwArgs.assignColors:true; - this.assignMarkers = ("assignMarkers" in kwArgs)?kwArgs.assignMarkers:true; - - // push the colors, use _def colors if none passed. - kwArgs.colors = kwArgs.colors||def.colors; - dojo.forEach(kwArgs.colors, function(item){ - this.colors.push(item); - }, this); - - // private variables for color and marker indexing - this._current = { color:0, marker: 0 }; - this._markers = []; - this._buildMarkerArray(); - }; - - // "static" fields - // default markers. - // A marker is defined by an SVG path segment; it should be defined as - // relative motion, and with the assumption that the path segment - // will be moved to the value point (i.e prepend Mx,y) - dxc.Theme.Markers={ - CIRCLE: "m-3,0 c0,-4 6,-4 6,0 m-6,0 c0,4 6,4 6,0", - SQUARE: "m-3,-3 l0,6 6,0 0,-6 z", - DIAMOND: "m0,-3 l3,3 -3,3 -3,-3 z", - CROSS: "m0,-3 l0,6 m-3,-3 l6,0", - X: "m-3,-3 l6,6 m0,-6 l-6,6", - TRIANGLE: "m-3,3 l3,-6 3,6 z", - TRIANGLE_INVERTED:"m-3,-3 l3,6 3,-6 z" - }; - dxc.Theme._def={ - // all objects are structs used directly in dojox.gfx - chart:{ - stroke:null, - fill: "white" - }, - plotarea:{ - stroke:null, - fill: "white" - }, - // TODO: label rotation on axis - axis:{ - stroke: { // the axis itself - color:"#333", - width:1 - }, - /* - line: { // in the future can be used for gridlines - color:"#ccc", - width:1, - style:"Dot", - cap:"round" - }, - */ - majorTick: { // major ticks on axis, and used for major gridlines - color:"#666", - width:1, - length:6, - position:"center" - }, - minorTick: { // minor ticks on axis, and used for minor gridlines - color:"#666", - width:0.8, - length:3, - position:"center" - }, - font: "normal normal normal 7pt Tahoma", // labels on axis - fontColor:"#333" // color of labels - }, - series:{ - outline: {width: 0.1, color: "#ccc"}, // line or outline - stroke: {width: 1.5, color: "#333"}, // line or outline - fill: "#ccc", // fill, if appropriate - font: "normal normal normal 7pt Tahoma", // if there's a label - fontColor: "#000" // color of labels - }, - marker:{ // any markers on a series. - stroke: {width:1}, // stroke or outline - fill: "#333", // fill if needed - font: "normal normal normal 7pt Tahoma", // label - fontColor: "#000" - }, - colors:[ "#54544c","#858e94","#6e767a","#948585","#474747" ] - }; - - // prototype methods - dojo.extend(dxc.Theme, { - defineColors: function(obj){ - // summary: - // Generate a set of colors for the theme based on keyword - // arguments - var kwArgs=obj||{}; - - // note that we've changed the default number from 32 to 4 colors - // are cycled anyways. - var c=[], n=kwArgs.num||5; // the number of colors to generate - if(kwArgs.colors){ - // we have an array of colors predefined, so fix for the number of series. - var l=kwArgs.colors.length; - for(var i=0; i<n; i++){ - c.push(kwArgs.colors[i%l]); - } - this.colors=c; - }else if(kwArgs.hue){ - // single hue, generate a set based on brightness - var s=kwArgs.saturation||100; // saturation - var st=kwArgs.low||30; - var end=kwArgs.high||90; - // we'd like it to be a little on the darker side. - var l=(end+st)/2; - - // alternately, use "shades" - this.colors = dojox.color.Palette.generate( - dojox.color.fromHsv(kwArgs.hue, s, l), "monochromatic" - ).colors; - }else if(kwArgs.generator){ - // pass a base color and the name of a generator - this.colors=dojox.color.Palette.generate(kwArgs.base, kwArgs.generator).colors; - } - }, - - _buildMarkerArray: function(){ - this._markers = []; - for(var p in this.markers){ this._markers.push(this.markers[p]); } - // reset the position - this._current.marker=0; - }, - - _clone: function(){ - // summary: - // Return a clone of this theme, with the position vars reset to 0. - return new dxc.Theme({ - chart: this.chart, - plotarea: this.plotarea, - axis: this.axis, - series: this.series, - marker: this.marker, - antiAlias: this.antiAlias, - assignColors: this.assignColors, - assignMarkers: this.assigneMarkers, - colors: dojo.delegate(this.colors) - }); - }, - - addMarker:function(/*String*/ name, /*String*/ segment){ - // summary: - // Add a custom marker to this theme. - // example: - // | myTheme.addMarker("Ellipse", foo); - this.markers[name]=segment; - this._buildMarkerArray(); - }, - setMarkers:function(/*Object*/ obj){ - // summary: - // Set all the markers of this theme at once. obj should be a - // dictionary of keys and path segments. - // - // example: - // | myTheme.setMarkers({ "CIRCLE": foo }); - this.markers=obj; - this._buildMarkerArray(); - }, - - next: function(/*String?*/ type){ - // summary: - // get either the next color or the next marker, depending on - // what was passed. If type is not passed, it assumes color. - // type: - // Optional. One of either "color" or "marker". Defaults to - // "color". - // example: - // | var color = myTheme.next(); - // | var color = myTheme.next("color"); - // | var marker = myTheme.next("marker"); - if(type == "marker"){ - return this._markers[ this._current.marker++ % this._markers.length ]; - }else{ - return this.colors[ this._current.color++ % this.colors.length ]; - } - }, - clear: function(){ - // summary: - // resets both marker and color counters back to the start. - // Subsequent calls to `next` will retrievie the first value - // of each depending on the passed type. - this._current = {color: 0, marker: 0}; - } - }); -})(); - -} - -if(!dojo._hasResource["dojox.charting.Element"]){ //_hasResource checks added by build. Do not use _hasResource directly in your code. -dojo._hasResource["dojox.charting.Element"] = true; -dojo.provide("dojox.charting.Element"); - -dojo.declare("dojox.charting.Element", null, { - constructor: function(chart){ - this.chart = chart; - this.group = null; - this.htmlElements = []; - this.dirty = true; - }, - createGroup: function(creator){ - if(!creator){ creator = this.chart.surface; } - if(!this.group){ - this.group = creator.createGroup(); - } - return this; - }, - purgeGroup: function(){ - this.destroyHtmlElements(); - if(this.group){ - this.group.clear(); - this.group.removeShape(); - this.group = null; - } - this.dirty = true; - return this; - }, - cleanGroup: function(creator){ - this.destroyHtmlElements(); - if(!creator){ creator = this.chart.surface; } - if(this.group){ - this.group.clear(); - }else{ - this.group = creator.createGroup(); - } - this.dirty = true; - return this; - }, - destroyHtmlElements: function(){ - if(this.htmlElements.length){ - dojo.forEach(this.htmlElements, dojo.destroy); - this.htmlElements = []; - } - }, - destroy: function(){ - this.purgeGroup(); - } -}); - -} - -if(!dojo._hasResource["dojox.charting.Series"]){ //_hasResource checks added by build. Do not use _hasResource directly in your code. -dojo._hasResource["dojox.charting.Series"] = true; -dojo.provide("dojox.charting.Series"); - - - -dojo.declare("dojox.charting.Series", dojox.charting.Element, { - constructor: function(chart, data, kwArgs){ - dojo.mixin(this, kwArgs); - if(typeof this.plot != "string"){ this.plot = "default"; } - this.data = data; - this.dirty = true; - this.clear(); - }, - clear: function(){ - this.dyn = {}; - } -}); - -} - -if(!dojo._hasResource["dojox.charting.scaler.common"]){ //_hasResource checks added by build. Do not use _hasResource directly in your code. -dojo._hasResource["dojox.charting.scaler.common"] = true; -dojo.provide("dojox.charting.scaler.common"); - -(function(){ - var eq = function(/*Number*/ a, /*Number*/ b){ - // summary: compare two FP numbers for equality - return Math.abs(a - b) <= 1e-6 * (Math.abs(a) + Math.abs(b)); // Boolean - }; - - dojo.mixin(dojox.charting.scaler.common, { - findString: function(/*String*/ val, /*Array*/ text){ - val = val.toLowerCase(); - for(var i = 0; i < text.length; ++i){ - if(val == text[i]){ return true; } - } - return false; - }, - getNumericLabel: function(/*Number*/ number, /*Number*/ precision, /*Object*/ kwArgs){ - var def = kwArgs.fixed ? - number.toFixed(precision < 0 ? -precision : 0) : - number.toString(); - if(kwArgs.labelFunc){ - var r = kwArgs.labelFunc(def, number, precision); - if(r){ return r; } - // else fall through to the regular labels search - } - if(kwArgs.labels){ - // classic binary search - var l = kwArgs.labels, lo = 0, hi = l.length; - while(lo < hi){ - var mid = Math.floor((lo + hi) / 2), val = l[mid].value; - if(val < number){ - lo = mid + 1; - }else{ - hi = mid; - } - } - // lets take into account FP errors - if(lo < l.length && eq(l[lo].value, number)){ - return l[lo].text; - } - --lo; - if(lo >= 0 && lo < l.length && eq(l[lo].value, number)){ - return l[lo].text; - } - lo += 2; - if(lo < l.length && eq(l[lo].value, number)){ - return l[lo].text; - } - // otherwise we will produce a number - } - return def; - } - }); -})(); - -} - -if(!dojo._hasResource["dojox.charting.scaler.linear"]){ //_hasResource checks added by build. Do not use _hasResource directly in your code. -dojo._hasResource["dojox.charting.scaler.linear"] = true; -dojo.provide("dojox.charting.scaler.linear"); - - -(function(){ - var deltaLimit = 3, // pixels - dc = dojox.charting, dcs = dc.scaler, dcsc = dcs.common, - findString = dcsc.findString, - getLabel = dcsc.getNumericLabel; - - var calcTicks = function(min, max, kwArgs, majorTick, minorTick, microTick, span){ - kwArgs = dojo.delegate(kwArgs); - if(!majorTick){ - if(kwArgs.fixUpper == "major"){ kwArgs.fixUpper = "minor"; } - if(kwArgs.fixLower == "major"){ kwArgs.fixLower = "minor"; } - } - if(!minorTick){ - if(kwArgs.fixUpper == "minor"){ kwArgs.fixUpper = "micro"; } - if(kwArgs.fixLower == "minor"){ kwArgs.fixLower = "micro"; } - } - if(!microTick){ - if(kwArgs.fixUpper == "micro"){ kwArgs.fixUpper = "none"; } - if(kwArgs.fixLower == "micro"){ kwArgs.fixLower = "none"; } - } - var lowerBound = findString(kwArgs.fixLower, ["major"]) ? - Math.floor(kwArgs.min / majorTick) * majorTick : - findString(kwArgs.fixLower, ["minor"]) ? - Math.floor(kwArgs.min / minorTick) * minorTick : - findString(kwArgs.fixLower, ["micro"]) ? - Math.floor(kwArgs.min / microTick) * microTick : kwArgs.min, - upperBound = findString(kwArgs.fixUpper, ["major"]) ? - Math.ceil(kwArgs
<TRUNCATED>