3 This file is part of Ext JS 4
5 Copyright (c) 2011 Sencha Inc
7 Contact: http://www.sencha.com/contact
9 GNU General Public License Usage
10 This file may be used under the terms of the GNU General Public License version 3.0 as published by the Free Software Foundation and appearing in the file LICENSE included in the packaging of this file. Please review the following information to ensure the GNU General Public License version 3.0 requirements will be met: http://www.gnu.org/copyleft/gpl.html.
12 If you are unsure which license is appropriate for your use, please contact the sales department at http://www.sencha.com/contact.
16 * @class Ext.chart.axis.Category
17 * @extends Ext.chart.axis.Axis
19 * A type of axis that displays items in categories. This axis is generally used to
20 * display categorical information like names of items, month names, quarters, etc.
21 * but no quantitative values. For that other type of information <em>Number</em>
22 * axis are more suitable.
24 * As with other axis you can set the position of the axis and its title. For example:
26 * {@img Ext.chart.axis.Category/Ext.chart.axis.Category.png Ext.chart.axis.Category chart axis}
28 * var store = Ext.create('Ext.data.JsonStore', {
29 * fields: ['name', 'data1', 'data2', 'data3', 'data4', 'data5'],
31 * {'name':'metric one', 'data1':10, 'data2':12, 'data3':14, 'data4':8, 'data5':13},
32 * {'name':'metric two', 'data1':7, 'data2':8, 'data3':16, 'data4':10, 'data5':3},
33 * {'name':'metric three', 'data1':5, 'data2':2, 'data3':14, 'data4':12, 'data5':7},
34 * {'name':'metric four', 'data1':2, 'data2':14, 'data3':6, 'data4':1, 'data5':23},
35 * {'name':'metric five', 'data1':27, 'data2':38, 'data3':36, 'data4':13, 'data5':33}
39 * Ext.create('Ext.chart.Chart', {
40 * renderTo: Ext.getBody(),
48 * fields: ['data1', 'data2', 'data3', 'data4', 'data5'],
49 * title: 'Sample Values',
59 * adjustMinimumByMajorUnit: 0
64 * title: 'Sample Metrics',
77 * yField: ['data1', 'data2', 'data3', 'data4', 'data5'],
84 * In this example with set the category axis to the bottom of the surface, bound the axis to
85 * the <em>name</em> property and set as title <em>Month of the Year</em>.
88 Ext.define('Ext.chart.axis.Category', {
90 /* Begin Definitions */
92 extend: 'Ext.chart.axis.Axis',
94 alternateClassName: 'Ext.chart.CategoryAxis',
96 alias: 'axis.category',
101 * A list of category names to display along this axis.
103 * @property categoryNames
109 * Indicates whether or not to calculate the number of categories (ticks and
110 * labels) when there is not enough room to display all labels on the axis.
111 * If set to true, the axis will determine the number of categories to plot.
112 * If not, all categories will be plotted.
114 * @property calculateCategoryCount
117 calculateCategoryCount: false,
119 // @private creates an array of labels to be used when rendering.
120 setLabels: function() {
121 var store = this.chart.store,
122 fields = this.fields,
127 store.each(function(record) {
128 for (i = 0; i < ln; i++) {
129 this.labels.push(record.get(fields[i]));
134 // @private calculates labels positions and marker positions for rendering.
135 applyData: function() {
138 var count = this.chart.store.getCount();