jeudi 24 mars 2016

Ember 1.13: multiple canvases

There are several canvases. So far I added them directly to the DOM element using d3. Everything works perfectly except one thing: when I add a footer - it overlays the last canvas. How to fix this?

templates/dashboard.hbs

<div class="row">
    {{my-chart canvasesNumber=3}}
</div>
<footer>
    Some info
</footer>

components/my-chart.js

export default Ember.Component.extend({
    ...
    canvasesNumber: null,

    init: function() {
        this._super();
        id = '#' + this.elementId;
        for (i = 0; i < this.canvasesNumber; i++) {
            d3.select(id).append('canvas')
                           .attr({
                               'width': 200,
                               'height': 100,
                           }).style({
                               'position': 'absolute',
                               'z-index': 0,
                               'left': '0px',
                               'top': (100 * i) + 'px'
                           });
        }
    }
});

Thanks




Aucun commentaire:

Enregistrer un commentaire