[FIX] correctly computes the height and the width of the graph view (addon web_graph)

bzr revid: ged@openerp.com-20131211160011-fhv7ah63hlnyg7l0
This commit is contained in:
Gery Debongnie 2013-12-11 17:00:11 +01:00
parent 8da86807b6
commit 945719fb7d
1 changed files with 7 additions and 4 deletions

View File

@ -61,8 +61,6 @@ instance.web_graph.GraphView = instance.web.View.extend({
start: function () {
this.table = $('<table></table>');
this.$('.graph_main_content').append(this.table);
this.width = this.$el.width();
this.height = this.$el.parent().parent().height(); // to get view manager body
instance.web.bus.on('click', this, function (ev) {
if (this.dropdown) {
this.dropdown.remove();
@ -180,12 +178,17 @@ instance.web_graph.GraphView = instance.web.View.extend({
this.draw_table();
} else {
this.$('.graph_main_content').append($('<div><svg></svg></div>'));
// console.log('this.perentaui', this.getParent().$el);
// this.width = this.$el.width();
// this.height = this.$el.parent().parent().height(); // to get view manager body
// debugger;
var options = {
svg: this.$('.graph_main_content svg')[0],
mode: this.mode,
pivot: this.pivot_table,
width: this.width,
height: Math.max(this.height - 45, 250),
width: this.$el.width(),
height: Math.max(this.$el.parent().parent().height() - 45, 250),
measure_label: this.measure_label()
};
openerp.web_graph.draw_chart(options);