Fix resizing viewbox for svg

This commit is contained in:
Zachary Tong 2013-04-18 12:44:07 -04:00
parent 91eaef48b3
commit 6178d030f6

View File

@ -189,8 +189,8 @@ angular.module('kibana.parallelcoordinates', [])
*/ */
function init_panel() { function init_panel() {
scope.m = [80, 160, 200, 160]; scope.m = [80, 100, 80, 100];
scope.w = $(elem[0]).width() - scope.m[1] - scope.m[3], scope.w = $(elem[0]).width() - scope.m[1] - scope.m[3];
scope.h = $(elem[0]).height() - scope.m[0] - scope.m[2]; scope.h = $(elem[0]).height() - scope.m[0] - scope.m[2];
@ -291,6 +291,13 @@ angular.module('kibana.parallelcoordinates', [])
*/ */
function render_panel() { function render_panel() {
//update the svg if the size has changed
scope.w = $(elem[0]).width() - scope.m[1] - scope.m[3];
scope.h = $(elem[0]).height() - scope.m[0] - scope.m[2];
scope.svg.attr("viewbox", "0 0 " + (scope.w + scope.m[1] + scope.m[3]) + " " + (scope.h + scope.m[0] + scope.m[2]));
scope.x = d3.scale.ordinal().domain(scope.panel.fields).rangePoints([0, scope.w]); scope.x = d3.scale.ordinal().domain(scope.panel.fields).rangePoints([0, scope.w]);
scope.y = {}; scope.y = {};