mercredi 31 décembre 2014

setTitle error for a gauge series polar chart

Using ExtJs 5.0.1. A gauge series for a polar chart only defines a single field. However, when I try to change the title in the series using setTitle(...), I get an error that me.getYField() is null. This is reported by the sencha method 'updateTitle' in Series.js. Even though many types of series do allow X and Y fields, a gauge is only a single 'field' option. So I assume this function is erring out because YField does not exist on a gauge series.

I am defining my gauge as:


items: {

xtype: 'polar',

itemId: 'gauge',

store: me.store,

title: 'polar title',

legend: {

docked: 'bottom'

},

series: {

type: 'gauge',

title: 'Avg',

YField: 'loadavg',

label: {

display: 'under',

field: 'loadavg'

},

needle: true,

showInLegend: true,

minimum: 100,

maximum: 800,

field: 'loadavg',

donut: 50,

colors: ['#3AA8CB', '#ddd']

}

}


I am trying to change the title with the following code (form a load callback):


var data = this.store.first();

var cpuValue = data.get(this.chartConfig.series.field);

// Get the series title.

var chart = this.chart.getComponent('gauge');

var series = chart.getSeries()[0]; // only 1 series, so get first one.

var title = series.getTitle();

// Append the display value to the title.

series.setTitle(title + ': ' + cpuValue + "%");






setTitle error for a gauge series polar chart

Aucun commentaire:

Enregistrer un commentaire