Skip to content

Reordering axes does not work correctly if data is 2D array of numbers #347

Description

@jamesscottbrown

For axis re-ordering to work correctly, the data must be an array of objects (with column names as attributes), rather than a 2D array of numbers (array of array of numbers).

For example, it does not work correctly if the reordering example is changed from

var data2 = d3.range(0,2*Math.PI,Math.PI/40)
  .map(function(x) {
    return {
      "-x": -x,
      x: x,
      "sin(x)": Math.sin(x),
      "cos(x)": Math.cos(x),
      "atan(x)": Math.atan(x),
      "exp(x)": Math.exp(x),
      "square(x)": x*x,
      "sqrt(x)": Math.sqrt(x),
    };
  });

to:

 var data2 = d3.range(0,2*Math.PI,Math.PI/40)
  .map(function(x) {
    return [-x, x, Math.sin(x), Math.cos(x), Math.atan(x), Math.exp(x), x*x, Math.sqrt(x)];
      });

or if .reorderable() is added to the 'Minimal Example'.

Whilst the order of the axes does change in response to dragging, lines still join the axes that was moved to the axes that were previously adjacent to it.

This limitation does not seem to be currently represented in the documentation.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions