Skip to content Skip to sidebar Skip to footer

Flot: Stacked Bar Labels Overlapping / Not Showing

Here's my JSFiddle. The issue is that the stacked bars overlap / doesn't show all distinct labels stacked sometimes (see third bar in first chart). Not sure but, the issue is maybe

Solution 1:

To determine where a stacked bar starts, Flot has to sum up the height of the bars below it. If there are empty bars below (with no height) the sum can not be calculated. This leads to later bars again starting at zero.

To counter this insert the missing bars with a height of zero:

for (var i = 0; i < newData.length; i++) {
    for (var j = 0; j < newTicks.length; j++) {
        if (newData[i].data[j] === undefined) {
            newData[i].data[j] = [j, 0];
        }
    }
}

See this updated fiddle.

Post a Comment for "Flot: Stacked Bar Labels Overlapping / Not Showing"