summaryrefslogtreecommitdiff
path: root/includes/js/dojox/charting/plot2d/Stacked.js
diff options
context:
space:
mode:
authormensonge <mensonge@b3834d28-1941-0410-a4f8-b48e95affb8f>2008-11-14 15:39:19 +0000
committermensonge <mensonge@b3834d28-1941-0410-a4f8-b48e95affb8f>2008-11-14 15:39:19 +0000
commit1c5685d68f1b73270fb814fe04cbb490eb90ba5f (patch)
tree3d3ada08a934b96fc31531f1327690d7edc6f766 /includes/js/dojox/charting/plot2d/Stacked.js
parent104d59099e048688c4dbac37d72137006e396558 (diff)
downloadsemanticscuttle-1c5685d68f1b73270fb814fe04cbb490eb90ba5f.tar.gz
semanticscuttle-1c5685d68f1b73270fb814fe04cbb490eb90ba5f.tar.bz2
Minor fix: Remove DOJO library (60Mo) replaced by link to Google CDN (online DOJO library)
git-svn-id: https://semanticscuttle.svn.sourceforge.net/svnroot/semanticscuttle/trunk@159 b3834d28-1941-0410-a4f8-b48e95affb8f
Diffstat (limited to 'includes/js/dojox/charting/plot2d/Stacked.js')
-rw-r--r--includes/js/dojox/charting/plot2d/Stacked.js160
1 files changed, 0 insertions, 160 deletions
diff --git a/includes/js/dojox/charting/plot2d/Stacked.js b/includes/js/dojox/charting/plot2d/Stacked.js
deleted file mode 100644
index 0e26a75..0000000
--- a/includes/js/dojox/charting/plot2d/Stacked.js
+++ /dev/null
@@ -1,160 +0,0 @@
-if(!dojo._hasResource["dojox.charting.plot2d.Stacked"]){ //_hasResource checks added by build. Do not use _hasResource directly in your code.
-dojo._hasResource["dojox.charting.plot2d.Stacked"] = true;
-dojo.provide("dojox.charting.plot2d.Stacked");
-
-dojo.require("dojox.charting.plot2d.common");
-dojo.require("dojox.charting.plot2d.Default");
-
-dojo.require("dojox.lang.functional");
-dojo.require("dojox.lang.functional.sequence");
-dojo.require("dojox.lang.functional.reversed");
-
-(function(){
- var df = dojox.lang.functional, dc = dojox.charting.plot2d.common,
- purgeGroup = df.lambda("item.purgeGroup()");
-
- dojo.declare("dojox.charting.plot2d.Stacked", dojox.charting.plot2d.Default, {
- calculateAxes: function(dim){
- var stats = dc.collectStackedStats(this.series);
- this._maxRunLength = stats.hmax;
- this._calc(dim, stats);
- return this;
- },
- render: function(dim, offsets){
- // stack all values
- var acc = df.repeat(this._maxRunLength, "-> 0", 0);
- for(var i = 0; i < this.series.length; ++i){
- var run = this.series[i];
- for(var j = 0; j < run.data.length; ++j){
- var v = run.data[j];
- if(isNaN(v)){ v = 0; }
- acc[j] += v;
- }
- }
- // draw runs in backwards
- if(this.dirty){
- dojo.forEach(this.series, purgeGroup);
- this.cleanGroup();
- var s = this.group;
- df.forEachRev(this.series, function(item){ item.cleanGroup(s); });
- }
-
- // inner function for translating polylines to curves with tension
- function curve(arr, tension){
- var p=dojo.map(arr, function(item, i){
- if(i==0){ return "M" + item.x + "," + item.y; }
- var dx=item.x-arr[i-1].x, dy=arr[i-1].y;
- return "C"+(item.x-(tension-1)*(dx/tension))+","+dy+" "+(item.x-(dx/tension))+","+item.y+" "+item.x+","+item.y;
- });
- return p.join(" ");
- }
-
- var t = this.chart.theme, stroke, outline, color, marker;
- for(var i = this.series.length - 1; i >= 0; --i){
- var run = this.series[i];
- if(!this.dirty && !run.dirty){ continue; }
- run.cleanGroup();
- var s = run.group,
- lpoly = dojo.map(acc, function(v, i){
- return {
- x: this._hScaler.scale * (i + 1 - this._hScaler.bounds.lower) + offsets.l,
- y: dim.height - offsets.b - this._vScaler.scale * (v - this._vScaler.bounds.lower)
- };
- }, this);
- if(!run.fill || !run.stroke){
- // need autogenerated color
- color = new dojo.Color(t.next("color"));
- }
-
- var lpath="";
- if(this.opt.tension){
- lpath=curve(lpoly, this.opt.tension);
- }
-
- if(this.opt.areas){
- var apoly = dojo.clone(lpoly);
- var fill = run.fill ? run.fill : dc.augmentFill(t.series.fill, color);
- if(this.opt.tension){
- var p=curve(apoly, this.opt.tension);
- p += " L" + lpoly[lpoly.length-1].x + "," + (dim.height - offsets.b) + " "
- + "L" + lpoly[0].x + "," + (dim.height - offsets.b) + " "
- + "L" + lpoly[0].x + "," + lpoly[0].y;
- s.createPath(p).setFill(fill);
- } else {
- apoly.push({x: lpoly[lpoly.length - 1].x, y: dim.height - offsets.b});
- apoly.push({x: lpoly[0].x, y: dim.height - offsets.b});
- apoly.push(lpoly[0]);
- s.createPolyline(apoly).setFill(fill);
- }
- }
- if(this.opt.lines || this.opt.markers){
- // need a stroke
- stroke = run.stroke ? dc.makeStroke(run.stroke) : dc.augmentStroke(t.series.stroke, color);
- if(run.outline || t.series.outline){
- outline = dc.makeStroke(run.outline ? run.outline : t.series.outline);
- outline.width = 2 * outline.width + stroke.width;
- }
- }
- if(this.opt.markers){
- // need a marker
- marker = run.marker ? run.marker : t.next("marker");
- }
- if(this.opt.shadows && stroke){
- var sh = this.opt.shadows, shadowColor = new dojo.Color([0, 0, 0, 0.3]),
- spoly = dojo.map(lpoly, function(c){
- return {x: c.x + sh.dx, y: c.y + sh.dy};
- }),
- shadowStroke = dojo.clone(outline ? outline : stroke);
- shadowStroke.color = shadowColor;
- shadowStroke.width += sh.dw ? sh.dw : 0;
- if(this.opt.lines){
- if(this.opt.tension){
- s.createPath(curve(spoly, this.opt.tension)).setStroke(shadowStroke);
- } else {
- s.createPolyline(spoly).setStroke(shadowStroke);
- }
- }
- if(this.opt.markers){
- dojo.forEach(spoly, function(c){
- s.createPath("M" + c.x + " " + c.y + " " + marker).setStroke(shadowStroke).setFill(shadowColor);
- }, this);
- }
- }
- if(this.opt.lines){
- if(outline){
- if(this.opt.tension){
- s.createPath(lpath).setStroke(outline);
- } else {
- s.createPolyline(lpoly).setStroke(outline);
- }
- }
- if(this.opt.tension){
- s.createPath(lpath).setStroke(stroke);
- } else {
- s.createPolyline(lpoly).setStroke(stroke);
- }
- }
- if(this.opt.markers){
- dojo.forEach(lpoly, function(c){
- var path = "M" + c.x + " " + c.y + " " + marker;
- if(outline){
- s.createPath(path).setStroke(outline);
- }
- s.createPath(path).setStroke(stroke).setFill(stroke.color);
- }, this);
- }
- run.dirty = false;
- // update the accumulator
- for(var j = 0; j < run.data.length; ++j){
- var v = run.data[j];
- if(isNaN(v)){ v = 0; }
- acc[j] -= v;
- }
- }
- this.dirty = false;
- return this;
- }
- });
-})();
-
-}