ming-codes / ember-cli-d3

An ember-cli addon to provide D3 integration into Ember app.
MIT License
43 stars 18 forks source link

Chart component yielding selection is not handled by child chart component correctly #44

Open ming-codes opened 8 years ago

ming-codes commented 8 years ago
{{#data-visual as |stage width height|}}
  {{#parent-chart select=stage.svg.select.chart as |selection|}}
    {{child-chart-component select=selection}}
  {{/parent-chart}}
{{/data-visual}}
// parent-chart.js
Ember.Component.extend({
  call(selection) {
    this.set('yieldDown', selection.append('g'));
  }
})
// parent-chart.hbs
{{yield yieldDown}}

This is expected to work, but it doesn't. Because select= is expecting a selection proxy.

Do this instead.

// parent-chart.js
Ember.Component.extend({
  call(selection) {
    selection.append('g').classed('cls');

    this.set('yieldDown', this.get('select.cls'));
  }
})

This will make the select proxy correctly wrap the element to yield down.