2 * @class Ext.chart.axis.Category
3 * @extends Ext.chart.axis.Axis
5 * A type of axis that displays items in categories. This axis is generally used to
6 * display categorical information like names of items, month names, quarters, etc.
7 * but no quantitative values. For that other type of information <em>Number</em>
8 * axis are more suitable.
10 * As with other axis you can set the position of the axis and its title. For example:
11 * {@img Ext.chart.axis.Category/Ext.chart.axis.Category.png Ext.chart.axis.Category chart axis}
13 var store = Ext.create('Ext.data.JsonStore', {
14 fields: ['name', 'data1', 'data2', 'data3', 'data4', 'data5'],
16 {'name':'metric one', 'data1':10, 'data2':12, 'data3':14, 'data4':8, 'data5':13},
17 {'name':'metric two', 'data1':7, 'data2':8, 'data3':16, 'data4':10, 'data5':3},
18 {'name':'metric three', 'data1':5, 'data2':2, 'data3':14, 'data4':12, 'data5':7},
19 {'name':'metric four', 'data1':2, 'data2':14, 'data3':6, 'data4':1, 'data5':23},
20 {'name':'metric five', 'data1':27, 'data2':38, 'data3':36, 'data4':13, 'data5':33}
24 Ext.create('Ext.chart.Chart', {
25 renderTo: Ext.getBody(),
33 fields: ['data1', 'data2', 'data3', 'data4', 'data5'],
34 title: 'Sample Values',
44 adjustMinimumByMajorUnit: 0
49 title: 'Sample Metrics',
62 yField: ['data1', 'data2', 'data3', 'data4', 'data5'],
70 In this example with set the category axis to the bottom of the surface, bound the axis to
71 the <em>name</em> property and set as title <em>Month of the Year</em>.
74 Ext.define('Ext.chart.axis.Category', {
76 /* Begin Definitions */
78 extend: 'Ext.chart.axis.Axis',
80 alternateClassName: 'Ext.chart.CategoryAxis',
82 alias: 'axis.category',
87 * A list of category names to display along this axis.
89 * @property categoryNames
95 * Indicates whether or not to calculate the number of categories (ticks and
96 * labels) when there is not enough room to display all labels on the axis.
97 * If set to true, the axis will determine the number of categories to plot.
98 * If not, all categories will be plotted.
100 * @property calculateCategoryCount
103 calculateCategoryCount: false,
105 // @private creates an array of labels to be used when rendering.
106 setLabels: function() {
107 var store = this.chart.store,
108 fields = this.fields,
113 store.each(function(record) {
114 for (i = 0; i < ln; i++) {
115 this.labels.push(record.get(fields[i]));
120 // @private calculates labels positions and marker positions for rendering.
121 applyData: function() {
124 var count = this.chart.store.getCount();