Encountered a problem with how stacked bar and column charts are labeled in the most recent versions of Dojo. The labels are appearing at the center of the bar/column, starting from 0 instead of the end of the previous one. This results in overlapping labels or incorrect placement within the bar/column.
For example, if you refer to this JS Fiddle from a StackExchange post here, switching between Dojo versions "1.10.4" and "nightly" will show the label positions change.
I've identified the cause of the issue as the removal of the "GetValue" function from StackedBars and StackedColumn (Dojox\charting\plot2d\StackedColumn.js) files between versions 1.10.6 and 1.11.1. This function adjusted label positioning based on the previous value, which no longer happens.
Using ESRI's JavaScript API with Dojo 1.11.1. I tried copying and modifying the function from an older version of Dojo but encountered challenges due to changes in other charting functions.
As a JavaScript and Dojo beginner, is there a way to reintroduce this function without altering the ESRI API files?
If not, is it possible to integrate the old function into the newer version effectively?
Thank you!
UPDATE: Here is the altered content of my StackedBars.js:
//>>built
define("dojox/charting/plot2d/StackedBars",["dojo/_base/declare","dojo/_base/lang","./Bars","./commonStacked"],function(c,e,f,d){
return c("dojox.charting.plot2d.StackedBars",f,{
getSeriesStats:function(){
var a=d.collectStats(this.series,e.hitch(this,"isNullValue")),b;
a.hmin-=0.5;
a.hmax+=0.5;
b=a.hmin;
a.hmin=a.vmin;
a.vmin=b;
b=a.hmax;
a.hmax=a.vmax;
a.vmax=b;
return a
},
rearrangeValues:function(a,b,c){
return d.rearrangeValues.call(this,a,b,c)
},
// COPIED THIS FUNCTION FROM 1.10.6
getValue:function(_5,_6,_7,_8){
var y,x;
if(_8){
x=_6;
y=d.getIndexValue(this.series,_7,x,e.hitch(this, "isNullValue"));
}
else{
x=_5.x-1;
y=d.getValue(this.series,_7,_5.x);
y=[y[0]?y[0].y:null,y[1]?y[1]:null];
}
return {x:x,y:y[0],py:y[1]};
}
})});
The initial problem was with "e.hitch(this, "isNullValue")" where there was a typo.
Still facing issues with this not working for charts with negative values (no errors, just misplaced labels), and seeking advice on implementing this function without editing the Dojo source files.