I think we had the same problem. In my case I had to combine ledger account numbers with certain colors in my Google pie charts. So while constructing my array data for the pie-chart I also create an array colors. In that loop I use this:
var list = [];
$.each(dataObj.model_Response[0].array, function(key, item) {
var row = [];
var value = item.account.amount;
colors.push(_toColor(item.account.number.toString()));
row.push(item.account.name);
row.push(value);
list.push(row);
});
//.. list add to google DataTable.
The _toColor function:
var _toColor = function(n) {
n = crc32(n);
n &= 0xffffffff;
return("#" + ("000000" + dechex(n)).substr(-6));
}
In my options var I can simply assign the array:
colors: result['colors'],
And the result is two pie-charts with linked ledger account and colors! Hopefully I have been clear enough, if you still have questions about this let me know.
This is the result of my two pie-charts:
