parallel-coordinates
parallel-coordinates copied to clipboard
Example slickgrid: sorting doesn't work properly
Hi, thanks for this awesome library! I just started playing around with the examples and have the impression that column sorting doesn't work properly for the slickgrid example.
Sort the fiber(g) column in increasing order works.

Sort the fiber(g) column in decreasing order doesn't work. The selected top data point is clearly not the highes fiber(g) value in the plot.

Any idea what goes wrong? I would really like to use this example. Any help to fix this would be very welcome.
Thanks
The results are being sorted as strings, not as numbers. To fix, you could replace the comparer function in the example with
function convert_to_float(x) {
var converted = parseFloat(x);
return isNaN(converted) ? x : converted
}
function comparer(a, b) {
var x = convert_to_float(a[sortcol]), y = convert_to_float(b[sortcol]);
return (x == y ? 0 : (x > y ? 1 : -1));
}