statgen / locuszoom

A Javascript/d3 embeddable plugin for interactively visualizing statistical genetic data from customizable sources.
https://statgen.github.io/locuszoom/
MIT License
154 stars 29 forks source link

Structure panels and data layers as arrays in the layout #68

Closed Frencil closed 8 years ago

Frencil commented 8 years ago

As described by @jonathonl, the current convention for defining lists of primary objects in the layout (panels and data layers) is confusing:

var layout = {
  ...
  panels: {
    panel_1_id: {
      ...
      data_layers: {
        data_layer_1_id: {
          ...
        }
      }
    },
    panel_2_id: {
      ...
    }
  }
};

The problem here is that panel and data layer IDs are expressed as keys in a map, a space generally reserved for supported/documented attribute names, not user-defined values. A more intuitive approach would make the id value a named parameter and use arrays, like so:

var layout = {
  ...
  panels: [
    {
      id: "panel_1_id",
      data_layers: [
        {
          id: "data_layer_1_id",
          ...
        }
      ]
    },
    {
      id: "panel_2_id",
      ...
    }
  ]
};

While this is a pretty significant breaking change it makes the layout much more internally consistent.

Frencil commented 8 years ago

Resolved in v0.4.0