質問があります:
Jqplotで私の伝説のラベルを並べ替えることは可能ですか?
legend: {
show: true,
placement: 'outsideGrid'
},
質問があります:
Jqplotで私の伝説のラベルを並べ替えることは可能ですか?
legend: {
show: true,
placement: 'outsideGrid'
},
次のようなものを使用して、凡例の行を並べ替えることができます ( How may I sort a alphabetically using jQuery? に触発されました):
var rows = $('#chart .jqplot-table-legend tr').get();
rows.sort(function(a, b) {
return $(a).children().last().text().localeCompare($(b).children().last().text());
});
$.each(rows, function(index, item) {
$('#chart .jqplot-table-legend tbody').append(item);
});
これは、標準の凡例レンダラーに最適です。 にも機能しますEnhancedLegendRenderer
が、シリーズの表示/非表示を切り替えると、ソートされる前に存在していたラベルに対応するシリーズが実際に表示または非表示になります。