syntagmatic / parallel-coordinates

A d3-based parallel coordinates plot in canvas. This library is no longer actively developed.
http://syntagmatic.github.com/parallel-coordinates/
Other
511 stars 211 forks source link

doc bug on dimensions API #292

Closed Sigfried closed 8 years ago

Sigfried commented 8 years ago

I think dimensions are being refactored (?), but the documentation is currently confused as to whether it's an object or array; or, at least, I am.

https://github.com/syntagmatic/parallel-coordinates#parcoords_dimensions says:

var dimensions = {
      {"name":
          {
              orient: 'right',
              type: 'string',
              tickPadding: 0,
              innerTickSize: 8,
              type: "string"
          }
      },
      {"protein": {type:"number"}},
      {"calcium": {type:"number"}};

I think it should either be:

var dimensions = {
      "name":
          {
              orient: 'right',
              type: 'string',
              tickPadding: 0,
              innerTickSize: 8,
              type: "string"
          },
      "protein": {type:"number"},
      "calcium": {type:"number"}};

Or something like:

var dimensions = [
      {"name":
          {
              orient: 'right',
              type: 'string',
              tickPadding: 0,
              innerTickSize: 8,
              type: "string"
          }
      },
      {"protein": {type:"number"}},
      {"calcium": {type:"number"}];
BroHammie commented 8 years ago

It is an object. Should read:

var dimensions = {
      {"name":
          {
              orient: 'right',
              type: 'string',
              tickPadding: 0,
              innerTickSize: 8,
              type: "string"
          }
      },
      {"protein": {type:"number"}},
      {"calcium": {type:"number"}}
     };

Missing one last curly. I will update shortly.

Sigfried commented 8 years ago

I think it should be my first example above. I don't think what you have is valid javascript, right?

dehli commented 8 years ago

@Sigfried You're right. There's no key for the first object inside of dimensions. Also I'm not familiar with the refactoring, sorry!

Just looked at the code, and from what I can tell it's not an array.

Is it something like this?

var dimensions = {
    name: {
        orient: 'right',
        type: 'string',
        tickPadding: 0,
        innerTickSize: 8
    },
    protein: {
        type: 'number'
    },
    calcium: {
        type: 'number'
    }
};
BroHammie commented 8 years ago

Ah. Yeah. https://syntagmatic.github.io/parallel-coordinates/examples/axis-config.html