PDA

View Full Version : Y Axis Problem in Chart

ajithct
21 Oct 2013, 3:41 AM
Hi All,

Duplicate numbers plotted in y-axis and number formatting to be unique Ex) if decimal values is plotted all values should be in decimals(0.60,0.90,1.00,2.00) or else 1,2,3,4 etc

Can anyone please provide a solution for this..

Attached image for reference..

46442

Any help is highly appreciated..

scottmartin
24 Oct 2013, 6:56 AM

var store = Ext.create('Ext.data.JsonStore', {
fields: ['name', 'data'],
data: [
{ 'name': 'metric one', 'data': 2 },
{ 'name': 'metric two', 'data': 3 },
{ 'name': 'metric three', 'data': 4 },
{ 'name': 'metric four', 'data': 5 },
{ 'name': 'metric five', 'data': 4 }
]
});

Ext.create('Ext.chart.Chart', {
renderTo: Ext.getBody(),
width: 500,
height: 300,
animate: true,
store: store,
axes: [
{
type: 'Numeric',
position: 'left',
fields: ['data'],
label: {
renderer: Ext.util.Format.numberRenderer('0,0.0')
},
title: 'Sample Values',
grid: true,

maximum: 12,
minimum: 0,
majorTickSteps: 11

},
{
type: 'Category',
position: 'bottom',
fields: ['name'],
title: 'Sample Metrics'
}
],
series: [
{
type: 'column',
axis: 'left',
highlight: true,
tips: {
trackMouse: true,
width: 140,
height: 28,
renderer: function(storeItem, item) {
this.setTitle(storeItem.get('name') + ': ' + storeItem.get('data') + ' \$');
}
},
label: {
display: 'insideEnd',
'text-anchor': 'middle',
field: 'data',
renderer: Ext.util.Format.numberRenderer('0'),
orientation: 'vertical',
color: '#333'
},
xField: 'name',
yField: 'data'
}
]
});

ajithct
27 Oct 2013, 10:14 PM
Hi Scott,

If I specify the minimum as 0 then problem comes with plotting the negative values, as y axis starts only from 0.

Any solution for this?