tags:

views:

58

answers:

1

Hi, is there some good way to create a flow / swimline diagram without resorting to scripting or tables? I'm talking about showing different hosts sending packets (so hosts on the X axis, time on the Y and arrows to the destination host). It seems like too much elements for tables (especially the arrows spanning multiple columns either way), but on the other hand, divs would be hard to position in the right place horizontally (they'd have to be basically aligned to a specified "column").

Is there any good way out? Any helper frameworks? (I don't want to do canvas stuff unless really needed)

Edit: Forgot to add why I didn't mention images at all - some elements of the diagram should have :hover actions and should be clickable in the future.

+2  A: 

I would suggest using PNG files with a transparent alpha layer (for overlaps), and positioning them absolutely with CSS. I haven't seen your overall layout, so I can't say that this is the best approach for your particular situation though.

Sample CSS code for a circle such as this: <a class="circle" id="myCircle" href="foo">Foo</a>

a.circle {
  display:block;
  height:100px;
  width:100px;
  background-image:url(/path/to/circle.png);
  background-repeat:no-repeat;
  position:absolute;
  line-height:100px;
  text-align:center;
  }

code for an individual circle element:

a#myCircle {
  top:234px;
  left:357px;
}

The class definition creates a set of attributes for all anchor elements that share the class "circle". The anchor with the ID of "myCircle" would then be positioned with the coordinates of 234,357 in pixels from the top left corner of the parent element with position:relative; set.

Jeff Fohl
+1 this is way better of a solution than the snarky one i had planned.
Jason
Or the extremely simple method: make the entire flowchart an image... :-). But I am going to guess that you need to assemble the flowchart on the fly, and perhaps also move elements around within the browser.
Jeff Fohl
Sorry - I didn't say why I skipped the images completely. In the future elements on the diagram should be clickable / sortable / ... Right now I'm ok with :hover only, but I still want to be able to copy the text.
viraptor
In that case, you can still use HTML and PNG files. There are a variety of ways to do it, but, if you want the flowchart elements to be clickable, and have the text be selectable, you just need to use an anchor element - `<a>` - and use a background image for your decorative flowcharty elements, such as circles, triangles, arrows, clouds, etc.
Jeff Fohl
I added a code sample to illustrate how this might be done.
Jeff Fohl