Changeset 30
- Timestamp:
- 04/06/06 11:20:29 (2 years ago)
- Files:
-
- plotkit/trunk/PlotKit/SweetCanvas.js (modified) (1 diff)
- plotkit/trunk/PlotKit/SweetSVG.js (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
plotkit/trunk/PlotKit/SweetCanvas.js
r19 r30 269 269 context.strokeStyle = Color.whiteColor().toRGBString(); 270 270 context.lineWidth = 1.0; 271 for (var i = 0; i < this.layout.yticks.length; i++) { 272 var y = this.layout.yticks[i][0] * this.area.h + this.area.y; 273 var x = this.area.x; 271 272 var ticks = this.layout.yticks; 273 var horiz = false; 274 if (this.layout.style == "bar" && 275 this.layout.options.barOrientation == "horizontal") { 276 ticks = this.layout.xticks; 277 horiz = true; 278 } 279 280 for (var i = 0; i < ticks.length; i++) { 281 var x1 = 0; 282 var y1 = 0; 283 var x2 = 0; 284 var y2 = 0; 285 286 if (horiz) { 287 x1 = ticks[i][0] * this.area.w + this.area.x; 288 y1 = this.area.y; 289 x2 = x1; 290 y2 = y1 + this.area.h; 291 } 292 else { 293 x1 = this.area.x; 294 y1 = ticks[i][0] * this.area.h + this.area.y; 295 x2 = x1 + this.area.w; 296 y2 = y1; 297 } 298 274 299 context.beginPath(); 275 context.moveTo(x , y);276 context.lineTo(x + this.area.w, y);300 context.moveTo(x1, y1); 301 context.lineTo(x2, y2); 277 302 context.closePath(); 278 303 context.stroke(); plotkit/trunk/PlotKit/SweetSVG.js
r19 r30 180 180 if (this.layout.style == "bar" || this.layout.style == "line") { 181 181 this._drawRect(this.area.x, this.area.y, 182 this.area.w, this.area.h, attrs); 183 for (var i = 0; i < this.layout.yticks.length; i++) { 184 this._drawRect(this.area.x, 185 this.layout.yticks[i][0] * this.area.h + this.area.y, 186 this.area.w, 187 1, 182 this.area.w, this.area.h, attrs); 183 184 var ticks = this.layout.yticks; 185 var horiz = false; 186 if (this.layout.style == "bar" && 187 this.layout.options.barOrientation == "horizontal") { 188 ticks = this.layout.xticks; 189 horiz = true; 190 } 191 192 for (var i = 0; i < ticks.length; i++) { 193 var x = 0; 194 var y = 0; 195 var w = 0; 196 var h = 0; 197 198 if (horiz) { 199 x = ticks[i][0] * this.area.w + this.area.x; 200 y = this.area.y; 201 w = 1; 202 h = this.area.w; 203 } 204 else { 205 x = this.area.x; 206 y = ticks[i][0] * this.area.h + this.area.y; 207 w = this.area.w; 208 h = 1; 209 } 210 211 this._drawRect(x, y, w, h, 188 212 {"fill": Color.whiteColor().toRGBString()}); 189 213 }




Atom Feed for the Blog Entries