im struggling pie chart show correct label, rather "undefined".
in console log, labels there, , amounts being shown.
[ { label: "opened", data: 5}, { label: "qualified", data: 6}, { label: "closed", data: 1}, { label: "pending", data: 2},]; this made $.each function receives data ajax query.
i have below script creating graph:
var dataout = "["; $.each(value, function(item2, val2){ dataout = dataout + ' { label: "' + val2[0] + '", data: ' + val2[1] + '},'; }); dataout = dataout + "];"; var placeholder = $("#graph_myleads"); $.plot(placeholder, dataout, { series: { pie: { show: true, radius: 3/4, label: { show: true, radius: 3/4, formatter: _labelformatter, background: { opacity: 0.5, color: '#000' } } } }, legend: { show: false } }); and below formatter label:
var _labelformatter = function(label, series) { return "<div style='font-size:8pt; text-align:center; padding:2px; color:white;'>" + series.label + "<br/>" + math.round(series.percent) + "%</div>"; }; the code outputting this:

any on 1 appreciated :)
output label instead of series.label.
var _labelformatter = function(label, series) { console.log(dataout); return "<div style='font-size:8pt; text-align:center; padding:2px; color:white;'>" + label + "<br/>" + math.round(series.percent) + "%</div>"; };
Comments
Post a Comment