]>
Commit | Line | Data |
---|---|---|
6527f429 DM |
1 | /**\r |
2 | * @abstract\r | |
3 | * @class Ext.chart.axis.segmenter.Segmenter\r | |
4 | * \r | |
5 | * Interface for a segmenter in an Axis. A segmenter defines the operations you can do to a specific\r | |
6 | * data type.\r | |
7 | * \r | |
8 | * See {@link Ext.chart.axis.Axis}.\r | |
9 | * \r | |
10 | */\r | |
11 | Ext.define('Ext.chart.axis.segmenter.Segmenter', {\r | |
12 | \r | |
13 | config: {\r | |
14 | /**\r | |
15 | * @cfg {Ext.chart.axis.Axis} axis The axis that the Segmenter is bound.\r | |
16 | */\r | |
17 | axis: null\r | |
18 | },\r | |
19 | \r | |
20 | constructor: function (config) {\r | |
21 | this.initConfig(config);\r | |
22 | },\r | |
23 | \r | |
24 | /**\r | |
25 | * This method formats the value.\r | |
26 | * \r | |
27 | * @param {*} value The value to format.\r | |
28 | * @param {Object} context Axis layout context.\r | |
29 | * @return {String}\r | |
30 | */\r | |
31 | renderer: function (value, context) {\r | |
32 | return String(value);\r | |
33 | },\r | |
34 | \r | |
35 | /**\r | |
36 | * Convert from any data into the target type.\r | |
37 | * @param {*} value The value to convert from\r | |
38 | * @return {*} The converted value. \r | |
39 | */\r | |
40 | from: function (value) {\r | |
41 | return value;\r | |
42 | },\r | |
43 | \r | |
44 | /**\r | |
45 | * @method\r | |
46 | * Returns the difference between the min and max value based on the given unit scale.\r | |
47 | * \r | |
48 | * @param {*} min The smaller value.\r | |
49 | * @param {*} max The larger value.\r | |
50 | * @param {*} unit The unit scale. Unit can be any type.\r | |
51 | * @return {Number} The number of `unit`s between min and max. It is the minimum n that min + n * unit >= max.\r | |
52 | */\r | |
53 | diff: Ext.emptyFn,\r | |
54 | \r | |
55 | /**\r | |
56 | * @method\r | |
57 | * Align value with step of units.\r | |
58 | * For example, for the date segmenter, if the unit is "Month" and step is 3, the value will be aligned by\r | |
59 | * seasons.\r | |
60 | * \r | |
61 | * @param {*} value The value to be aligned.\r | |
62 | * @param {Number} step The step of units.\r | |
63 | * @param {*} unit The unit.\r | |
64 | * @return {*} Aligned value.\r | |
65 | */\r | |
66 | align: Ext.emptyFn,\r | |
67 | \r | |
68 | /**\r | |
69 | * @method\r | |
70 | * Add `step` `unit`s to the value.\r | |
71 | * @param {*} value The value to be added.\r | |
72 | * @param {Number} step The step of units. Negative value are allowed.\r | |
73 | * @param {*} unit The unit.\r | |
74 | */\r | |
75 | add: Ext.emptyFn,\r | |
76 | \r | |
77 | /**\r | |
78 | * @method\r | |
79 | * Given a start point and estimated step size of a range, determine the preferred step size.\r | |
80 | * \r | |
81 | * @param {*} start The start point of range.\r | |
82 | * @param {*} estStepSize The estimated step size.\r | |
83 | * @return {Object} Return the step size by an object of step x unit.\r | |
84 | * @return {Number} return.step The step count of units.\r | |
85 | * @return {Number|Object} return.unit The unit.\r | |
86 | */\r | |
87 | preferredStep: Ext.emptyFn\r | |
88 | }); |