]> git.proxmox.com Git - sencha-touch.git/blob - src/src/chart/grid/VerticalGrid.js
import Sencha Touch 2.4.2 source
[sencha-touch.git] / src / src / chart / grid / VerticalGrid.js
1 /**
2 * @class Ext.chart.grid.VerticalGrid
3 * @extends Ext.draw.sprite.Sprite
4 *
5 * Vertical Grid sprite. Used in Cartesian Charts.
6 */
7 Ext.define("Ext.chart.grid.VerticalGrid", {
8 extend: 'Ext.draw.sprite.Sprite',
9 alias: 'grid.vertical',
10
11 inheritableStatics: {
12 def: {
13 processors: {
14 x: 'number',
15 y: 'number',
16 width: 'number',
17 height: 'number'
18 },
19
20 defaults: {
21 x: 0,
22 y: 0,
23 width: 1,
24 height: 1,
25 strokeStyle: '#DDD'
26 }
27 }
28 },
29
30 render: function (surface, ctx, clipRegion) {
31 var attr = this.attr,
32 x = surface.roundPixel(attr.x),
33 halfLineWidth = ctx.lineWidth * 0.5;
34 ctx.beginPath();
35 ctx.rect(x - halfLineWidth, clipRegion[1] - surface.matrix.getDY(), attr.width, clipRegion[3]);
36 ctx.fill();
37
38 ctx.beginPath();
39 ctx.moveTo(x - halfLineWidth, clipRegion[1] - surface.matrix.getDY());
40 ctx.lineTo(x - halfLineWidth, clipRegion[1] + clipRegion[3] - surface.matrix.getDY());
41 ctx.stroke();
42 }
43 });