better sorting for the legend
This commit is contained in:
parent
433111124f
commit
bdb6d75f83
@ -44,7 +44,12 @@
|
|||||||
if (!colorKeys[id]) {
|
if (!colorKeys[id]) {
|
||||||
var keys = Object.keys(colorKeys);
|
var keys = Object.keys(colorKeys);
|
||||||
keys.push(id);
|
keys.push(id);
|
||||||
keys.sort();
|
keys.sort(function(a, b) {
|
||||||
|
var pa = parseFloat(a);
|
||||||
|
var pb = parseFloat(b);
|
||||||
|
if (isNaN(pa) || isNaN(pb)) return a.localeCompare(b);
|
||||||
|
return pa - pb;
|
||||||
|
});
|
||||||
var colors = colorScale.colors(keys.length);
|
var colors = colorScale.colors(keys.length);
|
||||||
colorKeys = {};
|
colorKeys = {};
|
||||||
keys.forEach(function(key, index) {
|
keys.forEach(function(key, index) {
|
||||||
|
Loading…
Reference in New Issue
Block a user