chiasm-project / chiasm

A browser based environment for interactive data visualizations.
MIT License
184 stars 27 forks source link

Add ability to links plugin to bind from chiasm instance to plugin. #38

Closed Hypercubed closed 9 years ago

Hypercubed commented 9 years ago

Using the links plugin you can link bindings between individual plugins like this:

  "links": {
    "plugin": "chiasm/plugins/links",
    "state": {
      "bindings": [
        "dataLoader.data -> barChart.data"
      ]
    }
  }

Perhaps if we can also link the parent chiasm instance and the child plugins like this:

  "links": {
    "plugin": "chiasm/plugins/links",
    "state": {
      "bindings": [
        "chiasm.data -> barChart.data"  // or "self.data -> barChart.data"
      ]
    }
  }

Then we can do this:

var chiasm = Chiasm(document.getElementById('container'));
chasm.data = [/* data */];
curran commented 9 years ago

Oh wow, that's an interesting idea. The thing that strikes me about this though is that the configuration structure will no longer completely represent the state of the system, it will be dependent on chiasm.data being set. However, I can see how this makes sense where Chiasm is embedded in a larger system that already has a reference to the data.

For this case, I was thinking that a plugin could be created that just exposes the data, but this approach of setting chiasm.data could also work, and in a way it is simpler.