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