]> git.proxmox.com Git - sencha-touch.git/blob - src/src/chart/grid/HorizontalGrid.js
import Sencha Touch 2.4.2 source
[sencha-touch.git] / src / src / chart / grid / HorizontalGrid.js
1 /**
2 * @class Ext.chart.grid.HorizontalGrid
3 * @extends Ext.draw.sprite.Sprite
4 *
5 * Horizontal Grid sprite. Used in Cartesian Charts.
6 */
7 Ext.define("Ext.chart.grid.HorizontalGrid", {
8 extend: 'Ext.draw.sprite.Sprite',
9 alias: 'grid.horizontal',
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 y = surface.roundPixel(attr.y),
33 halfLineWidth = ctx.lineWidth * 0.5;
34 ctx.beginPath();
35 ctx.rect(clipRegion[0] - surface.matrix.getDX(), y + halfLineWidth, +clipRegion[2], attr.height);
36 ctx.fill();
37
38 ctx.beginPath();
39 ctx.moveTo(clipRegion[0] - surface.matrix.getDX(), y + halfLineWidth);
40 ctx.lineTo(clipRegion[0] + clipRegion[2] - surface.matrix.getDX(), y + halfLineWidth);
41 ctx.stroke();
42 }
43 });