Un blog

Ni idea

23
JUL

holasdfasdf ñlaksj dflakjsdf Enfadado

  Publicado el 23/07/2010          0 comentarios

23
JUL

Usage

  1. Import the 3 required scripts.
  2. Create a div that will contain your boxes.
  3. Create your inner divs. They will be the boxes. (The css position attribute of those divs will become relative.)
  4. Each of those divs content MUST be into a span. (The css white-space attribute of those spans will become nowrap.)
    • Why spans? Well, the first thing the script does is computing what are the maximum widht and height required by the boxes. To do so, the script iterates through those spans. Spans are inline, so, unlike divs, their width will be as small as possible instead of taking all the available space. If you are only having text into your boxes, this is more convenient than manually specifying a width for your divs. Should you want to manually specify the size of the boxes, you can still put a div into the span and set it's dimensions.
  5. Call the function btree() on your outer div.
  6. Et voilà!

Should you need to redraw the tree, keep a reference to it and call clear(). Then you can recreate it with the original btree() call.

Parameters

hSpace: Horizontal spacing
vSpace: Vertical spacing
borderWidth: The border width of the boxes.
branchColor: The color of the branches
branchStroke: The branches thickness
horizontal: If true, the tree will be horizontal. Othewise it will be vertical
flip: If true, the tree display will be flipped on the current orientation

Known fact

If you call btree() when your page isn't fully loaded (it could still be loading components such as images for example), then your tree might not display properly since it will be drawn before the components have their real size. You have two options.

  1. Specify the size of your components.
  2. Only call the script when all components of the tree are loaded.
  Publicado el 23/07/2010          2 comentarios

Página 1 de 1
Hemeroteca

2010 (2)
      mi titulo
      Una publicacion
MeGestiono.com