alonho / angular-plotly

MIT License
41 stars 35 forks source link

Adjust size in percent #11

Open hackermd opened 8 years ago

hackermd commented 8 years ago

Is there a way to adjust the size of the figure element in %?

e.g.:

layout.height = '100%';
layout.width = '100%';
kbzowski commented 8 years ago

Typical solution in pure JS would be:

var d3 = Plotly.d3;

var WIDTH_IN_PERCENT_OF_PARENT = 60,
    HEIGHT_IN_PERCENT_OF_PARENT = 80;

var gd3 = d3.select('#plot');
var gd = gd3.node();

Plotly.d3.json('grain_and_forces.json', function(figure){
 Plotly.plot(gd, figure['data'], figure['layout']);
});

window.onresize = function() {
    Plotly.Plots.resize(gd);
};

How to do it in angular?