summaryrefslogtreecommitdiff
path: root/js/dojo-1.6/dojox/charting/plot2d/ClusteredBars.xd.js
diff options
context:
space:
mode:
authorTristan Zur <tzur@web.web.ccwn.org>2014-03-27 22:27:47 +0100
committerTristan Zur <tzur@web.web.ccwn.org>2014-03-27 22:27:47 +0100
commitb62676ca5d3d6f6ba3f019ea3f99722e165a98d8 (patch)
tree86722cb80f07d4569f90088eeaea2fc2f6e2ef94 /js/dojo-1.6/dojox/charting/plot2d/ClusteredBars.xd.js
Initial commit of intern.ccwn.org contentsHEADmaster
Diffstat (limited to 'js/dojo-1.6/dojox/charting/plot2d/ClusteredBars.xd.js')
-rw-r--r--js/dojo-1.6/dojox/charting/plot2d/ClusteredBars.xd.js121
1 files changed, 121 insertions, 0 deletions
diff --git a/js/dojo-1.6/dojox/charting/plot2d/ClusteredBars.xd.js b/js/dojo-1.6/dojox/charting/plot2d/ClusteredBars.xd.js
new file mode 100644
index 0000000..d1450a5
--- /dev/null
+++ b/js/dojo-1.6/dojox/charting/plot2d/ClusteredBars.xd.js
@@ -0,0 +1,121 @@
+/*
+ Copyright (c) 2004-2011, 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
+*/
+
+
+dojo._xdResourceLoaded(function(dojo, dijit, dojox){
+return {depends: [["provide", "dojox.charting.plot2d.ClusteredBars"],
+["require", "dojox.charting.plot2d.common"],
+["require", "dojox.charting.plot2d.Bars"],
+["require", "dojox.lang.functional"],
+["require", "dojox.lang.functional.reversed"]],
+defineResource: function(dojo, dijit, dojox){if(!dojo._hasResource["dojox.charting.plot2d.ClusteredBars"]){ //_hasResource checks added by build. Do not use _hasResource directly in your code.
+dojo._hasResource["dojox.charting.plot2d.ClusteredBars"] = true;
+dojo.provide("dojox.charting.plot2d.ClusteredBars");
+
+dojo.require("dojox.charting.plot2d.common");
+dojo.require("dojox.charting.plot2d.Bars");
+
+dojo.require("dojox.lang.functional");
+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.ClusteredBars", dojox.charting.plot2d.Bars, {
+ // summary:
+ // A plot representing grouped or clustered bars (horizontal bars)
+ render: function(dim, offsets){
+ // summary:
+ // Run the calculations for any axes for this plot.
+ // dim: Object
+ // An object in the form of { width, height }
+ // offsets: Object
+ // An object of the form { l, r, t, b}.
+ // returns: dojox.charting.plot2d.ClusteredBars
+ // A reference to this plot for functional chaining.
+ if(this.zoom && !this.isDataDirty()){
+ return this.performZoom(dim, offsets);
+ }
+ this.resetEvents();
+ this.dirty = this.isDirty();
+ if(this.dirty){
+ dojo.forEach(this.series, purgeGroup);
+ this._eventSeries = {};
+ this.cleanGroup();
+ var s = this.group;
+ df.forEachRev(this.series, function(item){ item.cleanGroup(s); });
+ }
+ var t = this.chart.theme, f, gap, height, thickness,
+ ht = this._hScaler.scaler.getTransformerFromModel(this._hScaler),
+ vt = this._vScaler.scaler.getTransformerFromModel(this._vScaler),
+ baseline = Math.max(0, this._hScaler.bounds.lower),
+ baselineWidth = ht(baseline),
+ events = this.events();
+ f = dc.calculateBarSize(this._vScaler.bounds.scale, this.opt, this.series.length);
+ gap = f.gap;
+ height = thickness = f.size;
+ for(var i = this.series.length - 1; i >= 0; --i){
+ var run = this.series[i], shift = thickness * (this.series.length - i - 1);
+ if(!this.dirty && !run.dirty){
+ t.skip();
+ this._reconnectEvents(run.name);
+ continue;
+ }
+ run.cleanGroup();
+ var theme = t.next("bar", [this.opt, run]), s = run.group,
+ eventSeries = new Array(run.data.length);
+ for(var j = 0; j < run.data.length; ++j){
+ var value = run.data[j];
+ if(value !== null){
+ var v = typeof value == "number" ? value : value.y,
+ hv = ht(v),
+ width = hv - baselineWidth,
+ w = Math.abs(width),
+ finalTheme = typeof value != "number" ?
+ t.addMixin(theme, "bar", value, true) :
+ t.post(theme, "bar");
+ if(w >= 1 && height >= 1){
+ var rect = {
+ x: offsets.l + (v < baseline ? hv : baselineWidth),
+ y: dim.height - offsets.b - vt(j + 1.5) + gap + shift,
+ width: w, height: height
+ };
+ var specialFill = this._plotFill(finalTheme.series.fill, dim, offsets);
+ specialFill = this._shapeFill(specialFill, rect);
+ var shape = s.createRect(rect).setFill(specialFill).setStroke(finalTheme.series.stroke);
+ run.dyn.fill = shape.getFill();
+ run.dyn.stroke = shape.getStroke();
+ if(events){
+ var o = {
+ element: "bar",
+ index: j,
+ run: run,
+ shape: shape,
+ x: v,
+ y: j + 1.5
+ };
+ this._connectEvents(o);
+ eventSeries[j] = o;
+ }
+ if(this.animate){
+ this._animateBar(shape, offsets.l + baselineWidth, -width);
+ }
+ }
+ }
+ }
+ this._eventSeries[run.name] = eventSeries;
+ run.dirty = false;
+ }
+ this.dirty = false;
+ return this; // dojox.charting.plot2d.ClusteredBars
+ }
+ });
+})();
+
+}
+
+}};});