1

How do I resize the canvas of th JIT Graph after it's been once drawn? JIT Force Directed Graph is described here

I've tried smt like the following (using jQuery):

function resizeCanvas(size) {
var e$ = $('#visualizerView, #visualizerContainer');

e$.animate(
    {height: "+=" + size + "px"},
    500
);

//TODO make it work?
//$('#visualizerView').empty();
//var pos = fdGraph.canvas.getPos(true);
//alert(pos.x+" "+pos.y)
//fdGraph.canvas.translate(0, -50);
//fdGraph.canvas
//initGraph(graph);

}

But I the best thing I can do is to stretch the container DIV - not the canvas itself. When I stretch the canvas the aspect ratio gets wrong...

Mikko Ohtamaa
  • 82,057
  • 50
  • 264
  • 435
Queequeg
  • 2,824
  • 8
  • 39
  • 66

1 Answers1

1

Canvas pixel buffer width and height are coordinated independently from the documentation presentation (style) width and height.

Canvas width and height in HTML5

Community
  • 1
  • 1
Mikko Ohtamaa
  • 82,057
  • 50
  • 264
  • 435