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 `Number`
22 * axis are more suitable.
24 * As with other axis you can set the position of the axis and its title. For example:
27 * var store = Ext.create('Ext.data.JsonStore', {
28 * fields: ['name', 'data1', 'data2', 'data3', 'data4', 'data5'],
30 * {'name':'metric one', 'data1':10, 'data2':12, 'data3':14, 'data4':8, 'data5':13},
31 * {'name':'metric two', 'data1':7, 'data2':8, 'data3':16, 'data4':10, 'data5':3},
32 * {'name':'metric three', 'data1':5, 'data2':2, 'data3':14, 'data4':12, 'data5':7},
33 * {'name':'metric four', 'data1':2, 'data2':14, 'data3':6, 'data4':1, 'data5':23},
34 * {'name':'metric five', 'data1':27, 'data2':38, 'data3':36, 'data4':13, 'data5':33}
38 * Ext.create('Ext.chart.Chart', {
39 * renderTo: Ext.getBody(),
47 * fields: ['data1', 'data2', 'data3', 'data4', 'data5'],
48 * title: 'Sample Values',
58 * adjustMinimumByMajorUnit: 0
63 * title: 'Sample Metrics',
76 * yField: ['data1', 'data2', 'data3', 'data4', 'data5'],
83 * In this example with set the category axis to the bottom of the surface, bound the axis to
84 * the `name` property and set as title _Month of the Year_.
86 Ext.define('Ext.chart.axis.Category', {
88 /* Begin Definitions */
90 extend: 'Ext.chart.axis.Axis',
92 alternateClassName: 'Ext.chart.CategoryAxis',
94 alias: 'axis.category',
99 * A list of category names to display along this axis.
100 * @property {String} categoryNames
105 * Indicates whether or not to calculate the number of categories (ticks and
106 * labels) when there is not enough room to display all labels on the axis.
107 * If set to true, the axis will determine the number of categories to plot.
108 * If not, all categories will be plotted.
110 * @property calculateCategoryCount
113 calculateCategoryCount: false,
115 // @private creates an array of labels to be used when rendering.
116 setLabels: function() {
117 var store = this.chart.store,
118 fields = this.fields,
123 store.each(function(record) {
124 for (i = 0; i < ln; i++) {
125 this.labels.push(record.get(fields[i]));
130 // @private calculates labels positions and marker positions for rendering.
131 applyData: function() {
134 var count = this.chart.store.getCount();