Results 1 to 3 of 3

Thread: Column Chart axes does not render properly

  1. #1
    Sencha User
    Join Date
    May 2012
    Posts
    61
    Vote Rating
    2
      0  

    Default 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 Attached Images

  2. #2
    Sencha - Sr Software Engineer mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    39,553
    Answers
    3931
    Vote Rating
    1272
      0  

    Default

    What Ext JS 4 version are you using?
    Mitchell Simoens @LikelyMitch
    Sencha Inc, Senior Software Engineer
    ________________
    Learn BBCode and use it! Checkout the CODE tag!

    Check out my GitHub, lots of nice things for Ext JS and Sencha Touch
    https://github.com/mitchellsimoens

  3. #3
    Sencha User Brett Hannah's Avatar
    Join Date
    Oct 2012
    Location
    London
    Posts
    24
    Answers
    1
    Vote Rating
    6
      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

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •