]>
Commit | Line | Data |
---|---|---|
6527f429 DM |
1 | /**\r |
2 | * @class Ext.chart.series.sprite.Bar3D\r | |
3 | * @extends Ext.chart.series.sprite.Bar\r | |
4 | *\r | |
5 | * Draws a sprite used in {@link Ext.chart.series.Bar3D} series.\r | |
6 | */\r | |
7 | Ext.define('Ext.chart.series.sprite.Bar3D', {\r | |
8 | extend: 'Ext.chart.series.sprite.Bar',\r | |
9 | alias: 'sprite.bar3dSeries',\r | |
10 | \r | |
11 | requires: ['Ext.draw.gradient.Linear'],\r | |
12 | \r | |
13 | inheritableStatics: {\r | |
14 | def: {\r | |
15 | processors: {\r | |
16 | depthWidthRatio: 'number',\r | |
17 | /**\r | |
18 | * @cfg {Number} [saturationFactor=1]\r | |
19 | * The factor applied to the saturation of the bars.\r | |
20 | */\r | |
21 | saturationFactor: 'number',\r | |
22 | /**\r | |
23 | * @cfg {Number} [brightnessFactor=1]\r | |
24 | * The factor applied to the brightness of the bars.\r | |
25 | */\r | |
26 | brightnessFactor: 'number',\r | |
27 | /**\r | |
28 | * @cfg {Number} [colorSpread=1]\r | |
29 | * An attribute used to control how flat the bar gradient looks.\r | |
30 | * A value of 0 essentially means no gradient (flat color).\r | |
31 | */\r | |
32 | colorSpread: 'number'\r | |
33 | },\r | |
34 | \r | |
35 | defaults: {\r | |
36 | depthWidthRatio: 1/3,\r | |
37 | saturationFactor: 1,\r | |
38 | brightnessFactor: 1,\r | |
39 | colorSpread: 1,\r | |
40 | transformFillStroke: true\r | |
41 | },\r | |
42 | \r | |
43 | triggers: {\r | |
44 | groupCount: 'panzoom'\r | |
45 | },\r | |
46 | \r | |
47 | updaters: {\r | |
48 | panzoom: function (attr) {\r | |
49 | var me = this,\r | |
50 | dx = attr.visibleMaxX - attr.visibleMinX,\r | |
51 | dy = attr.visibleMaxY - attr.visibleMinY,\r | |
52 | innerWidth = attr.flipXY ? attr.innerHeight : attr.innerWidth,\r | |
53 | innerHeight = !attr.flipXY ? attr.innerHeight : attr.innerWidth,\r | |
54 | surface = me.getSurface(),\r | |
55 | isRtl = surface ? surface.getInherited().rtl : false;\r | |
56 | \r | |
57 | if (isRtl && !attr.flipXY) {\r | |
58 | attr.translationX = innerWidth + attr.visibleMinX * innerWidth / dx;\r | |
59 | } else {\r | |
60 | attr.translationX = -attr.visibleMinX * innerWidth / dx;\r | |
61 | }\r | |
62 | attr.translationY = -attr.visibleMinY * (innerHeight - me.depth) / dy;\r | |
63 | attr.scalingX = (isRtl && !attr.flipXY ? -1 : 1) * innerWidth / dx;\r | |
64 | attr.scalingY = (innerHeight - me.depth) / dy;\r | |
65 | attr.scalingCenterX = 0;\r | |
66 | attr.scalingCenterY = 0;\r | |
67 | me.applyTransformations(true);\r | |
68 | }\r | |
69 | }\r | |
70 | }\r | |
71 | },\r | |
72 | \r | |
73 | config: {\r | |
74 | showStroke: false\r | |
75 | },\r | |
76 | \r | |
77 | depth: 0,\r | |
78 | \r | |
79 | drawBar: function (ctx, surface, clip, left, top, right, bottom, index) {\r | |
80 | var me = this,\r | |
81 | attr = me.attr,\r | |
82 | itemCfg = {},\r | |
83 | renderer = attr.renderer,\r | |
84 | changes, depth, series, params;\r | |
85 | \r | |
86 | itemCfg.x = (left + right) * 0.5;\r | |
87 | itemCfg.y = top;\r | |
88 | itemCfg.width = (right - left) * 0.75;\r | |
89 | itemCfg.height = bottom - top;\r | |
90 | itemCfg.depth = depth = itemCfg.width * attr.depthWidthRatio;\r | |
91 | itemCfg.orientation = attr.flipXY ? 'horizontal' : 'vertical';\r | |
92 | itemCfg.saturationFactor = attr.saturationFactor;\r | |
93 | itemCfg.brightnessFactor = attr.brightnessFactor;\r | |
94 | itemCfg.colorSpread = attr.colorSpread;\r | |
95 | \r | |
96 | if (depth !== me.depth) {\r | |
97 | me.depth = depth;\r | |
98 | series = me.getSeries();\r | |
99 | series.fireEvent('depthchange', series, depth);\r | |
100 | }\r | |
101 | \r | |
102 | if (renderer) {\r | |
103 | params = [me, itemCfg, {store: me.getStore()}, index];\r | |
104 | changes = Ext.callback(renderer, null, params, 0, me.getSeries());\r | |
105 | Ext.apply(itemCfg, changes);\r | |
106 | }\r | |
107 | me.putMarker('items', itemCfg, index, !renderer);\r | |
108 | }\r | |
109 | \r | |
110 | });\r |