4 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
5 <title>The source code</title>
6 <link href="../resources/prettify/prettify.css" type="text/css" rel="stylesheet" />
7 <script type="text/javascript" src="../resources/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-Category'>/**
19 </span> * @class Ext.chart.axis.Category
20 * @extends Ext.chart.axis.Axis
22 * A type of axis that displays items in categories. This axis is generally used to
23 * display categorical information like names of items, month names, quarters, etc.
24 * but no quantitative values. For that other type of information `Number`
25 * axis are more suitable.
27 * As with other axis you can set the position of the axis and its title. For example:
30 * var store = Ext.create('Ext.data.JsonStore', {
31 * fields: ['name', 'data1', 'data2', 'data3', 'data4', 'data5'],
33 * {'name':'metric one', 'data1':10, 'data2':12, 'data3':14, 'data4':8, 'data5':13},
34 * {'name':'metric two', 'data1':7, 'data2':8, 'data3':16, 'data4':10, 'data5':3},
35 * {'name':'metric three', 'data1':5, 'data2':2, 'data3':14, 'data4':12, 'data5':7},
36 * {'name':'metric four', 'data1':2, 'data2':14, 'data3':6, 'data4':1, 'data5':23},
37 * {'name':'metric five', 'data1':27, 'data2':38, 'data3':36, 'data4':13, 'data5':33}
41 * Ext.create('Ext.chart.Chart', {
42 * renderTo: Ext.getBody(),
50 * fields: ['data1', 'data2', 'data3', 'data4', 'data5'],
51 * title: 'Sample Values',
61 * adjustMinimumByMajorUnit: 0
66 * title: 'Sample Metrics',
79 * yField: ['data1', 'data2', 'data3', 'data4', 'data5'],
86 * In this example with set the category axis to the bottom of the surface, bound the axis to
87 * the `name` property and set as title _Month of the Year_.
89 Ext.define('Ext.chart.axis.Category', {
91 /* Begin Definitions */
93 extend: 'Ext.chart.axis.Axis',
95 alternateClassName: 'Ext.chart.CategoryAxis',
97 alias: 'axis.category',
101 <span id='Ext-chart-axis-Category-property-categoryNames'> /**
102 </span> * A list of category names to display along this axis.
103 * @property {String} categoryNames
107 <span id='Ext-chart-axis-Category-property-calculateCategoryCount'> /**
108 </span> * Indicates whether or not to calculate the number of categories (ticks and
109 * labels) when there is not enough room to display all labels on the axis.
110 * If set to true, the axis will determine the number of categories to plot.
111 * If not, all categories will be plotted.
113 * @property calculateCategoryCount
116 calculateCategoryCount: false,
118 // @private creates an array of labels to be used when rendering.
119 setLabels: function() {
120 var store = this.chart.store,
121 fields = this.fields,
126 store.each(function(record) {
127 for (i = 0; i < ln; i++) {
128 this.labels.push(record.get(fields[i]));
133 // @private calculates labels positions and marker positions for rendering.
134 applyData: function() {
137 var count = this.chart.store.getCount();