I am using the code snippet from https://stackoverflow.com/a/3/2/11 to mark my fleet data points. So far it has served me well, but now I have to indicate the general values ββof the stacked bars. There are two series of data, and so far I have been able to calculate the amounts, but I can not find the correct location for my labels. I would like to place them on top of the stacks, but pointOffset gives me offsets based on non-stationary bars.
This is the code that I am currently using, it puts labels where the data points of the second series will be, if the bars have not been stacked, which puts them somewhere in the upper bars.
$.each(p.getData()[1].data, function(i, el){ var series0 = p.getData()[0].data; sum = el[1] + series0[i][2] var o = p.pointOffset({x: el[0], y: el[1]}); $('<div class="data-point-label">' + sum + '</div>').css( { position: 'absolute', left: o.left - 5, top: o.top , display: 'none' }).appendTo(p.getPlaceholder()).fadeIn('slow'); });
Edit # 1: While I was trying to use c2p / p2c, calculating the upper value, using the upper values ββof single data points and finding additional documentation on the stack plugin. I'm afraid none of this helped me.
Edit # 2: I also tried the code specified in https://stackoverflow.com/a/147286/..but this does not work for me. I suspect the author is using a plugin with some shortcuts ...
Meike source share