----------------------- Yahoo! Groups Survey ----------------------~-->
Please help us to improve Yahoo! Groups. Take the survey now!
http://v2.decipherinc.com/survey/yahoo/yah04021?list=2
--------------------------------------------------------------------~->

This works and I thought I'd share it with the group.  Peter, you really need 
to join Experts Exchange.  We need you!
 
How can I ever repay you?  
 
Forever in your debt,
Patricia


Peter L Thompson <[EMAIL PROTECTED]> wrote: 




Patricia,

I modified your code in three places. I highlighted the lines in red. If
the red doesn't show up then look for // MODIFIED comments.

I changed "onfiltered=" back to "oninit=". That it made it work. I don't
know what your intention was with the onfiltered; I've never used it,
haven't looked at it and it may not be as simple as just changing it back
like I did. Then I commented out the alert, since that was not needed
anymore. Then I changed "offsetY=" in mouseClick(), since you modified it
where it initially set (otherwise the bars move when they first collapse).

The nested groups are, by definition, an object hierarchy. I would just
use this concept and take it is as far as it will go. imo, it is simple,
but powerful enough to do what you need (even though I really have no idea
what that it).

I only wrote this bit of code because I love playing with hierarchical
displays of data and I was curious to see how easy it was to do in SVG.
Just let me know if it works for you now.

Let me know if you have further questions. I can't promise as quick a
response.

Peter

------------------------------------------

width= "100%" height="100%" viewBox="0 0 900 500"
onload="init(evt)"
xmlns="http://www.w3.org/2000/svg";
xmlns:xlink="http://www.w3.org/1999/xlink";>


var offsetY = 50;

function init(evt)
{
  refresh(svgDocument.getElementById("tasks") ,0);
}

function mouseClick(evt)
{
  var obj=evt.target.getNextSibling();
  if ((obj != null) & (obj.nodeName=="#text"))
  {
    obj=obj.getNextSibling();
//  alert("obj = " + obj); // MODIFIED
    if ((obj != null) & (obj.nodeName=="g"))
    {
      var attr = obj.getAttribute("visibility");
      if (attr == "hidden")
      {
        obj.setAttribute("visibility", "");
      }
      else
      {
        obj.setAttribute("visibility", "hidden");
      }
      offsetY = 50; // MODIFIED
      refresh(svgDocument.getElementById("tasks") ,0)
    }
  }
}

function refresh(objGroup, level)
{
  var layer=objGroup.childNodes;
  var num=layer.length;
  for (var ix=0; ix   {
    var obj=layer.item(ix);
    if (obj.nodeName == "rect")
    {
      offsetX = level * 40;
      var transform = "translate(" + offsetX + " " + offsetY + ")";
      obj.setAttribute("transform", transform);
      offsetY = offsetY + 30;
    }
    else if (obj.nodeName == "g")
    {
      if (obj.getAttribute("visibility") != "hidden")
      {
        refresh(obj, level+1);
      }
    }
  }
}
// ]]>



























----------------------------------------------------------------------------------------

This is a PRIVATE message. If you are not the intended recipient, please
delete without copying and kindly advise us by e-mail of the mistake in
delivery. NOTE: Regardless of content, this e-mail shall not operate to
bind CSC to any order or other contract unless pursuant to explicit written
agreement or government initiative expressly permitting the use of e-mail
for such purpose.
----------------------------------------------------------------------------------------





[Non-text portions of this message have been removed]



-----
To unsubscribe send a message to: [EMAIL PROTECTED]
-or-
visit http://groups.yahoo.com/group/svg-developers and click "edit my 
membership"
---- 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/svg-developers/

<*> To unsubscribe from this group, send an email to:
    [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 


Reply via email to