Caleydo/caleydo.github.io

Step can not be used with negative end index

Closed this issue · 1 comments

  • web_bundle version: v0.0.1
  • browser version: FF 47.0.1
  • OS: Mac OSX 10.11.6

Reproducer and Expected behavior:

function demo_5($target) {
  var sequence = Array.from(Array(10).keys());
  var matrix = Caleydo.d3.parser.parseMatrix(
      // times table
      sequence.map(function(m){
        return sequence.map(function(n){
          return m*n;
        })
      }),
      sequence, // row_ids
      sequence // col_ids
  );

  var with_step = Caleydo.core.range.parse('(0:10:2), 1');
  var with_step_view = matrix.view(with_step);
  Caleydo.core.multiform.create(with_step_view, $target[0]);

  /* Behaves as expected: (allowing for bad column headers)
  ID    0   2   4   6   8
    0   0
    2   2
    4   4
    6   6
    8   8
   */

  var negative_end = Caleydo.core.range.parse('(0:-1), 1');
  var negative_end_view = matrix.view(negative_end);
  Caleydo.core.multiform.create(negative_end_view, $target[0]);

  /* Behaves as expected: (allowing for bad column headers)
  ID    0   1   2   3   4   5   6   7   8   9
    0   0
    1   1
    2   2
    3   3
    4   4
    5   5
    6   6
    7   7
    8   8
    9   9
   */

  var with_step_and_negative_end = Caleydo.core.range.parse('(0:-1:2), 1');
  var with_step_and_negative_end_view = matrix.view(with_step_and_negative_end);
  Caleydo.core.multiform.create(with_step_and_negative_end_view, $target[0]);

  /*
  Only outputs ID. Expect the same output as the first example.
   */
}