javascript - how to render a plotly.js chart in a angular ui-grid's cell? -


http://plnkr.co/edit/kp4m06sbsqq7j8nr3oo9

i have been able render chart inside cell unable set width , hight per cell's width , hight.

here directive:

    app.directive('plotlygraph', function() {   return {     restrict: 'ae',     scope: {       graphdata: '=graphdata'     },     template: "<div style='width:100%;height:100%;'></div>",     controller: function($scope, $element, $attrs) {       console.log('controller scope', $scope);       var elem = $element.find('div');       var layout = {         autosize: true,         margin: {           t: 0,           r: 0,           l: 0,           b: 0         },         width: "100%",         height: "100%",         yaxis: {           fixedrange: true         },         xaxis: {           fixedrange: true         }       }        plotly.newplot(elem[0], $scope.graphdata, layout);     },    } }); 

and here controller:

    app.controller('mainctrl', ['$scope', function($scope) {    // setting ui-grid    $scope.gridoptions = {     rowheight: 200,     columndefs: [{       name: 'firstname',       field: "name"     }, {       name: 'graph',       celltemplate: '<span data-ng-cell-text>&nbsp;<plotly-graph graph-data="row.entity.boxdata"></plotly-graph></span>'     }],     data: [{       name: 'viva',       boxdata: [{         x: [2, 3, 3, 3, 3, 5, 6, 6, 7],         type: 'box',         name: 'set 1'       }]     }, {       name: 'test',       boxdata: [{         x: [2, 3, 3, 3, 3, 5, 6, 6, 7],         type: 'box',         name: 'set 2'       }]     }]   }; }]); 

how can make graph occupy exact width , height provided cell?


Comments

Popular posts from this blog

node.js - Node js - Trying to send POST request, but it is not loading javascript content -

javascript - Replicate keyboard event with html button -

javascript - Web audio api 5.1 surround example not working in firefox -