1. #1
    Sencha User
    Join Date
    May 2012
    Posts
    61
    Vote Rating
    2
    cahello is on a distinguished road

      0  

    Default Unanswered: Column Chart axes does not render properly

    Unanswered: Column Chart axes does not render properly


    I have the following json data:

    {data: [
    { "name": "Thu", "failure": 0, "success": 0},
    { "name": "Wed", "failure": 0, "success": 0},
    { "name": "Tue", "failure": 0, "success": 3},
    { "name": "Mon", "failure": 0, "success": 0},
    { "name": "Sun", "failure": 0, "success": 3},
    { "name": "Sat", "failure": 0, "success": 0},
    { "name": "Fri", "failure": 0, "success": 0}
    ]
    }

    When the column chart is rendered, the axes is not numbered correctly. What might be wrong? The code for the chart is:

    Code:
    ch= Ext.create('Ext.chart.Chart', {
    		width: 600,
    		height: 300,
    		region: 'center',
    		insetPadding: 80,
    		theme: 'Coloredlegend', //this is to set the green and red colors for the success and failure
    		animate: true,
    		store: store,
    		legend: {
    			position: 'right',
    			yField: 'success',
    			//style: {color: 0x34ff0a},
                yField: 'failure',
    			//style: {color: 0xd4ff51},
    		},
    		axes: [
    				{
    					   type: 'Numeric',
    			    	   position: 'left',
    			    	   fields: ['failure'],
    					   label: {
    						   renderer: Ext.util.Format.numberRenderer('0,0')
    					   },
    					   title: 'Failed Data',
    					   minimum: 0
    				},
    		       {
    				   type: 'Numeric',
    				   position: 'left', 
    				   fields: ['success'],
    		    	   label: {
    		    		   renderer: Ext.util.Format.numberRenderer('0,0')
    		    	   },
    		    	   title: 'Test', 
    		    	   grid: true,
    				   minimum: 0
    		    	  
    		       },
    		       {
    		    	   type: 'Category',
    		    	   position: 'bottom',
    		    	   fields: ['name'],
    		    	   
    		       }
    		       ],
    		       series: [
    
    
    		                {
    		                	type: 'column',
    		                	axis: 'left', 
    		                	highlight: true,
    		                	tips: {
    		                		trackMouse: true,
    		                		width: 140,
    		                		height: 28,		         	
    		                		renderer: function(storeItem, item) {
    		                			this.setTitle(storeItem.get('name') + ': ' + item.value[1]);
    		                		}
    		                	},
    		                	label: {
    		                		display: 'insideEnd',
    		                		'text-anchor': 'middle',
    		                		field: ['success', 'failure'],
    		                		renderer: Ext.util.Format.numberRenderer('0'),
    		                		orientation: 'vertical',
    		                		color: '#333'
    		                	},
    		                	xField: 'name',
    		                	yField: ['success','failure'],
    		                	showInLegend: true,
    		                },		               
    		                ]
    	});
    I have also attached an example snapshot.
    Attached Images

  2. #2
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    37,074
    Answers
    3501
    Vote Rating
    855
    mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute

      0  

    Default


    What Ext JS 4 version are you using?
    Mitchell Simoens @SenchaMitch
    Sencha Inc, Senior Forum Manager
    ________________
    Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
    https://github.com/mitchellsimoens

    Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/

    Need more help with your app? Hire Sencha Services services@sencha.com

    Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is in print!

    When posting code, please use BBCode's CODE tags.

  3. #3
    Sencha User Brett Hannah's Avatar
    Join Date
    Oct 2012
    Location
    London
    Posts
    24
    Answers
    1
    Vote Rating
    6
    Brett Hannah is on a distinguished road

      1  

    Default


    Hi Cahello,

    The issue is that you have two axes bound to the left. Both are being drawn and that is why you have the strange numbering.

    You need to remove one of the 'left' axes leaving only one axis but setting:
    fields: ['success','failure']

    That should sort it.

    Brett Hannah
    LinkedIn
    EdgeUX
    Brett Hannah LinkedIn
    EdgeUX