Commits

Eugene Lazutkin  committed 158458f

charting: fixed a minor bug with gradients over chart and plot areas, thx Karl Tiedt!, !strict, fixes #12328.

  • Participants
  • Parent commits ca25781

Comments (0)

Files changed (1)

File charting/Chart.js

 dojo.require("dojox.lang.functional.fold");
 dojo.require("dojox.lang.functional.reversed");
 
+dojo.require("dojox.charting.Element");
 dojo.require("dojox.charting.Theme");
 dojo.require("dojox.charting.Series");
 dojo.require("dojox.charting.axis2d.common");
 
 			// calculate geometry
 			this.fullGeometry();
-			var offsets = this.offsets, dim = this.dim;
+			var offsets = this.offsets, dim = this.dim, rect;
 
 			// get required colors
 			//var requiredColors = df.foldl(this.stack, "z + plot.getRequiredColors()", 0);
 			// draw a plot background
 			var t = this.theme,
 				fill   = t.plotarea && t.plotarea.fill,
-				stroke = t.plotarea && t.plotarea.stroke;
-			if(fill){
-				this.surface.createRect({
+				stroke = t.plotarea && t.plotarea.stroke,
+				rect = {
 					x: offsets.l - 1, y: offsets.t - 1,
 					width:  dim.width  - offsets.l - offsets.r + 2,
 					height: dim.height - offsets.t - offsets.b + 2
-				}).setFill(fill);
+				};
+			if(fill){
+				fill = dc.Element.prototype._shapeFill(dc.Element.prototype._plotFill(fill, dim, offsets), rect);
+				this.surface.createRect(rect).setFill(fill);
 			}
 			if(stroke){
 				this.surface.createRect({
 			}
 
 			if(fill){
+				fill = dc.Element.prototype._plotFill(fill, dim, offsets);
 				if(offsets.l){	// left
-					this.surface.createRect({
+					rect = {
 						width:  offsets.l,
 						height: dim.height + 1
-					}).setFill(fill);
+					};
+					this.surface.createRect(rect).setFill(dc.Element.prototype._shapeFill(fill, rect));
 				}
 				if(offsets.r){	// right
-					this.surface.createRect({
+					rect = {
 						x: dim.width - offsets.r,
 						width:  offsets.r + 1,
 						height: dim.height + 2
-					}).setFill(fill);
+					};
+					this.surface.createRect(rect).setFill(dc.Element.prototype._shapeFill(fill, rect));
 				}
 				if(offsets.t){	// top
-					this.surface.createRect({
+					rect = {
 						width:  dim.width + 1,
 						height: offsets.t
-					}).setFill(fill);
+					};
+					this.surface.createRect(rect).setFill(dc.Element.prototype._shapeFill(fill, rect));
 				}
 				if(offsets.b){	// bottom
-					this.surface.createRect({
+					rect = {
 						y: dim.height - offsets.b,
 						width:  dim.width + 1,
 						height: offsets.b + 2
-					}).setFill(fill);
+					};
+					this.surface.createRect(rect).setFill(dc.Element.prototype._shapeFill(fill, rect));
 				}
 			}
+			if(stroke){
+				this.surface.createRect({
+					width:  dim.width - 1,
+					height: dim.height - 1
+				}).setStroke(stroke);
+			}
+
 			//create title: Whether to make chart title as a widget which extends dojox.charting.Element?
 			if(this.title){
 				var forceHtmlLabels = (g.renderer == "canvas"),
 					this.titleFontColor
 				);
 			}
-			if(stroke){
-				this.surface.createRect({
-					width:  dim.width - 1,
-					height: dim.height - 1
-				}).setStroke(stroke);
-			}
 
 			// go over axes
 			df.forIn(this.axes, function(axis){ axis.render(dim, offsets); });