Flot Stacked Bar
Issue is that the stacked bar labels overlap
HTML
<script src="http://www.flotcharts.org/javascript/jquery.flot.min.js"></script>
<script src="http://www.benjaminbuffet.com/public/js/jquery.flot.orderBars.js"></script>
<script src="http://www.flotcharts.org/flot/jquery.flot.stack.js"></script>
<h4 style="margin-left:50px;">Look at the third bar Co-operative PTA, <br />it should have two distinct stacked labels: 084 with 13 as value and 01-02 with 12 as value</h4><br />
<div id="placeholder2" class="bar-chart" style="width:700px;height:300px;"></div>
<br /><br /><br />
<h4 style="margin-left:50px;">Example:</h4>
<div id="placeholder" class="bar-chart" style="width:700px;height:300px;"></div>
JavaScript
/*
Look at the third bar Co-operative PTA, it should have two distinct stacked labels: 084 with 13 as value and 01-02 with 12 as value
*/
$(function() {
var dataFromServer = [{
"name": "Airline Ticket Services Ltd",
"label": "01-02",
"countInbound": 2,
"minsInbound": 1,
"customerid": 81
}, {
"name": "Beaver Travel",
"label": "01-02",
"countInbound": 1,
"minsInbound": 17,
"customerid": 124
}, {
"name": "Beaver Travel",
"label": "080",
"countInbound": 32,
"minsInbound": 192,
"customerid": 124
}, { /*-----------------------------THIRD BAR*/
"name": "Co-operative PTA",
"label": "084",
"countInbound": 13,
"minsInbound": 12,
"customerid": 47
}, {
"name": "Co-operative PTA",
"label": "01-02",
"countInbound": 12,
"minsInbound": 26,
"customerid": 47
}, { /*--------------------------------------*/
"name": "P&P Associates Ltd",
"label": "084",
"countInbound": 14,
"minsInbound": 120,
"customerid": 69
}, {
"name": "Vertical Group",
"label": "084",
"countInbound": 28,
"minsInbound": 126,
"customerid": 19
}];
var newData = [];
var newLabels = [];
var newTicks = [];
for (var i = 0; i < dataFromServer.length; i++) {
var datapoint = dataFromServer[i];
var tick = newTicks.indexOf(datapoint.name);
if (tick == -1) {
tick = newTicks.length;
newTicks.push(datapoint.name);
}
var index = newLabels.indexOf(datapoint.label);
if (index == -1) {
index = newLabels.length;
newLabels.push(datapoint.label);
newDataPoint = {
label: datapoint.label,
data: []
};
newDataPoint.data[tick] = [tick, datapoint.countInbound];
newData.push(newDataPoint);
} else {
newData[index].data[tick] = [tick, datapoint.countInbound];
}
...