facebookresearch / hiplot

HiPlot makes understanding high dimensional data easy
https://facebookresearch.github.io/hiplot/
MIT License
2.74k stars 138 forks source link

Fix column ordering after resize #248

Closed danthe3rd closed 2 years ago

danthe3rd commented 2 years ago

Closes #247

mathematicalmichael commented 9 months ago

from what I can tell, this causes page-refreshes to swap column order. which is strange considering the URL has an ordering in it that should be respected, but it's being reversed each time.

reverting this commit causes deterministic ordering, but re-introduces the resizing issue.

version 0.1.28 does not suffer from either bug, FWIW.

mathematicalmichael commented 9 months ago

this appears to fix it. swapping letters. [don't ask why... I guessed and checked to get here]

.bind(this)).reverse().sort(function(this: ParallelPlot, a: string, b: string) {
      const pda = this.state.order.findIndex((e) => e == b);
      const pdb = this.state.order.findIndex((e) => e == a);
      return (pdb == -1 ? this.state.order.length : pdb) - (pda == -1 ? this.state.order.length : pda);
    }