Upgrade to ExtJS 4.0.2 - Released 06/09/2011
[extjs.git] / examples / charts / FormDashboard.js
index 46925f9..ae216b7 100644 (file)
@@ -1,3 +1,17 @@
+/*
+
+This file is part of Ext JS 4
+
+Copyright (c) 2011 Sencha Inc
+
+Contact:  http://www.sencha.com/contact
+
+GNU General Public License Usage
+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.
+
+If you are unsure which license is appropriate for your use, please contact the sales department at http://www.sencha.com/contact.
+
+*/
 Ext.require([
     'Ext.form.*',
     'Ext.data.*',
@@ -39,8 +53,8 @@ Ext.onReady(function(){
         //updates a record modified via the form
         updateRecord = function(rec) {
             var name, series, i, l, items, json = [{
-                'Name': 'Price %',
-                'Data': rec.get('price %')
+                'Name': 'Price',
+                'Data': rec.get('price')
             }, {
                 'Name': 'Revenue %',
                 'Data': rec.get('revenue %')
@@ -114,7 +128,7 @@ Ext.onReady(function(){
     var ds = Ext.create('Ext.data.ArrayStore', {
         fields: [
             {name: 'company'},
-            {name: 'price %',   type: 'float'},
+            {name: 'price',   type: 'float'},
             {name: 'revenue %', type: 'float'},
             {name: 'growth %',  type: 'float'},
             {name: 'product %', type: 'float'},
@@ -128,7 +142,7 @@ Ext.onReady(function(){
         fields: ['Name', 'Data'],
         data: [
         {
-            'Name': 'Price %',
+            'Name': 'Price',
             'Data': 100
         }, {
             'Name': 'Revenue %',
@@ -154,12 +168,10 @@ Ext.onReady(function(){
         animate: true,
         store: chs,
         axes: [{
+            steps: 5,
             type: 'Radial',
             position: 'radial',
-            maximum: 100,
-            label: {
-                display: 'none'    
-            }
+            maximum: 100
         }],
         series: [{
             type: 'radar',
@@ -168,17 +180,13 @@ Ext.onReady(function(){
             showInLegend: false,
             showMarkers: true,
             markerConfig: {
-                radius: 2,
-                size: 2
+                radius: 4,
+                size: 4
             },
             style: {
-                fill: '#273f68',
+                fill: 'rgb(194,214,240)',
                 opacity: 0.5,
                 'stroke-width': 0.5
-            },
-            label: {
-                display: true,
-                field: 'Name'
             }
         }]
     });
@@ -202,13 +210,15 @@ Ext.onReady(function(){
                 text   : 'Price',
                 width    : 75,
                 sortable : true,
-                dataIndex: 'price %',
-                renderer: perc
+                dataIndex: 'price',
+                align: 'right',
+                renderer : 'usMoney'
             },
             {
                 text   : 'Revenue',
                 width    : 75,
                 sortable : true,
+                align: 'right',
                 dataIndex: 'revenue %',
                 renderer: perc
             },
@@ -216,6 +226,7 @@ Ext.onReady(function(){
                 text   : 'Growth',
                 width    : 75,
                 sortable : true,
+                align: 'right',
                 dataIndex: 'growth %',
                 renderer: perc
             },
@@ -223,6 +234,7 @@ Ext.onReady(function(){
                 text   : 'Product',
                 width    : 75,
                 sortable : true,
+                align: 'right',
                 dataIndex: 'product %',
                 renderer: perc
             },
@@ -230,6 +242,7 @@ Ext.onReady(function(){
                 text   : 'Market',
                 width    : 75,
                 sortable : true,
+                align: 'right',
                 dataIndex: 'market %',
                 renderer: perc
             }
@@ -265,18 +278,21 @@ Ext.onReady(function(){
         axes: [{
             type: 'Numeric',
             position: 'left',
-            fields: ['price %'],
+            fields: ['price'],
             minimum: 0,
-            label: {
-                font: '9px Arial'
-            },
             hidden: true
         }, {
             type: 'Category',
             position: 'bottom',
             fields: ['company'],
             label: {
-                font: '9px Arial'
+                renderer: function(v) {
+                    return Ext.String.ellipsis(v, 15, false);
+                },
+                font: '9px Arial',
+                rotate: {
+                    degrees: 270
+                }
             }
         }],
         series: [{
@@ -290,8 +306,9 @@ Ext.onReady(function(){
                 fill: '#a2b5ca'
             },
             label: {
+                contrast: true,
                 display: 'insideEnd',
-                field: 'price %',
+                field: 'price',
                 color: '#000',
                 orientation: 'vertical',
                 'text-anchor': 'middle'
@@ -307,7 +324,7 @@ Ext.onReady(function(){
                 }
             },
             xField: 'name',
-            yField: ['price %']
+            yField: ['price']
         }]        
     });
     
@@ -384,9 +401,9 @@ Ext.onReady(function(){
                         name: 'company',
                         disabled: true
                     },{
-                        fieldLabel: 'Price %',
-                        name: 'price %',
-                        listeners: createListeners('price %')
+                        fieldLabel: 'Price',
+                        name: 'price',
+                        listeners: createListeners('price')
                     },{
                         fieldLabel: 'Revenue %',
                         name: 'revenue %',
@@ -411,4 +428,4 @@ Ext.onReady(function(){
     });
 
     var gp = Ext.getCmp('company-form');
-});
\ No newline at end of file
+});