mirror of
https://github.com/ntop/ntopng.git
synced 2026-05-04 09:50:09 +00:00
Sorting Pie Chart items by label to avoid shuffling content on every update
This commit is contained in:
parent
92c50fd8f6
commit
b3a35ef2d4
3 changed files with 41 additions and 5 deletions
|
|
@ -61,14 +61,23 @@ function PieChart(name, update_url, url_params, units, refresh) {
|
|||
|
||||
// Needed to draw the pie immediately
|
||||
this.update();
|
||||
this.update();
|
||||
//this.update();
|
||||
|
||||
// var updateInterval = window.setInterval(update, refresh);
|
||||
|
||||
|
||||
function compare_by_label(a, b) {
|
||||
if (a.label < b.label){
|
||||
return -1;
|
||||
} else if (a.label > b.label) {
|
||||
return 1;
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
function update_pie_chart(data) {
|
||||
data.sort(compare_by_label);
|
||||
streakerDataAdded = data;
|
||||
|
||||
oldPieData = filteredPieData;
|
||||
pieData = donut(streakerDataAdded);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue