4 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
5 <title>The source code</title>
6 <link href="../prettify/prettify.css" type="text/css" rel="stylesheet" />
7 <script type="text/javascript" src="../prettify/prettify.js"></script>
8 <style type="text/css">
9 .highlight { display: block; background-color: #ddd; }
11 <script type="text/javascript">
12 function highlight() {
13 document.getElementById(location.hash.replace(/#/, "")).className = "highlight";
17 <body onload="prettyPrint(); highlight();">
18 <pre class="prettyprint lang-js"><span id='Ext-chart-axis-Numeric-method-constructor'><span id='Ext-chart-axis-Numeric'>/**
19 </span></span> * @class Ext.chart.axis.Numeric
20 * @extends Ext.chart.axis.Axis
22 * An axis to handle numeric values. This axis is used for quantitative data as
23 * opposed to the category axis. You can set mininum and maximum values to the
24 * axis so that the values are bound to that. If no values are set, then the
25 * scale will auto-adjust to the values.
27 * {@img Ext.chart.axis.Numeric/Ext.chart.axis.Numeric.png Ext.chart.axis.Numeric chart axis}
31 * var store = Ext.create('Ext.data.JsonStore', {
32 * fields: ['name', 'data1', 'data2', 'data3', 'data4', 'data5'],
34 * {'name':'metric one', 'data1':10, 'data2':12, 'data3':14, 'data4':8, 'data5':13},
35 * {'name':'metric two', 'data1':7, 'data2':8, 'data3':16, 'data4':10, 'data5':3},
36 * {'name':'metric three', 'data1':5, 'data2':2, 'data3':14, 'data4':12, 'data5':7},
37 * {'name':'metric four', 'data1':2, 'data2':14, 'data3':6, 'data4':1, 'data5':23},
38 * {'name':'metric five', 'data1':27, 'data2':38, 'data3':36, 'data4':13, 'data5':33}
42 * Ext.create('Ext.chart.Chart', {
43 * renderTo: Ext.getBody(),
51 * fields: ['data1', 'data2', 'data3', 'data4', 'data5'],
52 * title: 'Sample Values',
62 * adjustMinimumByMajorUnit: 0
67 * title: 'Sample Metrics',
80 * yField: ['data1', 'data2', 'data3', 'data4', 'data5'],
87 * In this example we create an axis of Numeric type. We set a minimum value so that
88 * even if all series have values greater than zero, the grid starts at zero. We bind
89 * the axis onto the left part of the surface by setting <em>position</em> to <em>left</em>.
90 * We bind three different store fields to this axis by setting <em>fields</em> to an array.
91 * We set the title of the axis to <em>Number of Hits</em> by using the <em>title</em> property.
92 * We use a <em>grid</em> configuration to set odd background rows to a certain style and even rows
93 * to be transparent/ignored.
97 Ext.define('Ext.chart.axis.Numeric', {
99 /* Begin Definitions */
101 extend: 'Ext.chart.axis.Axis',
103 alternateClassName: 'Ext.chart.NumericAxis',
105 /* End Definitions */
109 alias: 'axis.numeric',
111 constructor: function(config) {
113 hasLabel = !!(config.label && config.label.renderer),
116 me.callParent([config]);
118 if (me.roundToDecimal === false) {
122 label.renderer = function(v) {
123 return me.roundToDecimal(v, me.decimals);
128 roundToDecimal: function(v, dec) {
129 var val = Math.pow(10, dec || 0);
130 return ((v * val) >> 0) / val;
133 <span id='Ext-chart-axis-Numeric-property-minimum'> /**
134 </span> * The minimum value drawn by the axis. If not set explicitly, the axis
135 * minimum will be calculated automatically.
142 <span id='Ext-chart-axis-Numeric-property-maximum'> /**
143 </span> * The maximum value drawn by the axis. If not set explicitly, the axis
144 * maximum will be calculated automatically.
151 <span id='Ext-chart-axis-Numeric-property-decimals'> /**
152 </span> * The number of decimals to round the value to.
160 <span id='Ext-chart-axis-Numeric-property-scale'> /**
161 </span> * The scaling algorithm to use on this axis. May be "linear" or
162 * "logarithmic".
167 scale: "linear",
169 <span id='Ext-chart-axis-Numeric-property-position'> /**
170 </span> * Indicates the position of the axis relative to the chart
177 <span id='Ext-chart-axis-Numeric-property-adjustMaximumByMajorUnit'> /**
178 </span> * Indicates whether to extend maximum beyond data's maximum to the nearest
181 * @property adjustMaximumByMajorUnit
184 adjustMaximumByMajorUnit: false,
186 <span id='Ext-chart-axis-Numeric-property-adjustMinimumByMajorUnit'> /**
187 </span> * Indicates whether to extend the minimum beyond data's minimum to the
190 * @property adjustMinimumByMajorUnit
193 adjustMinimumByMajorUnit: false,
195 // @private apply data.
196 applyData: function() {
198 return this.calcEnds();