You are viewing a plain text version of this content. The canonical link for it is here.
Posted to scm@geronimo.apache.org by dj...@apache.org on 2009/07/16 21:14:56 UTC
svn commit: r794787 [3/34] - in
/geronimo/external/trunk/geronimo-dojo-0.4.3/src/main/webapp/src: ./
animation/ cal/ charting/ charting/svg/ charting/vml/ collections/ crypto/
data/ data/core/ data/old/ data/old/format/ data/old/provider/ date/ debug/
...
Propchange: geronimo/external/trunk/geronimo-dojo-0.4.3/src/main/webapp/src/charting/svg/Axis.js
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: geronimo/external/trunk/geronimo-dojo-0.4.3/src/main/webapp/src/charting/svg/Axis.js
------------------------------------------------------------------------------
svn:keywords = Date Revision
Propchange: geronimo/external/trunk/geronimo-dojo-0.4.3/src/main/webapp/src/charting/svg/Axis.js
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: geronimo/external/trunk/geronimo-dojo-0.4.3/src/main/webapp/src/charting/svg/PlotArea.js
URL: http://svn.apache.org/viewvc/geronimo/external/trunk/geronimo-dojo-0.4.3/src/main/webapp/src/charting/svg/PlotArea.js?rev=794787&view=auto
==============================================================================
--- geronimo/external/trunk/geronimo-dojo-0.4.3/src/main/webapp/src/charting/svg/PlotArea.js (added)
+++ geronimo/external/trunk/geronimo-dojo-0.4.3/src/main/webapp/src/charting/svg/PlotArea.js Thu Jul 16 19:14:41 2009
@@ -0,0 +1,77 @@
+/*
+ Copyright (c) 2004-2006, The Dojo Foundation
+ All Rights Reserved.
+
+ Licensed under the Academic Free License version 2.1 or above OR the
+ modified BSD license. For more information on Dojo licensing, see:
+
+ http://dojotoolkit.org/community/licensing.shtml
+*/
+
+
+
+dojo.provide("dojo.charting.svg.PlotArea");
+dojo.require("dojo.lang.common");
+if (dojo.render.svg.capable) {
+ dojo.require("dojo.svg");
+ dojo.extend(dojo.charting.PlotArea, {resize:function () {
+ var area = this.getArea();
+ this.nodes.area.setAttribute("width", this.size.width);
+ this.nodes.area.setAttribute("height", this.size.height);
+ var rect = this.nodes.area.getElementsByTagName("rect")[0];
+ rect.setAttribute("x", area.left);
+ rect.setAttribute("y", area.top);
+ rect.setAttribute("width", area.right - area.left);
+ rect.setAttribute("height", area.bottom - area.top);
+ this.nodes.background.setAttribute("width", this.size.width);
+ this.nodes.background.setAttribute("height", this.size.height);
+ if (this.nodes.plots) {
+ this.nodes.area.removeChild(this.nodes.plots);
+ this.nodes.plots = null;
+ }
+ this.nodes.plots = document.createElementNS(dojo.svg.xmlns.svg, "g");
+ this.nodes.plots.setAttribute("id", this.getId() + "-plots");
+ this.nodes.plots.setAttribute("style", "clip-path:url(#" + this.getId() + "-clip);");
+ this.nodes.area.appendChild(this.nodes.plots);
+ for (var i = 0; i < this.plots.length; i++) {
+ this.nodes.plots.appendChild(this.initializePlot(this.plots[i]));
+ }
+ if (this.nodes.axes) {
+ this.nodes.area.removeChild(this.nodes.axes);
+ this.nodes.axes = null;
+ }
+ this.nodes.axes = document.createElementNS(dojo.svg.xmlns.svg, "g");
+ this.nodes.axes.setAttribute("id", this.getId() + "-axes");
+ this.nodes.area.appendChild(this.nodes.axes);
+ var axes = this.getAxes();
+ for (var p in axes) {
+ var obj = axes[p];
+ this.nodes.axes.appendChild(obj.axis.initialize(this, obj.plot, obj.drawAgainst, obj.plane));
+ }
+ }, initializePlot:function (plot) {
+ plot.destroy();
+ plot.dataNode = document.createElementNS(dojo.svg.xmlns.svg, "g");
+ plot.dataNode.setAttribute("id", plot.getId());
+ return plot.dataNode;
+ }, initialize:function () {
+ this.destroy();
+ this.nodes.main = document.createElement("div");
+ this.nodes.area = document.createElementNS(dojo.svg.xmlns.svg, "svg");
+ this.nodes.area.setAttribute("id", this.getId());
+ this.nodes.main.appendChild(this.nodes.area);
+ var defs = document.createElementNS(dojo.svg.xmlns.svg, "defs");
+ var clip = document.createElementNS(dojo.svg.xmlns.svg, "clipPath");
+ clip.setAttribute("id", this.getId() + "-clip");
+ var rect = document.createElementNS(dojo.svg.xmlns.svg, "rect");
+ clip.appendChild(rect);
+ defs.appendChild(clip);
+ this.nodes.area.appendChild(defs);
+ this.nodes.background = document.createElementNS(dojo.svg.xmlns.svg, "rect");
+ this.nodes.background.setAttribute("id", this.getId() + "-background");
+ this.nodes.background.setAttribute("fill", "#fff");
+ this.nodes.area.appendChild(this.nodes.background);
+ this.resize();
+ return this.nodes.main;
+ }});
+}
+
Propchange: geronimo/external/trunk/geronimo-dojo-0.4.3/src/main/webapp/src/charting/svg/PlotArea.js
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: geronimo/external/trunk/geronimo-dojo-0.4.3/src/main/webapp/src/charting/svg/PlotArea.js
------------------------------------------------------------------------------
svn:keywords = Date Revision
Propchange: geronimo/external/trunk/geronimo-dojo-0.4.3/src/main/webapp/src/charting/svg/PlotArea.js
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: geronimo/external/trunk/geronimo-dojo-0.4.3/src/main/webapp/src/charting/svg/Plotters.js
URL: http://svn.apache.org/viewvc/geronimo/external/trunk/geronimo-dojo-0.4.3/src/main/webapp/src/charting/svg/Plotters.js?rev=794787&view=auto
==============================================================================
--- geronimo/external/trunk/geronimo-dojo-0.4.3/src/main/webapp/src/charting/svg/Plotters.js (added)
+++ geronimo/external/trunk/geronimo-dojo-0.4.3/src/main/webapp/src/charting/svg/Plotters.js Thu Jul 16 19:14:41 2009
@@ -0,0 +1,702 @@
+/*
+ Copyright (c) 2004-2006, The Dojo Foundation
+ All Rights Reserved.
+
+ Licensed under the Academic Free License version 2.1 or above OR the
+ modified BSD license. For more information on Dojo licensing, see:
+
+ http://dojotoolkit.org/community/licensing.shtml
+*/
+
+
+
+dojo.provide("dojo.charting.svg.Plotters");
+dojo.require("dojo.lang.common");
+if (dojo.render.svg.capable) {
+ dojo.require("dojo.svg");
+ dojo.mixin(dojo.charting.Plotters, {Bar:function (plotarea, plot, kwArgs, applyTo) {
+ var area = plotarea.getArea();
+ var group = document.createElementNS(dojo.svg.xmlns.svg, "g");
+ var n = plot.series.length;
+ var data = [];
+ for (var i = 0; i < n; i++) {
+ var tmp = plot.series[i].data.evaluate(kwArgs);
+ data.push(tmp);
+ }
+ var space = 8;
+ var nPoints = data[0].length;
+ if (nPoints == 0) {
+ return group;
+ }
+ var width = ((area.right - area.left) - (space * (nPoints - 1))) / nPoints;
+ var barWidth = width / n;
+ var yOrigin = plot.axisY.getCoord(plot.axisX.origin, plotarea, plot);
+ for (var i = 0; i < nPoints; i++) {
+ var xStart = area.left + (width * i) + (space * i);
+ for (var j = 0; j < n; j++) {
+ var value = data[j][i].y;
+ var yA = yOrigin;
+ var x = xStart + (barWidth * j);
+ var y = plot.axisY.getCoord(value, plotarea, plot);
+ var h = Math.abs(yA - y);
+ if (value < plot.axisX.origin) {
+ yA = y;
+ y = yOrigin;
+ }
+ var bar = document.createElementNS(dojo.svg.xmlns.svg, "rect");
+ bar.setAttribute("fill", data[j][i].series.color);
+ bar.setAttribute("stroke-width", "0");
+ bar.setAttribute("x", x);
+ bar.setAttribute("y", y);
+ bar.setAttribute("width", barWidth);
+ bar.setAttribute("height", h);
+ bar.setAttribute("fill-opacity", "0.6");
+ if (applyTo) {
+ applyTo(bar, data[j][i].src);
+ }
+ group.appendChild(bar);
+ }
+ }
+ return group;
+ }, HorizontalBar:function (plotarea, plot, kwArgs, applyTo) {
+ var area = plotarea.getArea();
+ var group = document.createElementNS(dojo.svg.xmlns.svg, "g");
+ var n = plot.series.length;
+ var data = [];
+ for (var i = 0; i < n; i++) {
+ var tmp = plot.series[i].data.evaluate(kwArgs);
+ data.push(tmp);
+ }
+ var space = 6;
+ var nPoints = data[0].length;
+ if (nPoints == 0) {
+ return group;
+ }
+ var h = ((area.bottom - area.top) - (space * (nPoints - 1))) / nPoints;
+ var barH = h / n;
+ var xOrigin = plot.axisX.getCoord(0, plotarea, plot);
+ for (var i = 0; i < nPoints; i++) {
+ var yStart = area.top + (h * i) + (space * i);
+ for (var j = 0; j < n; j++) {
+ var value = data[j][i].y;
+ var y = yStart + (barH * j);
+ var xA = xOrigin;
+ var x = plot.axisX.getCoord(value, plotarea, plot);
+ var w = Math.abs(x - xA);
+ if (value > 0) {
+ x = xOrigin;
+ }
+ var bar = document.createElementNS(dojo.svg.xmlns.svg, "rect");
+ bar.setAttribute("fill", data[j][i].series.color);
+ bar.setAttribute("stroke-width", "0");
+ bar.setAttribute("x", xA);
+ bar.setAttribute("y", y);
+ bar.setAttribute("width", w);
+ bar.setAttribute("height", barH);
+ bar.setAttribute("fill-opacity", "0.6");
+ if (applyTo) {
+ applyTo(bar, data[j][i].src);
+ }
+ group.appendChild(bar);
+ }
+ }
+ return group;
+ }, Gantt:function (plotarea, plot, kwArgs, applyTo) {
+ var area = plotarea.getArea();
+ var group = document.createElementNS(dojo.svg.xmlns.svg, "g");
+ var n = plot.series.length;
+ var data = [];
+ for (var i = 0; i < n; i++) {
+ var tmp = plot.series[i].data.evaluate(kwArgs);
+ data.push(tmp);
+ }
+ var space = 2;
+ var nPoints = data[0].length;
+ if (nPoints == 0) {
+ return group;
+ }
+ var h = ((area.bottom - area.top) - (space * (nPoints - 1))) / nPoints;
+ var barH = h / n;
+ for (var i = 0; i < nPoints; i++) {
+ var yStart = area.top + (h * i) + (space * i);
+ for (var j = 0; j < n; j++) {
+ var high = data[j][i].high;
+ var low = data[j][i].low;
+ if (low > high) {
+ var t = high;
+ high = low;
+ low = t;
+ }
+ var x = plot.axisX.getCoord(low, plotarea, plot);
+ var w = plot.axisX.getCoord(high, plotarea, plot) - x;
+ var y = yStart + (barH * j);
+ var bar = document.createElementNS(dojo.svg.xmlns.svg, "rect");
+ bar.setAttribute("fill", data[j][i].series.color);
+ bar.setAttribute("stroke-width", "0");
+ bar.setAttribute("x", x);
+ bar.setAttribute("y", y);
+ bar.setAttribute("width", w);
+ bar.setAttribute("height", barH);
+ bar.setAttribute("fill-opacity", "0.6");
+ if (applyTo) {
+ applyTo(bar, data[j][i].src);
+ }
+ group.appendChild(bar);
+ }
+ }
+ return group;
+ }, StackedArea:function (plotarea, plot, kwArgs, applyTo) {
+ var area = plotarea.getArea();
+ var group = document.createElementNS(dojo.svg.xmlns.svg, "g");
+ var n = plot.series.length;
+ var data = [];
+ var totals = [];
+ for (var i = 0; i < n; i++) {
+ var tmp = plot.series[i].data.evaluate(kwArgs);
+ for (var j = 0; j < tmp.length; j++) {
+ if (i == 0) {
+ totals.push(tmp[j].y);
+ } else {
+ totals[j] += tmp[j].y;
+ }
+ tmp[j].y = totals[j];
+ }
+ data.push(tmp);
+ }
+ for (var i = n - 1; i >= 0; i--) {
+ var path = document.createElementNS(dojo.svg.xmlns.svg, "path");
+ path.setAttribute("fill", data[i][0].series.color);
+ path.setAttribute("fill-opacity", "0.4");
+ path.setAttribute("stroke", data[i][0].series.color);
+ path.setAttribute("stroke-width", "1");
+ path.setAttribute("stroke-opacity", "0.85");
+ var cmd = [];
+ var r = 3;
+ for (var j = 0; j < data[i].length; j++) {
+ var values = data[i];
+ var x = plot.axisX.getCoord(values[j].x, plotarea, plot);
+ var y = plot.axisY.getCoord(values[j].y, plotarea, plot);
+ if (j == 0) {
+ cmd.push("M");
+ } else {
+ cmd.push("L");
+ }
+ cmd.push(x + "," + y);
+ var c = document.createElementNS(dojo.svg.xmlns.svg, "circle");
+ c.setAttribute("cx", x);
+ c.setAttribute("cy", y);
+ c.setAttribute("r", "3");
+ c.setAttribute("fill", values[j].series.color);
+ c.setAttribute("fill-opacity", "0.6");
+ c.setAttribute("stroke-width", "1");
+ c.setAttribute("stroke-opacity", "0.85");
+ group.appendChild(c);
+ if (applyTo) {
+ applyTo(c, data[i].src);
+ }
+ }
+ if (i == 0) {
+ cmd.push("L");
+ cmd.push(x + "," + plot.axisY.getCoord(plot.axisX.origin, plotarea, plot));
+ cmd.push("L");
+ cmd.push(plot.axisX.getCoord(data[0][0].x, plotarea, plot) + "," + plot.axisY.getCoord(plot.axisX.origin, plotarea, plot));
+ cmd.push("Z");
+ } else {
+ var values = data[i - 1];
+ cmd.push("L");
+ cmd.push(x + "," + Math.round(plot.axisY.getCoord(values[values.length - 1].y, plotarea, plot)));
+ for (var j = values.length - 2; j >= 0; j--) {
+ var x = plot.axisX.getCoord(values[j].x, plotarea, plot);
+ var y = plot.axisY.getCoord(values[j].y, plotarea, plot);
+ cmd.push("L");
+ cmd.push(x + "," + y);
+ }
+ }
+ path.setAttribute("d", cmd.join(" ") + " Z");
+ group.appendChild(path);
+ }
+ return group;
+ }, StackedCurvedArea:function (plotarea, plot, kwArgs, applyTo) {
+ var tension = 3;
+ var area = plotarea.getArea();
+ var group = document.createElementNS(dojo.svg.xmlns.svg, "g");
+ var n = plot.series.length;
+ var data = [];
+ var totals = [];
+ for (var i = 0; i < n; i++) {
+ var tmp = plot.series[i].data.evaluate(kwArgs);
+ for (var j = 0; j < tmp.length; j++) {
+ if (i == 0) {
+ totals.push(tmp[j].y);
+ } else {
+ totals[j] += tmp[j].y;
+ }
+ tmp[j].y = totals[j];
+ }
+ data.push(tmp);
+ }
+ for (var i = n - 1; i >= 0; i--) {
+ var path = document.createElementNS(dojo.svg.xmlns.svg, "path");
+ path.setAttribute("fill", data[i][0].series.color);
+ path.setAttribute("fill-opacity", "0.4");
+ path.setAttribute("stroke", data[i][0].series.color);
+ path.setAttribute("stroke-width", "1");
+ path.setAttribute("stroke-opacity", "0.85");
+ var cmd = [];
+ var r = 3;
+ for (var j = 0; j < data[i].length; j++) {
+ var values = data[i];
+ var x = plot.axisX.getCoord(values[j].x, plotarea, plot);
+ var y = plot.axisY.getCoord(values[j].y, plotarea, plot);
+ var dx = area.left + 1;
+ var dy = area.bottom;
+ if (j > 0) {
+ dx = x - plot.axisX.getCoord(values[j - 1].x, plotarea, plot);
+ dy = plot.axisY.getCoord(values[j - 1].y, plotarea, plot);
+ }
+ if (j == 0) {
+ cmd.push("M");
+ } else {
+ cmd.push("C");
+ var cx = x - (tension - 1) * (dx / tension);
+ cmd.push(cx + "," + dy);
+ cx = x - (dx / tension);
+ cmd.push(cx + "," + y);
+ }
+ cmd.push(x + "," + y);
+ var c = document.createElementNS(dojo.svg.xmlns.svg, "circle");
+ c.setAttribute("cx", x);
+ c.setAttribute("cy", y);
+ c.setAttribute("r", "3");
+ c.setAttribute("fill", values[j].series.color);
+ c.setAttribute("fill-opacity", "0.6");
+ c.setAttribute("stroke-width", "1");
+ c.setAttribute("stroke-opacity", "0.85");
+ group.appendChild(c);
+ if (applyTo) {
+ applyTo(c, data[i].src);
+ }
+ }
+ if (i == 0) {
+ cmd.push("L");
+ cmd.push(x + "," + plot.axisY.getCoord(plot.axisX.origin, plotarea, plot));
+ cmd.push("L");
+ cmd.push(plot.axisX.getCoord(data[0][0].x, plotarea, plot) + "," + plot.axisY.getCoord(plot.axisX.origin, plotarea, plot));
+ cmd.push("Z");
+ } else {
+ var values = data[i - 1];
+ cmd.push("L");
+ cmd.push(x + "," + Math.round(plot.axisY.getCoord(values[values.length - 1].y, plotarea, plot)));
+ for (var j = values.length - 2; j >= 0; j--) {
+ var x = plot.axisX.getCoord(values[j].x, plotarea, plot);
+ var y = plot.axisY.getCoord(values[j].y, plotarea, plot);
+ var dx = x - plot.axisX.getCoord(values[j + 1].x, plotarea, plot);
+ var dy = plot.axisY.getCoord(values[j + 1].y, plotarea, plot);
+ cmd.push("C");
+ var cx = x - (tension - 1) * (dx / tension);
+ cmd.push(cx + "," + dy);
+ cx = x - (dx / tension);
+ cmd.push(cx + "," + y);
+ cmd.push(x + "," + y);
+ }
+ }
+ path.setAttribute("d", cmd.join(" ") + " Z");
+ group.appendChild(path);
+ }
+ return group;
+ }, DataBar:function (data, plotarea, plot, applyTo) {
+ var area = plotarea.getArea();
+ var group = document.createElementNS(dojo.svg.xmlns.svg, "g");
+ var n = data.length;
+ var w = (area.right - area.left) / (plot.axisX.range.upper - plot.axisX.range.lower);
+ var yOrigin = plot.axisY.getCoord(plot.axisX.origin, plotarea, plot);
+ for (var i = 0; i < n; i++) {
+ var value = data[i].y;
+ var yA = yOrigin;
+ var x = plot.axisX.getCoord(data[i].x, plotarea, plot) - (w / 2);
+ var y = plot.axisY.getCoord(value, plotarea, plot);
+ var h = Math.abs(yA - y);
+ if (value < plot.axisX.origin) {
+ yA = y;
+ y = yOrigin;
+ }
+ var bar = document.createElementNS(dojo.svg.xmlns.svg, "rect");
+ bar.setAttribute("fill", data[i].series.color);
+ bar.setAttribute("stroke-width", "0");
+ bar.setAttribute("x", x);
+ bar.setAttribute("y", y);
+ bar.setAttribute("width", w);
+ bar.setAttribute("height", h);
+ bar.setAttribute("fill-opacity", "0.6");
+ if (applyTo) {
+ applyTo(bar, data[i].src);
+ }
+ group.appendChild(bar);
+ }
+ return group;
+ }, Line:function (data, plotarea, plot, applyTo) {
+ var area = plotarea.getArea();
+ var line = document.createElementNS(dojo.svg.xmlns.svg, "g");
+ if (data.length == 0) {
+ return line;
+ }
+ var path = document.createElementNS(dojo.svg.xmlns.svg, "path");
+ line.appendChild(path);
+ path.setAttribute("fill", "none");
+ path.setAttribute("stroke", data[0].series.color);
+ path.setAttribute("stroke-width", "2");
+ path.setAttribute("stroke-opacity", "0.85");
+ if (data[0].series.label != null) {
+ path.setAttribute("title", data[0].series.label);
+ }
+ var cmd = [];
+ for (var i = 0; i < data.length; i++) {
+ var x = plot.axisX.getCoord(data[i].x, plotarea, plot);
+ var y = plot.axisY.getCoord(data[i].y, plotarea, plot);
+ if (i == 0) {
+ cmd.push("M");
+ } else {
+ cmd.push("L");
+ }
+ cmd.push(x + "," + y);
+ var c = document.createElementNS(dojo.svg.xmlns.svg, "circle");
+ c.setAttribute("cx", x);
+ c.setAttribute("cy", y);
+ c.setAttribute("r", "3");
+ c.setAttribute("fill", data[i].series.color);
+ c.setAttribute("fill-opacity", "0.6");
+ c.setAttribute("stroke-width", "1");
+ c.setAttribute("stroke-opacity", "0.85");
+ line.appendChild(c);
+ if (applyTo) {
+ applyTo(c, data[i].src);
+ }
+ }
+ path.setAttribute("d", cmd.join(" "));
+ return line;
+ }, CurvedLine:function (data, plotarea, plot, applyTo) {
+ var tension = 3;
+ var area = plotarea.getArea();
+ var line = document.createElementNS(dojo.svg.xmlns.svg, "g");
+ if (data.length == 0) {
+ return line;
+ }
+ var path = document.createElementNS(dojo.svg.xmlns.svg, "path");
+ line.appendChild(path);
+ path.setAttribute("fill", "none");
+ path.setAttribute("stroke", data[0].series.color);
+ path.setAttribute("stroke-width", "2");
+ path.setAttribute("stroke-opacity", "0.85");
+ if (data[0].series.label != null) {
+ path.setAttribute("title", data[0].series.label);
+ }
+ var cmd = [];
+ for (var i = 0; i < data.length; i++) {
+ var x = plot.axisX.getCoord(data[i].x, plotarea, plot);
+ var y = plot.axisY.getCoord(data[i].y, plotarea, plot);
+ var dx = area.left + 1;
+ var dy = area.bottom;
+ if (i > 0) {
+ dx = x - plot.axisX.getCoord(data[i - 1].x, plotarea, plot);
+ dy = plot.axisY.getCoord(data[i - 1].y, plotarea, plot);
+ }
+ if (i == 0) {
+ cmd.push("M");
+ } else {
+ cmd.push("C");
+ var cx = x - (tension - 1) * (dx / tension);
+ cmd.push(cx + "," + dy);
+ cx = x - (dx / tension);
+ cmd.push(cx + "," + y);
+ }
+ cmd.push(x + "," + y);
+ var c = document.createElementNS(dojo.svg.xmlns.svg, "circle");
+ c.setAttribute("cx", x);
+ c.setAttribute("cy", y);
+ c.setAttribute("r", "3");
+ c.setAttribute("fill", data[i].series.color);
+ c.setAttribute("fill-opacity", "0.6");
+ c.setAttribute("stroke-width", "1");
+ c.setAttribute("stroke-opacity", "0.85");
+ line.appendChild(c);
+ if (applyTo) {
+ applyTo(c, data[i].src);
+ }
+ }
+ path.setAttribute("d", cmd.join(" "));
+ return line;
+ }, Area:function (data, plotarea, plot, applyTo) {
+ var area = plotarea.getArea();
+ var line = document.createElementNS(dojo.svg.xmlns.svg, "g");
+ if (data.length == 0) {
+ return line;
+ }
+ var path = document.createElementNS(dojo.svg.xmlns.svg, "path");
+ line.appendChild(path);
+ path.setAttribute("fill", data[0].series.color);
+ path.setAttribute("fill-opacity", "0.4");
+ path.setAttribute("stroke", data[0].series.color);
+ path.setAttribute("stroke-width", "1");
+ path.setAttribute("stroke-opacity", "0.85");
+ if (data[0].series.label != null) {
+ path.setAttribute("title", data[0].series.label);
+ }
+ var cmd = [];
+ for (var i = 0; i < data.length; i++) {
+ var x = plot.axisX.getCoord(data[i].x, plotarea, plot);
+ var y = plot.axisY.getCoord(data[i].y, plotarea, plot);
+ if (i == 0) {
+ cmd.push("M");
+ } else {
+ cmd.push("L");
+ }
+ cmd.push(x + "," + y);
+ var c = document.createElementNS(dojo.svg.xmlns.svg, "circle");
+ c.setAttribute("cx", x);
+ c.setAttribute("cy", y);
+ c.setAttribute("r", "3");
+ c.setAttribute("fill", data[i].series.color);
+ c.setAttribute("fill-opacity", "0.6");
+ c.setAttribute("stroke-width", "1");
+ c.setAttribute("stroke-opacity", "0.85");
+ line.appendChild(c);
+ if (applyTo) {
+ applyTo(c, data[i].src);
+ }
+ }
+ cmd.push("L");
+ cmd.push(x + "," + plot.axisY.getCoord(plot.axisX.origin, plotarea, plot));
+ cmd.push("L");
+ cmd.push(plot.axisX.getCoord(data[0].x, plotarea, plot) + "," + plot.axisY.getCoord(plot.axisX.origin, plotarea, plot));
+ cmd.push("Z");
+ path.setAttribute("d", cmd.join(" "));
+ return line;
+ }, CurvedArea:function (data, plotarea, plot, applyTo) {
+ var tension = 3;
+ var area = plotarea.getArea();
+ var line = document.createElementNS(dojo.svg.xmlns.svg, "g");
+ if (data.length == 0) {
+ return line;
+ }
+ var path = document.createElementNS(dojo.svg.xmlns.svg, "path");
+ line.appendChild(path);
+ path.setAttribute("fill", data[0].series.color);
+ path.setAttribute("fill-opacity", "0.4");
+ path.setAttribute("stroke", data[0].series.color);
+ path.setAttribute("stroke-width", "1");
+ path.setAttribute("stroke-opacity", "0.85");
+ if (data[0].series.label != null) {
+ path.setAttribute("title", data[0].series.label);
+ }
+ var cmd = [];
+ for (var i = 0; i < data.length; i++) {
+ var x = plot.axisX.getCoord(data[i].x, plotarea, plot);
+ var y = plot.axisY.getCoord(data[i].y, plotarea, plot);
+ var dx = area.left + 1;
+ var dy = area.bottom;
+ if (i > 0) {
+ dx = x - plot.axisX.getCoord(data[i - 1].x, plotarea, plot);
+ dy = plot.axisY.getCoord(data[i - 1].y, plotarea, plot);
+ }
+ if (i == 0) {
+ cmd.push("M");
+ } else {
+ cmd.push("C");
+ var cx = x - (tension - 1) * (dx / tension);
+ cmd.push(cx + "," + dy);
+ cx = x - (dx / tension);
+ cmd.push(cx + "," + y);
+ }
+ cmd.push(x + "," + y);
+ var c = document.createElementNS(dojo.svg.xmlns.svg, "circle");
+ c.setAttribute("cx", x);
+ c.setAttribute("cy", y);
+ c.setAttribute("r", "3");
+ c.setAttribute("fill", data[i].series.color);
+ c.setAttribute("fill-opacity", "0.6");
+ c.setAttribute("stroke-width", "1");
+ c.setAttribute("stroke-opacity", "0.85");
+ line.appendChild(c);
+ if (applyTo) {
+ applyTo(c, data[i].src);
+ }
+ }
+ cmd.push("L");
+ cmd.push(x + "," + plot.axisY.getCoord(plot.axisX.origin, plotarea, plot));
+ cmd.push("L");
+ cmd.push(plot.axisX.getCoord(data[0].x, plotarea, plot) + "," + plot.axisY.getCoord(plot.axisX.origin, plotarea, plot));
+ cmd.push("Z");
+ path.setAttribute("d", cmd.join(" "));
+ return line;
+ }, HighLow:function (data, plotarea, plot, applyTo) {
+ var area = plotarea.getArea();
+ var group = document.createElementNS(dojo.svg.xmlns.svg, "g");
+ var n = data.length;
+ var part = ((area.right - area.left) / (plot.axisX.range.upper - plot.axisX.range.lower)) / 4;
+ var w = part * 2;
+ for (var i = 0; i < n; i++) {
+ var high = data[i].high;
+ var low = data[i].low;
+ if (low > high) {
+ var t = low;
+ low = high;
+ high = t;
+ }
+ var x = plot.axisX.getCoord(data[i].x, plotarea, plot) - (w / 2);
+ var y = plot.axisY.getCoord(high, plotarea, plot);
+ var h = plot.axisY.getCoord(low, plotarea, plot) - y;
+ var bar = document.createElementNS(dojo.svg.xmlns.svg, "rect");
+ bar.setAttribute("fill", data[i].series.color);
+ bar.setAttribute("stroke-width", "0");
+ bar.setAttribute("x", x);
+ bar.setAttribute("y", y);
+ bar.setAttribute("width", w);
+ bar.setAttribute("height", h);
+ bar.setAttribute("fill-opacity", "0.6");
+ if (applyTo) {
+ applyTo(bar, data[i].src);
+ }
+ group.appendChild(bar);
+ }
+ return group;
+ }, HighLowClose:function (data, plotarea, plot, applyTo) {
+ var area = plotarea.getArea();
+ var group = document.createElementNS(dojo.svg.xmlns.svg, "g");
+ var n = data.length;
+ var part = ((area.right - area.left) / (plot.axisX.range.upper - plot.axisX.range.lower)) / 4;
+ var w = part * 2;
+ for (var i = 0; i < n; i++) {
+ var high = data[i].high;
+ var low = data[i].low;
+ if (low > high) {
+ var t = low;
+ low = high;
+ high = t;
+ }
+ var c = data[i].close;
+ var x = plot.axisX.getCoord(data[i].x, plotarea, plot) - (w / 2);
+ var y = plot.axisY.getCoord(high, plotarea, plot);
+ var h = plot.axisY.getCoord(low, plotarea, plot) - y;
+ var close = plot.axisY.getCoord(c, plotarea, plot);
+ var g = document.createElementNS(dojo.svg.xmlns.svg, "g");
+ var bar = document.createElementNS(dojo.svg.xmlns.svg, "rect");
+ bar.setAttribute("fill", data[i].series.color);
+ bar.setAttribute("stroke-width", "0");
+ bar.setAttribute("x", x);
+ bar.setAttribute("y", y);
+ bar.setAttribute("width", w);
+ bar.setAttribute("height", h);
+ bar.setAttribute("fill-opacity", "0.6");
+ g.appendChild(bar);
+ var line = document.createElementNS(dojo.svg.xmlns.svg, "line");
+ line.setAttribute("x1", x);
+ line.setAttribute("x2", x + w + (part * 2));
+ line.setAttribute("y1", close);
+ line.setAttribute("y2", close);
+ line.setAttribute("style", "stroke:" + data[i].series.color + ";stroke-width:1px;stroke-opacity:0.6;");
+ g.appendChild(line);
+ if (applyTo) {
+ applyTo(g, data[i].src);
+ }
+ group.appendChild(g);
+ }
+ return group;
+ }, HighLowOpenClose:function (data, plotarea, plot, applyTo) {
+ var area = plotarea.getArea();
+ var group = document.createElementNS(dojo.svg.xmlns.svg, "g");
+ var n = data.length;
+ var part = ((area.right - area.left) / (plot.axisX.range.upper - plot.axisX.range.lower)) / 4;
+ var w = part * 2;
+ for (var i = 0; i < n; i++) {
+ var high = data[i].high;
+ var low = data[i].low;
+ if (low > high) {
+ var t = low;
+ low = high;
+ high = t;
+ }
+ var o = data[i].open;
+ var c = data[i].close;
+ var x = plot.axisX.getCoord(data[i].x, plotarea, plot) - (w / 2);
+ var y = plot.axisY.getCoord(high, plotarea, plot);
+ var h = plot.axisY.getCoord(low, plotarea, plot) - y;
+ var open = plot.axisY.getCoord(o, plotarea, plot);
+ var close = plot.axisY.getCoord(c, plotarea, plot);
+ var g = document.createElementNS(dojo.svg.xmlns.svg, "g");
+ var bar = document.createElementNS(dojo.svg.xmlns.svg, "rect");
+ bar.setAttribute("fill", data[i].series.color);
+ bar.setAttribute("stroke-width", "0");
+ bar.setAttribute("x", x);
+ bar.setAttribute("y", y);
+ bar.setAttribute("width", w);
+ bar.setAttribute("height", h);
+ bar.setAttribute("fill-opacity", "0.6");
+ g.appendChild(bar);
+ var line = document.createElementNS(dojo.svg.xmlns.svg, "line");
+ line.setAttribute("x1", x - (part * 2));
+ line.setAttribute("x2", x + w);
+ line.setAttribute("y1", open);
+ line.setAttribute("y2", open);
+ line.setAttribute("style", "stroke:" + data[i].series.color + ";stroke-width:1px;stroke-opacity:0.6;");
+ g.appendChild(line);
+ var line = document.createElementNS(dojo.svg.xmlns.svg, "line");
+ line.setAttribute("x1", x);
+ line.setAttribute("x2", x + w + (part * 2));
+ line.setAttribute("y1", close);
+ line.setAttribute("y2", close);
+ line.setAttribute("style", "stroke:" + data[i].series.color + ";stroke-width:1px;stroke-opacity:0.6;");
+ g.appendChild(line);
+ if (applyTo) {
+ applyTo(g, data[i].src);
+ }
+ group.appendChild(g);
+ }
+ return group;
+ }, Scatter:function (data, plotarea, plot, applyTo) {
+ var r = 7;
+ var group = document.createElementNS(dojo.svg.xmlns.svg, "g");
+ for (var i = 0; i < data.length; i++) {
+ var x = plot.axisX.getCoord(data[i].x, plotarea, plot);
+ var y = plot.axisY.getCoord(data[i].y, plotarea, plot);
+ var point = document.createElementNS(dojo.svg.xmlns.svg, "path");
+ point.setAttribute("fill", data[i].series.color);
+ point.setAttribute("stroke-width", "0");
+ point.setAttribute("d", "M " + x + "," + (y - r) + " " + "Q " + x + "," + y + " " + (x + r) + "," + y + " " + "Q " + x + "," + y + " " + x + "," + (y + r) + " " + "Q " + x + "," + y + " " + (x - r) + "," + y + " " + "Q " + x + "," + y + " " + x + "," + (y - r) + " " + "Z");
+ if (applyTo) {
+ applyTo(point, data[i].src);
+ }
+ group.appendChild(point);
+ }
+ return group;
+ }, Bubble:function (data, plotarea, plot, applyTo) {
+ var group = document.createElementNS(dojo.svg.xmlns.svg, "g");
+ var sizeFactor = 1;
+ for (var i = 0; i < data.length; i++) {
+ var x = plot.axisX.getCoord(data[i].x, plotarea, plot);
+ var y = plot.axisY.getCoord(data[i].y, plotarea, plot);
+ if (i == 0) {
+ var raw = data[i].size;
+ var dy = plot.axisY.getCoord(data[i].y + raw, plotarea, plot) - y;
+ sizeFactor = dy / raw;
+ }
+ if (sizeFactor < 1) {
+ sizeFactor = 1;
+ }
+ var point = document.createElementNS(dojo.svg.xmlns.svg, "circle");
+ point.setAttribute("fill", data[i].series.color);
+ point.setAttribute("fill-opacity", "0.8");
+ point.setAttribute("stroke", data[i].series.color);
+ point.setAttribute("stroke-width", "1");
+ point.setAttribute("cx", x);
+ point.setAttribute("cy", y);
+ point.setAttribute("r", (data[i].size / 2) * sizeFactor);
+ if (applyTo) {
+ applyTo(point, data[i].src);
+ }
+ group.appendChild(point);
+ }
+ return group;
+ }});
+ dojo.charting.Plotters["Default"] = dojo.charting.Plotters.Line;
+}
+
Propchange: geronimo/external/trunk/geronimo-dojo-0.4.3/src/main/webapp/src/charting/svg/Plotters.js
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: geronimo/external/trunk/geronimo-dojo-0.4.3/src/main/webapp/src/charting/svg/Plotters.js
------------------------------------------------------------------------------
svn:keywords = Date Revision
Propchange: geronimo/external/trunk/geronimo-dojo-0.4.3/src/main/webapp/src/charting/svg/Plotters.js
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: geronimo/external/trunk/geronimo-dojo-0.4.3/src/main/webapp/src/charting/vml/Axis.js
URL: http://svn.apache.org/viewvc/geronimo/external/trunk/geronimo-dojo-0.4.3/src/main/webapp/src/charting/vml/Axis.js?rev=794787&view=auto
==============================================================================
--- geronimo/external/trunk/geronimo-dojo-0.4.3/src/main/webapp/src/charting/vml/Axis.js (added)
+++ geronimo/external/trunk/geronimo-dojo-0.4.3/src/main/webapp/src/charting/vml/Axis.js Thu Jul 16 19:14:41 2009
@@ -0,0 +1,239 @@
+/*
+ Copyright (c) 2004-2006, The Dojo Foundation
+ All Rights Reserved.
+
+ Licensed under the Academic Free License version 2.1 or above OR the
+ modified BSD license. For more information on Dojo licensing, see:
+
+ http://dojotoolkit.org/community/licensing.shtml
+*/
+
+
+
+dojo.provide("dojo.charting.vml.Axis");
+dojo.require("dojo.lang.common");
+if (dojo.render.vml.capable) {
+ dojo.extend(dojo.charting.Axis, {renderLines:function (plotArea, plot, plane) {
+ if (this.nodes.lines) {
+ while (this.nodes.lines.childNodes.length > 0) {
+ this.nodes.lines.removeChild(this.nodes.lines.childNodes[0]);
+ }
+ if (this.nodes.lines.parentNode) {
+ this.nodes.lines.parentNode.removeChild(this.nodes.lines);
+ this.nodes.lines = null;
+ }
+ }
+ var area = plotArea.getArea();
+ var g = this.nodes.lines = document.createElement("div");
+ g.setAttribute("id", this.getId() + "-lines");
+ for (var i = 0; i < this._labels.length; i++) {
+ if (this._labels[i].value == this.origin) {
+ continue;
+ }
+ var v = this.getCoord(this._labels[i].value, plotArea, plot);
+ var l = document.createElement("v:line");
+ var str = document.createElement("v:stroke");
+ str.dashstyle = "dot";
+ l.appendChild(str);
+ l.setAttribute("strokecolor", "#666");
+ l.setAttribute("strokeweight", "1px");
+ var s = l.style;
+ s.position = "absolute";
+ s.top = "0px";
+ s.left = "0px";
+ s.antialias = "false";
+ if (plane == "x") {
+ l.setAttribute("from", v + "px," + area.top + "px");
+ l.setAttribute("to", v + "px," + area.bottom + "px");
+ } else {
+ if (plane == "y") {
+ l.setAttribute("from", area.left + "px," + v + "px");
+ l.setAttribute("to", area.right + "px," + v + "px");
+ }
+ }
+ g.appendChild(l);
+ }
+ return g;
+ }, renderTicks:function (plotArea, plot, plane, coord) {
+ if (this.nodes.ticks) {
+ while (this.nodes.ticks.childNodes.length > 0) {
+ this.nodes.ticks.removeChild(this.nodes.ticks.childNodes[0]);
+ }
+ if (this.nodes.ticks.parentNode) {
+ this.nodes.ticks.parentNode.removeChild(this.nodes.ticks);
+ this.nodes.ticks = null;
+ }
+ }
+ var g = this.nodes.ticks = document.createElement("div");
+ g.setAttribute("id", this.getId() + "-ticks");
+ for (var i = 0; i < this._labels.length; i++) {
+ var v = this.getCoord(this._labels[i].value, plotArea, plot);
+ var l = document.createElement("v:line");
+ l.setAttribute("strokecolor", "#000");
+ l.setAttribute("strokeweight", "1px");
+ var s = l.style;
+ s.position = "absolute";
+ s.top = "0px";
+ s.left = "0px";
+ s.antialias = "false";
+ if (plane == "x") {
+ l.setAttribute("from", v + "px," + coord + "px");
+ l.setAttribute("to", v + "px," + (coord + 3) + "px");
+ } else {
+ if (plane == "y") {
+ l.setAttribute("from", (coord - 2) + "px," + v + "px");
+ l.setAttribute("to", (coord + 2) + "px," + v + "px");
+ }
+ }
+ g.appendChild(l);
+ }
+ return g;
+ }, renderLabels:function (plotArea, plot, plane, coord, textSize, anchor) {
+ function createLabel(label, x, y, textSize, anchor) {
+ var text = document.createElement("div");
+ var s = text.style;
+ text.innerHTML = label;
+ s.fontSize = textSize + "px";
+ s.fontFamily = "sans-serif";
+ s.position = "absolute";
+ s.top = y + "px";
+ if (anchor == "center") {
+ s.left = x + "px";
+ s.textAlign = "center";
+ } else {
+ if (anchor == "left") {
+ s.left = x + "px";
+ s.textAlign = "left";
+ } else {
+ if (anchor == "right") {
+ s.right = x + "px";
+ s.textAlign = "right";
+ }
+ }
+ }
+ return text;
+ }
+ if (this.nodes.labels) {
+ while (this.nodes.labels.childNodes.length > 0) {
+ this.nodes.labels.removeChild(this.nodes.labels.childNodes[0]);
+ }
+ if (this.nodes.labels.parentNode) {
+ this.nodes.labels.parentNode.removeChild(this.nodes.labels);
+ this.nodes.labels = null;
+ }
+ }
+ var g = this.nodes.labels = document.createElement("div");
+ g.setAttribute("id", this.getId() + "-labels");
+ for (var i = 0; i < this._labels.length; i++) {
+ var v = this.getCoord(this._labels[i].value, plotArea, plot);
+ if (plane == "x") {
+ var node = createLabel(this._labels[i].label, v, coord, textSize, anchor);
+ document.body.appendChild(node);
+ node.style.left = v - (node.offsetWidth / 2) + "px";
+ g.appendChild(node);
+ } else {
+ if (plane == "y") {
+ var node = createLabel(this._labels[i].label, coord, v, textSize, anchor);
+ document.body.appendChild(node);
+ node.style.top = v - (node.offsetHeight / 2) + "px";
+ g.appendChild(node);
+ }
+ }
+ }
+ return g;
+ }, render:function (plotArea, plot, drawAgainst, plane) {
+ if (!this._rerender && this.nodes.main) {
+ return this.nodes.main;
+ }
+ this._rerender = false;
+ var area = plotArea.getArea();
+ var stroke = 1;
+ var style = "stroke:#000;stroke-width:" + stroke + "px;";
+ var textSize = 10;
+ var coord = drawAgainst.getCoord(this.origin, plotArea, plot);
+ var g = this.nodes.main = document.createElement("div");
+ g.setAttribute("id", this.getId());
+ var line = this.nodes.axis = document.createElement("v:line");
+ line.setAttribute("strokecolor", "#000");
+ line.setAttribute("strokeweight", stroke + "px");
+ var s = line.style;
+ s.position = "absolute";
+ s.top = "0px";
+ s.left = "0px";
+ s.antialias = "false";
+ if (plane == "x") {
+ line.setAttribute("from", area.left + "px," + coord + "px");
+ line.setAttribute("to", area.right + "px," + coord + "px");
+ var y = coord + Math.floor(textSize / 2);
+ if (this.showLines) {
+ g.appendChild(this.renderLines(plotArea, plot, plane, y));
+ }
+ if (this.showTicks) {
+ g.appendChild(this.renderTicks(plotArea, plot, plane, coord));
+ }
+ if (this.showLabels) {
+ g.appendChild(this.renderLabels(plotArea, plot, plane, y, textSize, "center"));
+ }
+ if (this.showLabel && this.label) {
+ var x = plotArea.size.width / 2;
+ var y = coord + Math.round(textSize * 1.5);
+ var text = document.createElement("div");
+ var s = text.style;
+ text.innerHTML = this.label;
+ s.fontSize = (textSize + 2) + "px";
+ s.fontFamily = "sans-serif";
+ s.fontWeight = "bold";
+ s.position = "absolute";
+ s.top = y + "px";
+ s.left = x + "px";
+ s.textAlign = "center";
+ document.body.appendChild(text);
+ text.style.left = x - (text.offsetWidth / 2) + "px";
+ g.appendChild(text);
+ }
+ } else {
+ line.setAttribute("from", coord + "px," + area.top + "px");
+ line.setAttribute("to", coord + "px," + area.bottom + "px");
+ var isMax = this.origin == drawAgainst.range.upper;
+ var x = coord + 4;
+ var anchor = "left";
+ if (!isMax) {
+ x = area.right - coord + textSize + 4;
+ anchor = "right";
+ if (coord == area.left) {
+ x += (textSize * 2) - (textSize / 2);
+ }
+ }
+ if (this.showLines) {
+ g.appendChild(this.renderLines(plotArea, plot, plane, x));
+ }
+ if (this.showTicks) {
+ g.appendChild(this.renderTicks(plotArea, plot, plane, coord));
+ }
+ if (this.showLabels) {
+ g.appendChild(this.renderLabels(plotArea, plot, plane, x, textSize, anchor));
+ }
+ if (this.showLabel && this.label) {
+ x += (textSize * 2) - 2;
+ var y = plotArea.size.height / 2;
+ var text = document.createElement("div");
+ var s = text.style;
+ text.innerHTML = this.label;
+ s.fontSize = (textSize + 2) + "px";
+ s.fontFamily = "sans-serif";
+ s.fontWeight = "bold";
+ s.position = "absolute";
+ s.height = plotArea.size.height + "px";
+ s.writingMode = "tb-rl";
+ s.textAlign = "center";
+ s[anchor] = x + "px";
+ document.body.appendChild(text);
+ s.top = y - (text.offsetHeight / 2) + "px";
+ g.appendChild(text);
+ }
+ }
+ g.appendChild(line);
+ return g;
+ }});
+}
+
Propchange: geronimo/external/trunk/geronimo-dojo-0.4.3/src/main/webapp/src/charting/vml/Axis.js
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: geronimo/external/trunk/geronimo-dojo-0.4.3/src/main/webapp/src/charting/vml/Axis.js
------------------------------------------------------------------------------
svn:keywords = Date Revision
Propchange: geronimo/external/trunk/geronimo-dojo-0.4.3/src/main/webapp/src/charting/vml/Axis.js
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: geronimo/external/trunk/geronimo-dojo-0.4.3/src/main/webapp/src/charting/vml/PlotArea.js
URL: http://svn.apache.org/viewvc/geronimo/external/trunk/geronimo-dojo-0.4.3/src/main/webapp/src/charting/vml/PlotArea.js?rev=794787&view=auto
==============================================================================
--- geronimo/external/trunk/geronimo-dojo-0.4.3/src/main/webapp/src/charting/vml/PlotArea.js (added)
+++ geronimo/external/trunk/geronimo-dojo-0.4.3/src/main/webapp/src/charting/vml/PlotArea.js Thu Jul 16 19:14:41 2009
@@ -0,0 +1,69 @@
+/*
+ Copyright (c) 2004-2006, The Dojo Foundation
+ All Rights Reserved.
+
+ Licensed under the Academic Free License version 2.1 or above OR the
+ modified BSD license. For more information on Dojo licensing, see:
+
+ http://dojotoolkit.org/community/licensing.shtml
+*/
+
+
+
+dojo.provide("dojo.charting.vml.PlotArea");
+dojo.require("dojo.lang.common");
+if (dojo.render.vml.capable) {
+ dojo.extend(dojo.charting.PlotArea, {resize:function () {
+ var a = this.getArea();
+ this.nodes.area.style.width = this.size.width + "px";
+ this.nodes.area.style.height = this.size.height + "px";
+ this.nodes.background.style.width = this.size.width + "px";
+ this.nodes.background.style.height = this.size.height + "px";
+ this.nodes.plots.width = this.size.width + "px";
+ this.nodes.plots.height = this.size.height + "px";
+ this.nodes.plots.style.clip = "rect(" + a.top + " " + a.right + " " + a.bottom + " " + a.left + ")";
+ if (this.nodes.axes) {
+ this.nodes.area.removeChild(this.nodes.axes);
+ }
+ var axes = this.nodes.axes = document.createElement("div");
+ axes.id = this.getId() + "-axes";
+ this.nodes.area.appendChild(axes);
+ var ax = this.getAxes();
+ for (var p in ax) {
+ var obj = ax[p];
+ axes.appendChild(obj.axis.initialize(this, obj.plot, obj.drawAgainst, obj.plane));
+ }
+ }, initializePlot:function (plot) {
+ plot.destroy();
+ plot.dataNode = document.createElement("div");
+ plot.dataNode.id = plot.getId();
+ return plot.dataNode;
+ }, initialize:function () {
+ this.destroy();
+ var main = this.nodes.main = document.createElement("div");
+ var area = this.nodes.area = document.createElement("div");
+ area.id = this.getId();
+ area.style.position = "absolute";
+ main.appendChild(area);
+ var bg = this.nodes.background = document.createElement("div");
+ bg.id = this.getId() + "-background";
+ bg.style.position = "absolute";
+ bg.style.top = "0px";
+ bg.style.left = "0px";
+ bg.style.backgroundColor = "#fff";
+ area.appendChild(bg);
+ var a = this.getArea();
+ var plots = this.nodes.plots = document.createElement("div");
+ plots.id = this.getId() + "-plots";
+ plots.style.position = "absolute";
+ plots.style.top = "0px";
+ plots.style.left = "0px";
+ area.appendChild(plots);
+ for (var i = 0; i < this.plots.length; i++) {
+ plots.appendChild(this.initializePlot(this.plots[i]));
+ }
+ this.resize();
+ return main;
+ }});
+}
+
Propchange: geronimo/external/trunk/geronimo-dojo-0.4.3/src/main/webapp/src/charting/vml/PlotArea.js
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: geronimo/external/trunk/geronimo-dojo-0.4.3/src/main/webapp/src/charting/vml/PlotArea.js
------------------------------------------------------------------------------
svn:keywords = Date Revision
Propchange: geronimo/external/trunk/geronimo-dojo-0.4.3/src/main/webapp/src/charting/vml/PlotArea.js
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: geronimo/external/trunk/geronimo-dojo-0.4.3/src/main/webapp/src/charting/vml/Plotters.js
URL: http://svn.apache.org/viewvc/geronimo/external/trunk/geronimo-dojo-0.4.3/src/main/webapp/src/charting/vml/Plotters.js?rev=794787&view=auto
==============================================================================
--- geronimo/external/trunk/geronimo-dojo-0.4.3/src/main/webapp/src/charting/vml/Plotters.js (added)
+++ geronimo/external/trunk/geronimo-dojo-0.4.3/src/main/webapp/src/charting/vml/Plotters.js Thu Jul 16 19:14:41 2009
@@ -0,0 +1,889 @@
+/*
+ Copyright (c) 2004-2006, The Dojo Foundation
+ All Rights Reserved.
+
+ Licensed under the Academic Free License version 2.1 or above OR the
+ modified BSD license. For more information on Dojo licensing, see:
+
+ http://dojotoolkit.org/community/licensing.shtml
+*/
+
+
+
+dojo.provide("dojo.charting.vml.Plotters");
+dojo.require("dojo.lang.common");
+if (dojo.render.vml.capable) {
+ dojo.mixin(dojo.charting.Plotters, {_group:function (plotarea) {
+ var group = document.createElement("div");
+ group.style.position = "absolute";
+ group.style.top = "0px";
+ group.style.left = "0px";
+ group.style.width = plotarea.size.width + "px";
+ group.style.height = plotarea.size.height + "px";
+ return group;
+ }, Bar:function (plotarea, plot, kwArgs, applyTo) {
+ var area = plotarea.getArea();
+ var group = dojo.charting.Plotters._group(plotarea);
+ var n = plot.series.length;
+ var data = [];
+ for (var i = 0; i < n; i++) {
+ var tmp = plot.series[i].data.evaluate(kwArgs);
+ data.push(tmp);
+ }
+ var space = 8;
+ var nPoints = data[0].length;
+ if (nPoints == 0) {
+ return group;
+ }
+ var width = ((area.right - area.left) - (space * (nPoints - 1))) / nPoints;
+ var barWidth = Math.round(width / n);
+ var yOrigin = plot.axisY.getCoord(plot.axisX.origin, plotarea, plot);
+ for (var i = 0; i < nPoints; i++) {
+ var xStart = area.left + (width * i) + (space * i);
+ for (var j = 0; j < n; j++) {
+ var value = data[j][i].y;
+ var yA = yOrigin;
+ var x = xStart + (barWidth * j);
+ var y = plot.axisY.getCoord(value, plotarea, plot);
+ var h = Math.abs(yA - y);
+ if (value < plot.axisX.origin) {
+ yA = y;
+ y = yOrigin;
+ }
+ var bar = document.createElement("v:rect");
+ bar.style.position = "absolute";
+ bar.style.top = y + 1 + "px";
+ bar.style.left = x + "px";
+ bar.style.width = barWidth + "px";
+ bar.style.height = h + "px";
+ bar.setAttribute("fillColor", data[j][i].series.color);
+ bar.setAttribute("stroked", "false");
+ bar.style.antialias = "false";
+ var fill = document.createElement("v:fill");
+ fill.setAttribute("opacity", "0.6");
+ bar.appendChild(fill);
+ if (applyTo) {
+ applyTo(bar, data[j][i].src);
+ }
+ group.appendChild(bar);
+ }
+ }
+ return group;
+ }, HorizontalBar:function (plotarea, plot, kwArgs, applyTo) {
+ var area = plotarea.getArea();
+ var group = dojo.charting.Plotters._group(plotarea);
+ var n = plot.series.length;
+ var data = [];
+ for (var i = 0; i < n; i++) {
+ var tmp = plot.series[i].data.evaluate(kwArgs);
+ data.push(tmp);
+ }
+ var space = 6;
+ var nPoints = data[0].length;
+ if (nPoints == 0) {
+ return group;
+ }
+ var h = ((area.bottom - area.top) - (space * (nPoints - 1))) / nPoints;
+ var barH = h / n;
+ var xOrigin = plot.axisX.getCoord(0, plotarea, plot);
+ for (var i = 0; i < nPoints; i++) {
+ var yStart = area.top + (h * i) + (space * i);
+ for (var j = 0; j < n; j++) {
+ var value = data[j][i].y;
+ var y = yStart + (barH * j);
+ var xA = xOrigin;
+ var x = plot.axisX.getCoord(value, plotarea, plot);
+ var w = Math.abs(x - xA);
+ if (value > 0) {
+ x = xOrigin;
+ }
+ var bar = document.createElement("v:rect");
+ bar.style.position = "absolute";
+ bar.style.top = y + 1 + "px";
+ bar.style.left = xA + "px";
+ bar.style.width = w + "px";
+ bar.style.height = barH + "px";
+ bar.setAttribute("fillColor", data[j][i].series.color);
+ bar.setAttribute("stroked", "false");
+ bar.style.antialias = "false";
+ var fill = document.createElement("v:fill");
+ fill.setAttribute("opacity", "0.6");
+ bar.appendChild(fill);
+ if (applyTo) {
+ applyTo(bar, data[j][i].src);
+ }
+ group.appendChild(bar);
+ }
+ }
+ var space = 4;
+ var n = plot.series.length;
+ var h = ((area.bottom - area.top) - (space * (n - 1))) / n;
+ var xOrigin = plot.axisX.getCoord(0, plotarea, plot);
+ for (var i = 0; i < n; i++) {
+ var series = plot.series[i];
+ var data = series.data.evaluate(kwArgs);
+ var y = area.top + (h * i) + (space * i);
+ var value = data[data.length - 1].y;
+ var xA = xOrigin;
+ var x = plot.axisX.getCoord(value, plotarea, plot);
+ var w = Math.abs(xA - x);
+ if (value > 0) {
+ xA = x;
+ x = xOrigin;
+ }
+ }
+ return group;
+ }, Gantt:function (plotarea, plot, kwArgs, applyTo) {
+ var area = plotarea.getArea();
+ var group = dojo.charting.Plotters._group(plotarea);
+ var n = plot.series.length;
+ var data = [];
+ for (var i = 0; i < n; i++) {
+ var tmp = plot.series[i].data.evaluate(kwArgs);
+ data.push(tmp);
+ }
+ var space = 2;
+ var nPoints = data[0].length;
+ if (nPoints == 0) {
+ return group;
+ }
+ var h = ((area.bottom - area.top) - (space * (nPoints - 1))) / nPoints;
+ var barH = h / n;
+ for (var i = 0; i < nPoints; i++) {
+ var yStart = area.top + (h * i) + (space * i);
+ for (var j = 0; j < n; j++) {
+ var high = data[j][i].high;
+ var low = data[j][i].low;
+ if (low > high) {
+ var t = high;
+ high = low;
+ low = t;
+ }
+ var x = plot.axisX.getCoord(low, plotarea, plot);
+ var w = plot.axisX.getCoord(high, plotarea, plot) - x;
+ var y = yStart + (barH * j);
+ var bar = document.createElement("v:rect");
+ bar.style.position = "absolute";
+ bar.style.top = y + 1 + "px";
+ bar.style.left = x + "px";
+ bar.style.width = w + "px";
+ bar.style.height = barH + "px";
+ bar.setAttribute("fillColor", data[j][i].series.color);
+ bar.setAttribute("stroked", "false");
+ bar.style.antialias = "false";
+ var fill = document.createElement("v:fill");
+ fill.setAttribute("opacity", "0.6");
+ bar.appendChild(fill);
+ if (applyTo) {
+ applyTo(bar, data[j][i].src);
+ }
+ group.appendChild(bar);
+ }
+ }
+ return group;
+ }, StackedArea:function (plotarea, plot, kwArgs, applyTo) {
+ var area = plotarea.getArea();
+ var group = dojo.charting.Plotters._group(plotarea);
+ var n = plot.series.length;
+ var data = [];
+ var totals = [];
+ for (var i = 0; i < n; i++) {
+ var tmp = plot.series[i].data.evaluate(kwArgs);
+ for (var j = 0; j < tmp.length; j++) {
+ if (i == 0) {
+ totals.push(tmp[j].y);
+ } else {
+ totals[j] += tmp[j].y;
+ }
+ tmp[j].y = totals[j];
+ }
+ data.push(tmp);
+ }
+ for (var i = n - 1; i >= 0; i--) {
+ var path = document.createElement("v:shape");
+ path.setAttribute("strokeweight", "1px");
+ path.setAttribute("strokecolor", data[i][0].series.color);
+ path.setAttribute("fillcolor", data[i][0].series.color);
+ path.setAttribute("coordsize", (area.right - area.left) + "," + (area.bottom - area.top));
+ path.style.position = "absolute";
+ path.style.top = "0px";
+ path.style.left = "0px";
+ path.style.width = area.right - area.left + "px";
+ path.style.height = area.bottom - area.top + "px";
+ var stroke = document.createElement("v:stroke");
+ stroke.setAttribute("opacity", "0.8");
+ path.appendChild(stroke);
+ var fill = document.createElement("v:fill");
+ fill.setAttribute("opacity", "0.4");
+ path.appendChild(fill);
+ var cmd = [];
+ var r = 3;
+ for (var j = 0; j < data[i].length; j++) {
+ var values = data[i];
+ var x = Math.round(plot.axisX.getCoord(values[j].x, plotarea, plot));
+ var y = Math.round(plot.axisY.getCoord(values[j].y, plotarea, plot));
+ if (j == 0) {
+ cmd.push("m");
+ cmd.push(x + "," + y);
+ } else {
+ cmd.push("l");
+ cmd.push(x + "," + y);
+ }
+ var c = document.createElement("v:oval");
+ c.setAttribute("strokeweight", "1px");
+ c.setAttribute("strokecolor", values[j].series.color);
+ c.setAttribute("fillcolor", values[j].series.color);
+ var str = document.createElement("v:stroke");
+ str.setAttribute("opacity", "0.8");
+ c.appendChild(str);
+ str = document.createElement("v:fill");
+ str.setAttribute("opacity", "0.6");
+ c.appendChild(str);
+ var s = c.style;
+ s.position = "absolute";
+ s.top = (y - r) + "px";
+ s.left = (x - r) + "px";
+ s.width = (r * 2) + "px";
+ s.height = (r * 2) + "px";
+ group.appendChild(c);
+ if (applyTo) {
+ applyTo(c, data[j].src);
+ }
+ }
+ if (i == 0) {
+ cmd.push("l");
+ cmd.push(x + "," + Math.round(plot.axisY.getCoord(plot.axisX.origin, plotarea, plot)));
+ cmd.push("l");
+ cmd.push(Math.round(plot.axisX.getCoord(data[0][0].x, plotarea, plot)) + "," + Math.round(plot.axisY.getCoord(plot.axisX.origin, plotarea, plot)));
+ } else {
+ var values = data[i - 1];
+ cmd.push("l");
+ cmd.push(x + "," + Math.round(plot.axisY.getCoord(values[values.length - 1].y, plotarea, plot)));
+ for (var j = values.length - 2; j >= 0; j--) {
+ var x = Math.round(plot.axisX.getCoord(values[j].x, plotarea, plot));
+ var y = Math.round(plot.axisY.getCoord(values[j].y, plotarea, plot));
+ cmd.push("l");
+ cmd.push(x + "," + y);
+ }
+ }
+ path.setAttribute("path", cmd.join(" ") + " x e");
+ group.appendChild(path);
+ }
+ return group;
+ }, StackedCurvedArea:function (plotarea, plot, kwArgs, applyTo) {
+ var tension = 3;
+ var area = plotarea.getArea();
+ var group = dojo.charting.Plotters._group(plotarea);
+ var n = plot.series.length;
+ var data = [];
+ var totals = [];
+ for (var i = 0; i < n; i++) {
+ var tmp = plot.series[i].data.evaluate(kwArgs);
+ for (var j = 0; j < tmp.length; j++) {
+ if (i == 0) {
+ totals.push(tmp[j].y);
+ } else {
+ totals[j] += tmp[j].y;
+ }
+ tmp[j].y = totals[j];
+ }
+ data.push(tmp);
+ }
+ for (var i = n - 1; i >= 0; i--) {
+ var path = document.createElement("v:shape");
+ path.setAttribute("strokeweight", "1px");
+ path.setAttribute("strokecolor", data[i][0].series.color);
+ path.setAttribute("fillcolor", data[i][0].series.color);
+ path.setAttribute("coordsize", (area.right - area.left) + "," + (area.bottom - area.top));
+ path.style.position = "absolute";
+ path.style.top = "0px";
+ path.style.left = "0px";
+ path.style.width = area.right - area.left + "px";
+ path.style.height = area.bottom - area.top + "px";
+ var stroke = document.createElement("v:stroke");
+ stroke.setAttribute("opacity", "0.8");
+ path.appendChild(stroke);
+ var fill = document.createElement("v:fill");
+ fill.setAttribute("opacity", "0.4");
+ path.appendChild(fill);
+ var cmd = [];
+ var r = 3;
+ for (var j = 0; j < data[i].length; j++) {
+ var values = data[i];
+ var x = Math.round(plot.axisX.getCoord(values[j].x, plotarea, plot));
+ var y = Math.round(plot.axisY.getCoord(values[j].y, plotarea, plot));
+ if (j == 0) {
+ cmd.push("m");
+ cmd.push(x + "," + y);
+ } else {
+ var lastx = Math.round(plot.axisX.getCoord(values[j - 1].x, plotarea, plot));
+ var lasty = Math.round(plot.axisY.getCoord(values[j - 1].y, plotarea, plot));
+ var dx = x - lastx;
+ var dy = y - lasty;
+ cmd.push("c");
+ var cx = Math.round((x - (tension - 1) * (dx / tension)));
+ cmd.push(cx + "," + lasty);
+ cx = Math.round((x - (dx / tension)));
+ cmd.push(cx + "," + y);
+ cmd.push(x + "," + y);
+ }
+ var c = document.createElement("v:oval");
+ c.setAttribute("strokeweight", "1px");
+ c.setAttribute("strokecolor", values[j].series.color);
+ c.setAttribute("fillcolor", values[j].series.color);
+ var str = document.createElement("v:stroke");
+ str.setAttribute("opacity", "0.8");
+ c.appendChild(str);
+ str = document.createElement("v:fill");
+ str.setAttribute("opacity", "0.6");
+ c.appendChild(str);
+ var s = c.style;
+ s.position = "absolute";
+ s.top = (y - r) + "px";
+ s.left = (x - r) + "px";
+ s.width = (r * 2) + "px";
+ s.height = (r * 2) + "px";
+ group.appendChild(c);
+ if (applyTo) {
+ applyTo(c, data[j].src);
+ }
+ }
+ if (i == 0) {
+ cmd.push("l");
+ cmd.push(x + "," + Math.round(plot.axisY.getCoord(plot.axisX.origin, plotarea, plot)));
+ cmd.push("l");
+ cmd.push(Math.round(plot.axisX.getCoord(data[0][0].x, plotarea, plot)) + "," + Math.round(plot.axisY.getCoord(plot.axisX.origin, plotarea, plot)));
+ } else {
+ var values = data[i - 1];
+ cmd.push("l");
+ cmd.push(x + "," + Math.round(plot.axisY.getCoord(values[values.length - 1].y, plotarea, plot)));
+ for (var j = values.length - 2; j >= 0; j--) {
+ var x = Math.round(plot.axisX.getCoord(values[j].x, plotarea, plot));
+ var y = Math.round(plot.axisY.getCoord(values[j].y, plotarea, plot));
+ var lastx = Math.round(plot.axisX.getCoord(values[j + 1].x, plotarea, plot));
+ var lasty = Math.round(plot.axisY.getCoord(values[j + 1].y, plotarea, plot));
+ var dx = x - lastx;
+ var dy = y - lasty;
+ cmd.push("c");
+ var cx = Math.round((x - (tension - 1) * (dx / tension)));
+ cmd.push(cx + "," + lasty);
+ cx = Math.round((x - (dx / tension)));
+ cmd.push(cx + "," + y);
+ cmd.push(x + "," + y);
+ }
+ }
+ path.setAttribute("path", cmd.join(" ") + " x e");
+ group.appendChild(path);
+ }
+ return group;
+ }, DataBar:function (data, plotarea, plot, applyTo) {
+ var area = plotarea.getArea();
+ var group = dojo.charting.Plotters._group(plotarea);
+ var n = data.length;
+ var w = (area.right - area.left) / (plot.axisX.range.upper - plot.axisX.range.lower);
+ var yOrigin = plot.axisY.getCoord(plot.axisX.origin, plotarea, plot);
+ for (var i = 0; i < n; i++) {
+ var value = data[i].y;
+ var yA = yOrigin;
+ var x = plot.axisX.getCoord(data[i].x, plotarea, plot) - (w / 2) + 1;
+ var y = plot.axisY.getCoord(value, plotarea, plot);
+ var h = Math.abs(yA - y);
+ if (value < plot.axisX.origin) {
+ yA = y;
+ y = yOrigin;
+ }
+ var bar = document.createElement("v:rect");
+ bar.style.position = "absolute";
+ bar.style.top = y + 1 + "px";
+ bar.style.left = x + "px";
+ bar.style.width = w + "px";
+ bar.style.height = h + "px";
+ bar.setAttribute("fillColor", data[i].series.color);
+ bar.setAttribute("stroked", "false");
+ bar.style.antialias = "false";
+ var fill = document.createElement("v:fill");
+ fill.setAttribute("opacity", "0.6");
+ bar.appendChild(fill);
+ if (applyTo) {
+ applyTo(bar, data[i].src);
+ }
+ group.appendChild(bar);
+ }
+ return group;
+ }, Line:function (data, plotarea, plot, applyTo) {
+ var area = plotarea.getArea();
+ var group = dojo.charting.Plotters._group(plotarea);
+ if (data.length == 0) {
+ return group;
+ }
+ var path = document.createElement("v:shape");
+ path.setAttribute("strokeweight", "2px");
+ path.setAttribute("strokecolor", data[0].series.color);
+ path.setAttribute("fillcolor", "none");
+ path.setAttribute("filled", "false");
+ path.setAttribute("coordsize", (area.right - area.left) + "," + (area.bottom - area.top));
+ path.style.position = "absolute";
+ path.style.top = "0px";
+ path.style.left = "0px";
+ path.style.width = area.right - area.left + "px";
+ path.style.height = area.bottom - area.top + "px";
+ var stroke = document.createElement("v:stroke");
+ stroke.setAttribute("opacity", "0.8");
+ path.appendChild(stroke);
+ var cmd = [];
+ var r = 3;
+ for (var i = 0; i < data.length; i++) {
+ var x = Math.round(plot.axisX.getCoord(data[i].x, plotarea, plot));
+ var y = Math.round(plot.axisY.getCoord(data[i].y, plotarea, plot));
+ if (i == 0) {
+ cmd.push("m");
+ cmd.push(x + "," + y);
+ } else {
+ cmd.push("l");
+ cmd.push(x + "," + y);
+ }
+ var c = document.createElement("v:oval");
+ c.setAttribute("strokeweight", "1px");
+ c.setAttribute("strokecolor", data[i].series.color);
+ c.setAttribute("fillcolor", data[i].series.color);
+ var str = document.createElement("v:stroke");
+ str.setAttribute("opacity", "0.8");
+ c.appendChild(str);
+ str = document.createElement("v:fill");
+ str.setAttribute("opacity", "0.6");
+ c.appendChild(str);
+ var s = c.style;
+ s.position = "absolute";
+ s.top = (y - r) + "px";
+ s.left = (x - r) + "px";
+ s.width = (r * 2) + "px";
+ s.height = (r * 2) + "px";
+ group.appendChild(c);
+ if (applyTo) {
+ applyTo(c, data[i].src);
+ }
+ }
+ path.setAttribute("path", cmd.join(" ") + " e");
+ group.appendChild(path);
+ return group;
+ }, CurvedLine:function (data, plotarea, plot, applyTo) {
+ var tension = 3;
+ var area = plotarea.getArea();
+ var group = dojo.charting.Plotters._group(plotarea);
+ if (data.length == 0) {
+ return group;
+ }
+ var path = document.createElement("v:shape");
+ path.setAttribute("strokeweight", "2px");
+ path.setAttribute("strokecolor", data[0].series.color);
+ path.setAttribute("fillcolor", "none");
+ path.setAttribute("filled", "false");
+ path.setAttribute("coordsize", (area.right - area.left) + "," + (area.bottom - area.top));
+ path.style.position = "absolute";
+ path.style.top = "0px";
+ path.style.left = "0px";
+ path.style.width = area.right - area.left + "px";
+ path.style.height = area.bottom - area.top + "px";
+ var stroke = document.createElement("v:stroke");
+ stroke.setAttribute("opacity", "0.8");
+ path.appendChild(stroke);
+ var cmd = [];
+ var r = 3;
+ for (var i = 0; i < data.length; i++) {
+ var x = Math.round(plot.axisX.getCoord(data[i].x, plotarea, plot));
+ var y = Math.round(plot.axisY.getCoord(data[i].y, plotarea, plot));
+ if (i == 0) {
+ cmd.push("m");
+ cmd.push(x + "," + y);
+ } else {
+ var lastx = Math.round(plot.axisX.getCoord(data[i - 1].x, plotarea, plot));
+ var lasty = Math.round(plot.axisY.getCoord(data[i - 1].y, plotarea, plot));
+ var dx = x - lastx;
+ var dy = y - lasty;
+ cmd.push("c");
+ var cx = Math.round((x - (tension - 1) * (dx / tension)));
+ cmd.push(cx + "," + lasty);
+ cx = Math.round((x - (dx / tension)));
+ cmd.push(cx + "," + y);
+ cmd.push(x + "," + y);
+ }
+ var c = document.createElement("v:oval");
+ c.setAttribute("strokeweight", "1px");
+ c.setAttribute("strokecolor", data[i].series.color);
+ c.setAttribute("fillcolor", data[i].series.color);
+ var str = document.createElement("v:stroke");
+ str.setAttribute("opacity", "0.8");
+ c.appendChild(str);
+ str = document.createElement("v:fill");
+ str.setAttribute("opacity", "0.6");
+ c.appendChild(str);
+ var s = c.style;
+ s.position = "absolute";
+ s.top = (y - r) + "px";
+ s.left = (x - r) + "px";
+ s.width = (r * 2) + "px";
+ s.height = (r * 2) + "px";
+ group.appendChild(c);
+ if (applyTo) {
+ applyTo(c, data[i].src);
+ }
+ }
+ path.setAttribute("path", cmd.join(" ") + " e");
+ group.appendChild(path);
+ return group;
+ }, Area:function (data, plotarea, plot, applyTo) {
+ var area = plotarea.getArea();
+ var group = dojo.charting.Plotters._group(plotarea);
+ if (data.length == 0) {
+ return group;
+ }
+ var path = document.createElement("v:shape");
+ path.setAttribute("strokeweight", "1px");
+ path.setAttribute("strokecolor", data[0].series.color);
+ path.setAttribute("fillcolor", data[0].series.color);
+ path.setAttribute("coordsize", (area.right - area.left) + "," + (area.bottom - area.top));
+ path.style.position = "absolute";
+ path.style.top = "0px";
+ path.style.left = "0px";
+ path.style.width = area.right - area.left + "px";
+ path.style.height = area.bottom - area.top + "px";
+ var stroke = document.createElement("v:stroke");
+ stroke.setAttribute("opacity", "0.8");
+ path.appendChild(stroke);
+ var fill = document.createElement("v:fill");
+ fill.setAttribute("opacity", "0.4");
+ path.appendChild(fill);
+ var cmd = [];
+ var r = 3;
+ for (var i = 0; i < data.length; i++) {
+ var x = Math.round(plot.axisX.getCoord(data[i].x, plotarea, plot));
+ var y = Math.round(plot.axisY.getCoord(data[i].y, plotarea, plot));
+ if (i == 0) {
+ cmd.push("m");
+ cmd.push(x + "," + y);
+ } else {
+ cmd.push("l");
+ cmd.push(x + "," + y);
+ }
+ var c = document.createElement("v:oval");
+ c.setAttribute("strokeweight", "1px");
+ c.setAttribute("strokecolor", data[i].series.color);
+ c.setAttribute("fillcolor", data[i].series.color);
+ var str = document.createElement("v:stroke");
+ str.setAttribute("opacity", "0.8");
+ c.appendChild(str);
+ str = document.createElement("v:fill");
+ str.setAttribute("opacity", "0.6");
+ c.appendChild(str);
+ var s = c.style;
+ s.position = "absolute";
+ s.top = (y - r) + "px";
+ s.left = (x - r) + "px";
+ s.width = (r * 2) + "px";
+ s.height = (r * 2) + "px";
+ group.appendChild(c);
+ if (applyTo) {
+ applyTo(c, data[i].src);
+ }
+ }
+ cmd.push("l");
+ cmd.push(x + "," + Math.round(plot.axisY.getCoord(plot.axisX.origin, plotarea, plot)));
+ cmd.push("l");
+ cmd.push(Math.round(plot.axisX.getCoord(data[0].x, plotarea, plot)) + "," + Math.round(plot.axisY.getCoord(plot.axisX.origin, plotarea, plot)));
+ path.setAttribute("path", cmd.join(" ") + " x e");
+ group.appendChild(path);
+ return group;
+ }, CurvedArea:function (data, plotarea, plot, applyTo) {
+ var tension = 3;
+ var area = plotarea.getArea();
+ var group = dojo.charting.Plotters._group(plotarea);
+ if (data.length == 0) {
+ return group;
+ }
+ var path = document.createElement("v:shape");
+ path.setAttribute("strokeweight", "1px");
+ path.setAttribute("strokecolor", data[0].series.color);
+ path.setAttribute("fillcolor", data[0].series.color);
+ path.setAttribute("coordsize", (area.right - area.left) + "," + (area.bottom - area.top));
+ path.style.position = "absolute";
+ path.style.top = "0px";
+ path.style.left = "0px";
+ path.style.width = area.right - area.left + "px";
+ path.style.height = area.bottom - area.top + "px";
+ var stroke = document.createElement("v:stroke");
+ stroke.setAttribute("opacity", "0.8");
+ path.appendChild(stroke);
+ var fill = document.createElement("v:fill");
+ fill.setAttribute("opacity", "0.4");
+ path.appendChild(fill);
+ var cmd = [];
+ var r = 3;
+ for (var i = 0; i < data.length; i++) {
+ var x = Math.round(plot.axisX.getCoord(data[i].x, plotarea, plot));
+ var y = Math.round(plot.axisY.getCoord(data[i].y, plotarea, plot));
+ if (i == 0) {
+ cmd.push("m");
+ cmd.push(x + "," + y);
+ } else {
+ var lastx = Math.round(plot.axisX.getCoord(data[i - 1].x, plotarea, plot));
+ var lasty = Math.round(plot.axisY.getCoord(data[i - 1].y, plotarea, plot));
+ var dx = x - lastx;
+ var dy = y - lasty;
+ cmd.push("c");
+ var cx = Math.round((x - (tension - 1) * (dx / tension)));
+ cmd.push(cx + "," + lasty);
+ cx = Math.round((x - (dx / tension)));
+ cmd.push(cx + "," + y);
+ cmd.push(x + "," + y);
+ }
+ var c = document.createElement("v:oval");
+ c.setAttribute("strokeweight", "1px");
+ c.setAttribute("strokecolor", data[i].series.color);
+ c.setAttribute("fillcolor", data[i].series.color);
+ var str = document.createElement("v:stroke");
+ str.setAttribute("opacity", "0.8");
+ c.appendChild(str);
+ str = document.createElement("v:fill");
+ str.setAttribute("opacity", "0.6");
+ c.appendChild(str);
+ var s = c.style;
+ s.position = "absolute";
+ s.top = (y - r) + "px";
+ s.left = (x - r) + "px";
+ s.width = (r * 2) + "px";
+ s.height = (r * 2) + "px";
+ group.appendChild(c);
+ if (applyTo) {
+ applyTo(c, data[i].src);
+ }
+ }
+ cmd.push("l");
+ cmd.push(x + "," + Math.round(plot.axisY.getCoord(plot.axisX.origin, plotarea, plot)));
+ cmd.push("l");
+ cmd.push(Math.round(plot.axisX.getCoord(data[0].x, plotarea, plot)) + "," + Math.round(plot.axisY.getCoord(plot.axisX.origin, plotarea, plot)));
+ path.setAttribute("path", cmd.join(" ") + " x e");
+ group.appendChild(path);
+ return group;
+ }, HighLow:function (data, plotarea, plot, applyTo) {
+ var area = plotarea.getArea();
+ var group = dojo.charting.Plotters._group(plotarea);
+ var n = data.length;
+ var part = ((area.right - area.left) / (plot.axisX.range.upper - plot.axisX.range.lower)) / 4;
+ var w = part * 2;
+ for (var i = 0; i < n; i++) {
+ var high = data[i].high;
+ var low = data[i].low;
+ if (low > high) {
+ var t = low;
+ low = high;
+ high = t;
+ }
+ var x = plot.axisX.getCoord(data[i].x, plotarea, plot) - (w / 2);
+ var y = plot.axisY.getCoord(high, plotarea, plot);
+ var h = plot.axisY.getCoord(low, plotarea, plot) - y;
+ var bar = document.createElement("v:rect");
+ bar.style.position = "absolute";
+ bar.style.top = y + 1 + "px";
+ bar.style.left = x + "px";
+ bar.style.width = w + "px";
+ bar.style.height = h + "px";
+ bar.setAttribute("fillColor", data[i].series.color);
+ bar.setAttribute("stroked", "false");
+ bar.style.antialias = "false";
+ var fill = document.createElement("v:fill");
+ fill.setAttribute("opacity", "0.6");
+ bar.appendChild(fill);
+ if (applyTo) {
+ applyTo(bar, data[i].src);
+ }
+ group.appendChild(bar);
+ }
+ return group;
+ }, HighLowClose:function (data, plotarea, plot, applyTo) {
+ var area = plotarea.getArea();
+ var group = dojo.charting.Plotters._group(plotarea);
+ var n = data.length;
+ var part = ((area.right - area.left) / (plot.axisX.range.upper - plot.axisX.range.lower)) / 4;
+ var w = part * 2;
+ for (var i = 0; i < n; i++) {
+ var high = data[i].high;
+ var low = data[i].low;
+ if (low > high) {
+ var t = low;
+ low = high;
+ high = t;
+ }
+ var c = data[i].close;
+ var x = plot.axisX.getCoord(data[i].x, plotarea, plot) - (w / 2);
+ var y = plot.axisY.getCoord(high, plotarea, plot);
+ var h = plot.axisY.getCoord(low, plotarea, plot) - y;
+ var close = plot.axisY.getCoord(c, plotarea, plot);
+ var g = document.createElement("div");
+ var bar = document.createElement("v:rect");
+ bar.style.position = "absolute";
+ bar.style.top = y + 1 + "px";
+ bar.style.left = x + "px";
+ bar.style.width = w + "px";
+ bar.style.height = h + "px";
+ bar.setAttribute("fillColor", data[i].series.color);
+ bar.setAttribute("stroked", "false");
+ bar.style.antialias = "false";
+ var fill = document.createElement("v:fill");
+ fill.setAttribute("opacity", "0.6");
+ bar.appendChild(fill);
+ g.appendChild(bar);
+ var line = document.createElement("v:line");
+ line.setAttribute("strokecolor", data[i].series.color);
+ line.setAttribute("strokeweight", "1px");
+ line.setAttribute("from", x + "px," + close + "px");
+ line.setAttribute("to", (x + w + (part * 2) - 2) + "px," + close + "px");
+ var s = line.style;
+ s.position = "absolute";
+ s.top = "0px";
+ s.left = "0px";
+ s.antialias = "false";
+ var str = document.createElement("v:stroke");
+ str.setAttribute("opacity", "0.6");
+ line.appendChild(str);
+ g.appendChild(line);
+ if (applyTo) {
+ applyTo(g, data[i].src);
+ }
+ group.appendChild(g);
+ }
+ return group;
+ }, HighLowOpenClose:function (data, plotarea, plot, applyTo) {
+ var area = plotarea.getArea();
+ var group = dojo.charting.Plotters._group(plotarea);
+ var n = data.length;
+ var part = ((area.right - area.left) / (plot.axisX.range.upper - plot.axisX.range.lower)) / 4;
+ var w = part * 2;
+ for (var i = 0; i < n; i++) {
+ var high = data[i].high;
+ var low = data[i].low;
+ if (low > high) {
+ var t = low;
+ low = high;
+ high = t;
+ }
+ var o = data[i].open;
+ var c = data[i].close;
+ var x = plot.axisX.getCoord(data[i].x, plotarea, plot) - (w / 2);
+ var y = plot.axisY.getCoord(high, plotarea, plot);
+ var h = plot.axisY.getCoord(low, plotarea, plot) - y;
+ var open = plot.axisY.getCoord(o, plotarea, plot);
+ var close = plot.axisY.getCoord(c, plotarea, plot);
+ var g = document.createElement("div");
+ var bar = document.createElement("v:rect");
+ bar.style.position = "absolute";
+ bar.style.top = y + 1 + "px";
+ bar.style.left = x + "px";
+ bar.style.width = w + "px";
+ bar.style.height = h + "px";
+ bar.setAttribute("fillColor", data[i].series.color);
+ bar.setAttribute("stroked", "false");
+ bar.style.antialias = "false";
+ var fill = document.createElement("v:fill");
+ fill.setAttribute("opacity", "0.6");
+ bar.appendChild(fill);
+ g.appendChild(bar);
+ var line = document.createElement("v:line");
+ line.setAttribute("strokecolor", data[i].series.color);
+ line.setAttribute("strokeweight", "1px");
+ line.setAttribute("from", (x - (part * 2)) + "px," + open + "px");
+ line.setAttribute("to", (x + w - 2) + "px," + open + "px");
+ var s = line.style;
+ s.position = "absolute";
+ s.top = "0px";
+ s.left = "0px";
+ s.antialias = "false";
+ var str = document.createElement("v:stroke");
+ str.setAttribute("opacity", "0.6");
+ line.appendChild(str);
+ g.appendChild(line);
+ var line = document.createElement("v:line");
+ line.setAttribute("strokecolor", data[i].series.color);
+ line.setAttribute("strokeweight", "1px");
+ line.setAttribute("from", x + "px," + close + "px");
+ line.setAttribute("to", (x + w + (part * 2) - 2) + "px," + close + "px");
+ var s = line.style;
+ s.position = "absolute";
+ s.top = "0px";
+ s.left = "0px";
+ s.antialias = "false";
+ var str = document.createElement("v:stroke");
+ str.setAttribute("opacity", "0.6");
+ line.appendChild(str);
+ g.appendChild(line);
+ if (applyTo) {
+ applyTo(g, data[i].src);
+ }
+ group.appendChild(g);
+ }
+ return group;
+ }, Scatter:function (data, plotarea, plot, applyTo) {
+ var r = 6;
+ var mod = r / 2;
+ var area = plotarea.getArea();
+ var group = dojo.charting.Plotters._group(plotarea);
+ for (var i = 0; i < data.length; i++) {
+ var x = Math.round(plot.axisX.getCoord(data[i].x, plotarea, plot));
+ var y = Math.round(plot.axisY.getCoord(data[i].y, plotarea, plot));
+ var point = document.createElement("v:rect");
+ point.setAttribute("strokecolor", data[i].series.color);
+ point.setAttribute("fillcolor", data[i].series.color);
+ var fill = document.createElement("v:fill");
+ fill.setAttribute("opacity", "0.6");
+ point.appendChild(fill);
+ var s = point.style;
+ s.position = "absolute";
+ s.rotation = "45";
+ s.top = (y - mod) + "px";
+ s.left = (x - mod) + "px";
+ s.width = r + "px";
+ s.height = r + "px";
+ group.appendChild(point);
+ if (applyTo) {
+ applyTo(point, data[i].src);
+ }
+ }
+ return group;
+ }, Bubble:function (data, plotarea, plot, applyTo) {
+ var sizeFactor = 1;
+ var area = plotarea.getArea();
+ var group = dojo.charting.Plotters._group(plotarea);
+ for (var i = 0; i < data.length; i++) {
+ var x = Math.round(plot.axisX.getCoord(data[i].x, plotarea, plot));
+ var y = Math.round(plot.axisY.getCoord(data[i].y, plotarea, plot));
+ if (i == 0) {
+ var raw = data[i].size;
+ var dy = plot.axisY.getCoord(data[i].y + raw, plotarea, plot) - y;
+ sizeFactor = dy / raw;
+ }
+ if (sizeFactor < 1) {
+ sizeFactor = 1;
+ }
+ var r = (data[i].size / 2) * sizeFactor;
+ var point = document.createElement("v:oval");
+ point.setAttribute("strokecolor", data[i].series.color);
+ point.setAttribute("fillcolor", data[i].series.color);
+ var fill = document.createElement("v:fill");
+ fill.setAttribute("opacity", "0.6");
+ point.appendChild(fill);
+ var s = point.style;
+ s.position = "absolute";
+ s.rotation = "45";
+ s.top = (y - r) + "px";
+ s.left = (x - r) + "px";
+ s.width = (r * 2) + "px";
+ s.height = (r * 2) + "px";
+ group.appendChild(point);
+ if (applyTo) {
+ applyTo(point, data[i].src);
+ }
+ }
+ return group;
+ }});
+ dojo.charting.Plotters["Default"] = dojo.charting.Plotters.Line;
+}
+
Propchange: geronimo/external/trunk/geronimo-dojo-0.4.3/src/main/webapp/src/charting/vml/Plotters.js
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: geronimo/external/trunk/geronimo-dojo-0.4.3/src/main/webapp/src/charting/vml/Plotters.js
------------------------------------------------------------------------------
svn:keywords = Date Revision
Propchange: geronimo/external/trunk/geronimo-dojo-0.4.3/src/main/webapp/src/charting/vml/Plotters.js
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: geronimo/external/trunk/geronimo-dojo-0.4.3/src/main/webapp/src/collections/ArrayList.js
URL: http://svn.apache.org/viewvc/geronimo/external/trunk/geronimo-dojo-0.4.3/src/main/webapp/src/collections/ArrayList.js?rev=794787&view=auto
==============================================================================
--- geronimo/external/trunk/geronimo-dojo-0.4.3/src/main/webapp/src/collections/ArrayList.js (added)
+++ geronimo/external/trunk/geronimo-dojo-0.4.3/src/main/webapp/src/collections/ArrayList.js Thu Jul 16 19:14:41 2009
@@ -0,0 +1,114 @@
+/*
+ Copyright (c) 2004-2006, The Dojo Foundation
+ All Rights Reserved.
+
+ Licensed under the Academic Free License version 2.1 or above OR the
+ modified BSD license. For more information on Dojo licensing, see:
+
+ http://dojotoolkit.org/community/licensing.shtml
+*/
+
+
+
+dojo.provide("dojo.collections.ArrayList");
+dojo.require("dojo.collections.Collections");
+dojo.collections.ArrayList = function (arr) {
+ var items = [];
+ if (arr) {
+ items = items.concat(arr);
+ }
+ this.count = items.length;
+ this.add = function (obj) {
+ items.push(obj);
+ this.count = items.length;
+ };
+ this.addRange = function (a) {
+ if (a.getIterator) {
+ var e = a.getIterator();
+ while (!e.atEnd()) {
+ this.add(e.get());
+ }
+ this.count = items.length;
+ } else {
+ for (var i = 0; i < a.length; i++) {
+ items.push(a[i]);
+ }
+ this.count = items.length;
+ }
+ };
+ this.clear = function () {
+ items.splice(0, items.length);
+ this.count = 0;
+ };
+ this.clone = function () {
+ return new dojo.collections.ArrayList(items);
+ };
+ this.contains = function (obj) {
+ for (var i = 0; i < items.length; i++) {
+ if (items[i] == obj) {
+ return true;
+ }
+ }
+ return false;
+ };
+ this.forEach = function (fn, scope) {
+ var s = scope || dj_global;
+ if (Array.forEach) {
+ Array.forEach(items, fn, s);
+ } else {
+ for (var i = 0; i < items.length; i++) {
+ fn.call(s, items[i], i, items);
+ }
+ }
+ };
+ this.getIterator = function () {
+ return new dojo.collections.Iterator(items);
+ };
+ this.indexOf = function (obj) {
+ for (var i = 0; i < items.length; i++) {
+ if (items[i] == obj) {
+ return i;
+ }
+ }
+ return -1;
+ };
+ this.insert = function (i, obj) {
+ items.splice(i, 0, obj);
+ this.count = items.length;
+ };
+ this.item = function (i) {
+ return items[i];
+ };
+ this.remove = function (obj) {
+ var i = this.indexOf(obj);
+ if (i >= 0) {
+ items.splice(i, 1);
+ }
+ this.count = items.length;
+ };
+ this.removeAt = function (i) {
+ items.splice(i, 1);
+ this.count = items.length;
+ };
+ this.reverse = function () {
+ items.reverse();
+ };
+ this.sort = function (fn) {
+ if (fn) {
+ items.sort(fn);
+ } else {
+ items.sort();
+ }
+ };
+ this.setByIndex = function (i, obj) {
+ items[i] = obj;
+ this.count = items.length;
+ };
+ this.toArray = function () {
+ return [].concat(items);
+ };
+ this.toString = function (delim) {
+ return items.join((delim || ","));
+ };
+};
+
Propchange: geronimo/external/trunk/geronimo-dojo-0.4.3/src/main/webapp/src/collections/ArrayList.js
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: geronimo/external/trunk/geronimo-dojo-0.4.3/src/main/webapp/src/collections/ArrayList.js
------------------------------------------------------------------------------
svn:keywords = Date Revision
Propchange: geronimo/external/trunk/geronimo-dojo-0.4.3/src/main/webapp/src/collections/ArrayList.js
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: geronimo/external/trunk/geronimo-dojo-0.4.3/src/main/webapp/src/collections/BinaryTree.js
URL: http://svn.apache.org/viewvc/geronimo/external/trunk/geronimo-dojo-0.4.3/src/main/webapp/src/collections/BinaryTree.js?rev=794787&view=auto
==============================================================================
--- geronimo/external/trunk/geronimo-dojo-0.4.3/src/main/webapp/src/collections/BinaryTree.js (added)
+++ geronimo/external/trunk/geronimo-dojo-0.4.3/src/main/webapp/src/collections/BinaryTree.js Thu Jul 16 19:14:41 2009
@@ -0,0 +1,257 @@
+/*
+ Copyright (c) 2004-2006, The Dojo Foundation
+ All Rights Reserved.
+
+ Licensed under the Academic Free License version 2.1 or above OR the
+ modified BSD license. For more information on Dojo licensing, see:
+
+ http://dojotoolkit.org/community/licensing.shtml
+*/
+
+
+
+dojo.provide("dojo.collections.BinaryTree");
+dojo.require("dojo.collections.Collections");
+dojo.require("dojo.experimental");
+dojo.experimental("dojo.collections.BinaryTree");
+dojo.collections.BinaryTree = function (data) {
+ function node(data, rnode, lnode) {
+ this.value = data || null;
+ this.right = rnode || null;
+ this.left = lnode || null;
+ this.clone = function () {
+ var c = new node();
+ if (this.value.value) {
+ c.value = this.value.clone();
+ } else {
+ c.value = this.value;
+ }
+ if (this.left) {
+ c.left = this.left.clone();
+ }
+ if (this.right) {
+ c.right = this.right.clone();
+ }
+ };
+ this.compare = function (n) {
+ if (this.value > n.value) {
+ return 1;
+ }
+ if (this.value < n.value) {
+ return -1;
+ }
+ return 0;
+ };
+ this.compareData = function (d) {
+ if (this.value > d) {
+ return 1;
+ }
+ if (this.value < d) {
+ return -1;
+ }
+ return 0;
+ };
+ }
+ function inorderTraversalBuildup(current, a) {
+ if (current) {
+ inorderTraversalBuildup(current.left, a);
+ a.add(current);
+ inorderTraversalBuildup(current.right, a);
+ }
+ }
+ function preorderTraversal(current, sep) {
+ var s = "";
+ if (current) {
+ s = current.value.toString() + sep;
+ s += preorderTraversal(current.left, sep);
+ s += preorderTraversal(current.right, sep);
+ }
+ return s;
+ }
+ function inorderTraversal(current, sep) {
+ var s = "";
+ if (current) {
+ s = inorderTraversal(current.left, sep);
+ s += current.value.toString() + sep;
+ s += inorderTraversal(current.right, sep);
+ }
+ return s;
+ }
+ function postorderTraversal(current, sep) {
+ var s = "";
+ if (current) {
+ s = postorderTraversal(current.left, sep);
+ s += postorderTraversal(current.right, sep);
+ s += current.value.toString() + sep;
+ }
+ return s;
+ }
+ function searchHelper(current, data) {
+ if (!current) {
+ return null;
+ }
+ var i = current.compareData(data);
+ if (i == 0) {
+ return current;
+ }
+ if (i > 0) {
+ return searchHelper(current.left, data);
+ } else {
+ return searchHelper(current.right, data);
+ }
+ }
+ this.add = function (data) {
+ var n = new node(data);
+ var i;
+ var current = root;
+ var parent = null;
+ while (current) {
+ i = current.compare(n);
+ if (i == 0) {
+ return;
+ }
+ parent = current;
+ if (i > 0) {
+ current = current.left;
+ } else {
+ current = current.right;
+ }
+ }
+ this.count++;
+ if (!parent) {
+ root = n;
+ } else {
+ i = parent.compare(n);
+ if (i > 0) {
+ parent.left = n;
+ } else {
+ parent.right = n;
+ }
+ }
+ };
+ this.clear = function () {
+ root = null;
+ this.count = 0;
+ };
+ this.clone = function () {
+ var c = new dojo.collections.BinaryTree();
+ c.root = root.clone();
+ c.count = this.count;
+ return c;
+ };
+ this.contains = function (data) {
+ return this.search(data) != null;
+ };
+ this.deleteData = function (data) {
+ var current = root;
+ var parent = null;
+ var i = current.compareData(data);
+ while (i != 0 && current != null) {
+ if (i > 0) {
+ parent = current;
+ current = current.left;
+ } else {
+ if (i < 0) {
+ parent = current;
+ current = current.right;
+ }
+ }
+ i = current.compareData(data);
+ }
+ if (!current) {
+ return;
+ }
+ this.count--;
+ if (!current.right) {
+ if (!parent) {
+ root = current.left;
+ } else {
+ i = parent.compare(current);
+ if (i > 0) {
+ parent.left = current.left;
+ } else {
+ if (i < 0) {
+ parent.right = current.left;
+ }
+ }
+ }
+ } else {
+ if (!current.right.left) {
+ if (!parent) {
+ root = current.right;
+ } else {
+ i = parent.compare(current);
+ if (i > 0) {
+ parent.left = current.right;
+ } else {
+ if (i < 0) {
+ parent.right = current.right;
+ }
+ }
+ }
+ } else {
+ var leftmost = current.right.left;
+ var lmParent = current.right;
+ while (leftmost.left != null) {
+ lmParent = leftmost;
+ leftmost = leftmost.left;
+ }
+ lmParent.left = leftmost.right;
+ leftmost.left = current.left;
+ leftmost.right = current.right;
+ if (!parent) {
+ root = leftmost;
+ } else {
+ i = parent.compare(current);
+ if (i > 0) {
+ parent.left = leftmost;
+ } else {
+ if (i < 0) {
+ parent.right = leftmost;
+ }
+ }
+ }
+ }
+ }
+ };
+ this.getIterator = function () {
+ var a = [];
+ inorderTraversalBuildup(root, a);
+ return new dojo.collections.Iterator(a);
+ };
+ this.search = function (data) {
+ return searchHelper(root, data);
+ };
+ this.toString = function (order, sep) {
+ if (!order) {
+ var order = dojo.collections.BinaryTree.TraversalMethods.Inorder;
+ }
+ if (!sep) {
+ var sep = " ";
+ }
+ var s = "";
+ switch (order) {
+ case dojo.collections.BinaryTree.TraversalMethods.Preorder:
+ s = preorderTraversal(root, sep);
+ break;
+ case dojo.collections.BinaryTree.TraversalMethods.Inorder:
+ s = inorderTraversal(root, sep);
+ break;
+ case dojo.collections.BinaryTree.TraversalMethods.Postorder:
+ s = postorderTraversal(root, sep);
+ break;
+ }
+ if (s.length == 0) {
+ return "";
+ } else {
+ return s.substring(0, s.length - sep.length);
+ }
+ };
+ this.count = 0;
+ var root = this.root = null;
+ if (data) {
+ this.add(data);
+ }
+};
+dojo.collections.BinaryTree.TraversalMethods = {Preorder:1, Inorder:2, Postorder:3};
+
Propchange: geronimo/external/trunk/geronimo-dojo-0.4.3/src/main/webapp/src/collections/BinaryTree.js
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: geronimo/external/trunk/geronimo-dojo-0.4.3/src/main/webapp/src/collections/BinaryTree.js
------------------------------------------------------------------------------
svn:keywords = Date Revision
Propchange: geronimo/external/trunk/geronimo-dojo-0.4.3/src/main/webapp/src/collections/BinaryTree.js
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: geronimo/external/trunk/geronimo-dojo-0.4.3/src/main/webapp/src/collections/Collections.js
URL: http://svn.apache.org/viewvc/geronimo/external/trunk/geronimo-dojo-0.4.3/src/main/webapp/src/collections/Collections.js?rev=794787&view=auto
==============================================================================
--- geronimo/external/trunk/geronimo-dojo-0.4.3/src/main/webapp/src/collections/Collections.js (added)
+++ geronimo/external/trunk/geronimo-dojo-0.4.3/src/main/webapp/src/collections/Collections.js Thu Jul 16 19:14:41 2009
@@ -0,0 +1,92 @@
+/*
+ Copyright (c) 2004-2006, The Dojo Foundation
+ All Rights Reserved.
+
+ Licensed under the Academic Free License version 2.1 or above OR the
+ modified BSD license. For more information on Dojo licensing, see:
+
+ http://dojotoolkit.org/community/licensing.shtml
+*/
+
+
+
+dojo.provide("dojo.collections.Collections");
+dojo.collections.DictionaryEntry = function (k, v) {
+ this.key = k;
+ this.value = v;
+ this.valueOf = function () {
+ return this.value;
+ };
+ this.toString = function () {
+ return String(this.value);
+ };
+};
+dojo.collections.Iterator = function (arr) {
+ var a = arr;
+ var position = 0;
+ this.element = a[position] || null;
+ this.atEnd = function () {
+ return (position >= a.length);
+ };
+ this.get = function () {
+ if (this.atEnd()) {
+ return null;
+ }
+ this.element = a[position++];
+ return this.element;
+ };
+ this.map = function (fn, scope) {
+ var s = scope || dj_global;
+ if (Array.map) {
+ return Array.map(a, fn, s);
+ } else {
+ var arr = [];
+ for (var i = 0; i < a.length; i++) {
+ arr.push(fn.call(s, a[i]));
+ }
+ return arr;
+ }
+ };
+ this.reset = function () {
+ position = 0;
+ this.element = a[position];
+ };
+};
+dojo.collections.DictionaryIterator = function (obj) {
+ var a = [];
+ var testObject = {};
+ for (var p in obj) {
+ if (!testObject[p]) {
+ a.push(obj[p]);
+ }
+ }
+ var position = 0;
+ this.element = a[position] || null;
+ this.atEnd = function () {
+ return (position >= a.length);
+ };
+ this.get = function () {
+ if (this.atEnd()) {
+ return null;
+ }
+ this.element = a[position++];
+ return this.element;
+ };
+ this.map = function (fn, scope) {
+ var s = scope || dj_global;
+ if (Array.map) {
+ return Array.map(a, fn, s);
+ } else {
+ var arr = [];
+ for (var i = 0; i < a.length; i++) {
+ arr.push(fn.call(s, a[i]));
+ }
+ return arr;
+ }
+ };
+ this.reset = function () {
+ position = 0;
+ this.element = a[position];
+ };
+};
+