PDA

View Full Version : [4.2.1.883] Ext.chart.Label.label.renderer in Bar.Series



ncr0
7 Oct 2013, 1:06 AM
REQUIRED INFORMATION

Ext version tested:

Ext 4.2.1.883
Browser versions tested against:

Google Chrome v.?
Opera 15.0
DOCTYPE tested against:

html
Description:

renderer method in label config is not run if label.display set to 'over' or 'under'
Steps to reproduce the problem:

Create Bar chart with one series which has custom label config
set label config to

{display: 'over',
field: "x", // must exist
orientation: "horizontal",
renderer: function () {
debugger; //or anything, will not be ran anyway
}
}

The result that was expected:

renderer ran
The result that occurs instead:

renderer didn't ran
HELPFUL INFORMATION

Possible fix:

working on it

Operating System:

OSX 10.8.4

ncr0
7 Oct 2013, 4:11 AM
working fix:
change this:

} else if (display == over || display == under) {
if (stacked && stackedDisplay) { //----------------------------------------- // Position the label on top or at the bottom of a stacked bar/column text = label.attr.text; label.setAttributes({ // The text is already set onto the label: we just need to set the style // (but don't overwrite any custom style that might have been set by an app override). style: Ext.applyIf((label.attr && label.attr.style) || {}, { 'font-weight':'bold', 'font-size':'14px' } ) });
to this:

} else if (display == over || display == under) { if (stacked && stackedDisplay) {
//-----------------------------------------
// Position the label on top or at the bottom of a stacked bar/column

text = (Ext.isNumber(index) ? format(storeItem.get(field[index]), label, storeItem, item, i, display, animate, index) : '');
label.setAttributes({
// The text is already set onto the label: we just need to set the style
// (but don't overwrite any custom style that might have been set by an app override).
style: Ext.applyIf((label.attr && label.attr.style) || {},
{
'font-weight':'bold',
'font-size':'14px'
}
)
});

Gary Schlosberg
7 Oct 2013, 11:58 AM
According to the docs for label (http://docs.sencha.com/extjs/4.2.1/#!/api/Ext.chart.series.Bar-cfg-label)'s display config, 'over' and 'under' aren't valid options for bar charts.


Specifies the presence and position of the labels. The possible values depend on the chart type. For Line and Scatter charts: "under" | "over" | "rotate". For Bar and Column charts: "insideStart" | "insideEnd" | "outside". For Pie charts: "outside" | "rotate". For all charts: "none" hides the labels and "middle" is reserved for future use. On stacked Bar and stacked Column charts, if 'stackedDisplay' is set, the values "over" or "under" can be passed internally to onCreateLabel (http://docs.sencha.com/extjs/4.2.1/#%21/api/Ext.chart.Label-method-onCreateLabel) and onPlaceLabel (http://docs.sencha.com/extjs/4.2.1/#%21/api/Ext.chart.Label-method-onPlaceLabel) (however they cannot be used by the application as config values for label.display).

ncr0
7 Oct 2013, 12:01 PM
Ouch, you're right. Didn't see this before. I'm so sorry for taking your time. Thank you!