PDA

View Full Version : Gauge chart and labels



smarmysam
20 May 2013, 9:14 PM
I'm trying to get a label on my gauge chart and nothing works

Any hints ?


{ xtype: 'chart',
height: 125,
id: 'chtOffset1',
maxHeight: 200,
maxWidth: 200,
minHeight: 100,
minWidth: 200,
width: 200,
animate: true,
insetPadding: 35,
store: 'strGauge',
axes: [
{
position: 'gauge',
type: 'Gauge',
fields: [
'value'
],
label: {
field: 'value',
display: 'middle'
},
maximum: 100,
minimum: 0
}
],
series: [
{
type: 'gauge',
label: {
field: 'value',
display: 'middle'
},
angleField: 'value',
donut: 35
}
]
}

slemmon
22 May 2013, 9:20 AM
*writing as of 4.2
I'm afraid that the gauge series doesn't support labels.

smarmysam
22 May 2013, 1:26 PM
Yeah this is what i ended up doing



series: [
{
type: 'gauge',
renderer: function(sprite, record, attributes, index, store) {
var sprite2 = Ext.create('Ext.draw.Sprite', {
type: 'text',
surface: sprite.surface,
text: Math.floor(record.data.value) + '%',
font: '16px Arial',
x: 83,
y: 90,
width: 100,
height: 100
});
sprite2.show(true);
sprite.surface.add(sprite2);
return attributes;


},
label: {
field: 'value',
display: 'middle'
},
angleField: 'value',
donut: 35
}


That works !