<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="http://feeds.feedburner.com/~d/styles/atom10full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><feed xmlns="http://www.w3.org/2005/Atom">
    <title>jsviz.org :: blog</title>
    <link rel="alternate" type="text/html" href="http://www.jsviz.org/blog/" />
    
   <id>tag:www.jsviz.org,2007:/blog/1</id>
    <link rel="service.post" type="application/atom+xml" href="http://www.jsviz.org/cgi-bin/mt/mt-atom.cgi/weblog/blog_id=1" title="jsviz.org :: blog" />
    <updated>2007-06-12T18:43:26Z</updated>
    
    <generator uri="http://www.sixapart.com/movabletype/">Movable Type 3.2</generator>
 
<link rel="self" href="http://feeds.feedburner.com/jsviz" type="application/atom+xml" /><entry>
    <title>Viva la Canvas</title>
    <link rel="alternate" type="text/html" href="http://www.jsviz.org/blog/2007/06/viva_la_canvas.html" />
    <link rel="service.edit" type="application/atom+xml" href="http://www.jsviz.org/cgi-bin/mt/mt-atom.cgi/weblog/blog_id=1/entry_id=13" title="Viva la Canvas" />
    <id>tag:www.jsviz.org,2007:/blog//1.13</id>
    
    <published>2007-06-12T03:45:51Z</published>
    <updated>2007-06-12T18:43:26Z</updated>
    
    <summary><![CDATA[Hey friends! I gave in and finally integrated &lt;canvas&gt; support into JSViz, and just in time for the Safari 3 Beta (which I'm really digging so far)! Note: To render with canvas, you'll need Firefox 1.5, Safari 2.0, or Opera 9. JSViz gracefully degrades to alternative rendering platforms (SVG, HTML) when support is not present....]]></summary>
    <author>
        <name>kyle scholz</name>
        <uri>kylescholz.com</uri>
    </author>
            <category term="jsviz" />
    
    <content type="html" xml:lang="en" xml:base="http://www.jsviz.org/blog/">
        <![CDATA[<p>Hey friends! I gave in and finally integrated &lt;canvas&gt; support into JSViz, and just in time for the <a href=http://www.apple.com/safari/>Safari 3 Beta</a> (which I'm really digging so far)!</p>

<p><i>Note: To render with canvas, you'll need Firefox 1.5, Safari 2.0, or Opera 9. JSViz gracefully degrades to alternative rendering platforms (SVG, HTML) when support is not present.</i></p>]]>
        <![CDATA[<center>
<iframe src="http://jsviz.org/files/jsviz/0.3.4/examples/XMLLoader_ForceDirected.html" width="520" height="400" scrolling="no" style="border:1px solid #888888;"></iframe>
</center>

<p><i>One more note: I'll add VML support to this demo shortly. I'm just waiting on the next build of svg2vml.</i></p>

<p>
I've been reluctant to integrate canvas support into JSViz, so let me explain why this has been a long time coming.
</p>

<p>
HTML, SVG, and VML each similarly represent drawings as a set of "elements". In HTML these elements include DIVs and TABLEs, and in the SVG/VML these include circles, rectangles, and complex paths. In terms of time and system resources, creating elements is expensive, but once we place an element in the DOM we can change it's position and other characteristics with less overhead. Over the lifetime of a graph we may change the position of an element 100s or 1000s of times, so we want to minimize the cost of these operations. DOM updates and rendering are the primary inhibitors to scaling JSViz past 100 or so nodes per graph.
</p>

<p>
Canvas works differently than these other graphics platforms. Once we draw on the canvas, we can't change what we've drawn. We can only draw more or clear the canvas. So if we draw a node at one set of coordinates and then want to move it to another, we have to clear the whole canvas and redraw. Also the drawing operations are rather primitive. Canvas supports lines, rectangles and arcs, but that's about it. Even basic drawings can require many operations.
</p>

<p>
In short, this means that JSViz needs to redraw every node and edge in the graph at each cycle in the organization, even if the node didn't move. I've been skeptical about canvas' ability to keep up, but it turns out that it really kicks! Check out this <a href=http://www.abrahamjoffe.com.au/ben/canvascape/>first person shooter written for canvas</a>. So I'm sold. This is my first pass at integrating canvas support into JSViz. 
</p>

<p>
I'll gladly take feedback on the API. In the current implementation, each node view is represented by a function. From the demo, here's a view function that draws a node as a circle with a radius of 6pixels, filled with the indicated color attribute. "this.node_twod" is the local name for the canvas' 2d context.
</p>

<pre><code>function(particle) {
	this.node_twod.strokeStyle = dataNode.color;
	this.node_twod.fillStyle = dataNode.color;
	this.node_twod.beginPath();
	this.node_twod.arc(
		(particle.positionX*this.skewX) + this.centerX,
		(particle.positionY*this.skewY) + this.centerY,
		6, 0,
		Math.PI*2,true); // Outer circle
	this.node_twod.stroke();
	this.node_twod.fill();
}
</pre></code>

<p>
JSViz 0.3.4 is brewing, and canvas support will be included. Lorien and I will be posting over the next few weeks with updates as we prepare a release.
</p>]]>
    </content>
</entry>
<entry>
    <title>Everybody wants tooltips</title>
    <link rel="alternate" type="text/html" href="http://www.jsviz.org/blog/2007/05/everybody_wants_tooltips.html" />
    <link rel="service.edit" type="application/atom+xml" href="http://www.jsviz.org/cgi-bin/mt/mt-atom.cgi/weblog/blog_id=1/entry_id=12" title="Everybody wants tooltips" />
    <id>tag:www.jsviz.org,2007:/blog//1.12</id>
    
    <published>2007-05-22T05:55:00Z</published>
    <updated>2007-05-22T18:30:52Z</updated>
    
    <summary>I get lot's of e-mails from JSViz users that want to know how to integrate tooltips into their graphs. Up until now, my responses have been something like this: Yeah, that's super easy and everyone is always asking. I'll work up an example as soon as I have moment. So I had a moment and here it is:...</summary>
    <author>
        <name>kyle scholz</name>
        <uri>kylescholz.com</uri>
    </author>
            <category term="jsviz" />
            <category term="tutorial" />
    
    <content type="html" xml:lang="en" xml:base="http://www.jsviz.org/blog/">
        <![CDATA[<p>I get lot's of e-mails from JSViz users that want to know how to integrate tooltips into their graphs. Up until now, my responses have been something like this:</p>

<p><code>
Yeah, that's super easy and everyone is always asking. I'll work up an example as soon as I have moment.
</code></p>

<p>So I had a moment and here it is:</p>]]>
        <![CDATA[<p><a href="http://jsviz.org/files/jsviz/0.3.3/examples/XMLLoader_Snowflake_Tooltips.html">Snowflake Graph with Tooltips</a></p>

<iframe src="http://jsviz.org/files/jsviz/0.3.3/examples/XMLLoader_Snowflake_Tooltips.html" width="520" height="400" scrolling="no" style="border:1px solid #888888;"></iframe>

<p>I modified the XML Snowflake Graph example to display a tooltip when you mouse over a node. Here's how you can add tooltips to your graph:</p>

<p>Add a DIV element to the body of your HTML to hold the contents of your tooltip.</p>

<p><code><pre>
&lt;div id="debug" style="position:absolute">&lt;/div>
</pre></code></p>

<p>Add some functions to show and hide the tooltip.</p>

<p><code><pre>
window.showToolTip = function(dataNode, modelNode) {
	var tt = document.getElementById("tooltip");
	tt.innerHTML="Color: " + dataNode.color;
	tt.style.display="block";
	tt.style.left=(modelNode.positionX*window.layout.view.skewX + window.layout.view.centerX + 5) + "px";
	tt.style.top=(modelNode.positionY*window.layout.view.skewY + window.layout.view.centerY - 25) +  "px";
}
			
window.hideToolTip = function() {
	var tt = document.getElementById("tooltip");
	tt.style.display="none";
}
</pre></code></p>

<p>You'll notice we do some funny stuff to position the tooltip. In our graph, the center is at (0, 0), and we use an optional skewing factor to ensure we use all of the available space to render the graph. We need to convert these coordinates to those of the window.</p>

<p>We attach event handlers to the mouseover and mouseout events for each node.</p>

<p><code><pre>
nodeElement.onmouseover =  new EventHandler( window, window.showToolTip, dataNode, modelNode );
nodeElement.onmouseout =  new EventHandler( window, window.hideToolTip, dataNode, modelNode );
</pre></code></p>

<p>Note that I placed the show and hide functions in the global scope (which you can access most quickly with "window"). I suggest that if you're building a larger application that uses other libraries, you should wrap your functions in an object to avoid namespace collisions.</p>

<p>Finally, we add some CSS to style the tooltip.</p>

<p><code><pre>
#tooltip{
	position: absolute;
	display: none;
	border: 1px solid #888888;
	background: #ffffee;
	font-family: Verdana, sans-serif;
	font-size: 12px;
	font-weight: bold;
	padding: 2px;
	z-Index: 20;
}
</pre></code></p>

That's it. Have Fun!]]>
    </content>
</entry>
<entry>
    <title>Announcing svg2vml</title>
    <link rel="alternate" type="text/html" href="http://www.jsviz.org/blog/2007/03/svg2vml.html" />
    <link rel="service.edit" type="application/atom+xml" href="http://www.jsviz.org/cgi-bin/mt/mt-atom.cgi/weblog/blog_id=1/entry_id=10" title="Announcing svg2vml" />
    <id>tag:www.jsviz.org,2007:/blog//1.10</id>
    
    <published>2007-03-11T03:38:42Z</published>
    <updated>2007-03-11T04:40:43Z</updated>
    
    <summary>In the process of integrating vector graphics into JSViz, we developed svg2vml, a library that provides a common interface for scripting vector graphics in browsers that support either SVG or VML. To use svg2vml you simply script your vector graphics using SVG syntax, and when your page is viewed in a browser that supports VML instead of SVG the library maps the SVG API calls to VML. You get vector support in multiple browsers without having to script to different implementations. The currently supported features are circle, ellipse, rectangle, line, and gradient. The library lives in the Google Code project hosting site at http://code.google.com/p/svg2vml. There you will find a wiki with examples for using the currently supported features, and a project roadmap that lists future development plans. If you have any questions, or comments, or would like to contribute to the project you can email us (see project site for contact info)....</summary>
    <author>
        <name>lorien</name>
        
    </author>
            <category term="svg" />
            <category term="vml" />
    
    <content type="html" xml:lang="en" xml:base="http://www.jsviz.org/blog/">
        <![CDATA[<p>In the process of integrating vector graphics into JSViz, we developed svg2vml, a library that provides a common interface for scripting vector graphics in browsers that support either SVG or VML. To use svg2vml you simply script your vector graphics using SVG syntax, and when your page is viewed in a browser that supports VML instead of SVG the library maps the SVG API calls to VML. You get vector support in multiple browsers without having to script to different implementations. The currently supported features are circle, ellipse, rectangle, line, and gradient.</p>

<p>The library lives in the Google Code project hosting site at <a href="http://code.google.com/p/svg2vml">http://code.google.com/p/svg2vml</a>. There you will find a wiki with examples for using the currently supported features, and a project roadmap that lists future development plans. If you have any questions, or comments, or would like to contribute to the project you can email us (see project site for contact info).</p>]]>
        
    </content>
</entry>
<entry>
    <title>JSViz 0.3.3 Patch #2</title>
    <link rel="alternate" type="text/html" href="http://www.jsviz.org/blog/2007/02/jsviz_033_patch_2.html" />
    <link rel="service.edit" type="application/atom+xml" href="http://www.jsviz.org/cgi-bin/mt/mt-atom.cgi/weblog/blog_id=1/entry_id=9" title="JSViz 0.3.3 Patch #2" />
    <id>tag:www.jsviz.org,2007:/blog//1.9</id>
    
    <published>2007-02-26T00:17:43Z</published>
    <updated>2007-02-26T02:20:28Z</updated>
    
    <summary>Howdy friends, I've just uploaded another patch to 0.3.3. This patch covers some issues from the discussion board: Improved SVG Rendering Performance See the discussion here. No interface changes were required. Added configurations for "type-driven" Force Directed Graph attributes See discussion here. The constants used by ForceDirectedLayout.js have been removed in favor of a default configuration. See comments and code in Example Force Directed Graph for more details. I don't currently have a good example of directed edge configurations (If you make one, I'd love to use it!). Modified HTMLGraphView to place graph in contained Until now, containers were used to help dictate graph placement, but HTML elements in graphs were rendered in the document.body. This made it difficult to use relatively positioned containers, and impossible to assert that if your graph exceeds the bounds, it doesn't overlap other content. No interface changes were required for this update. Example #1: Our Snowflake Graph in a containing DIV Example #2: Our Snowflake Graph in a relative-positioned containing DIV, with hidden overflow There are a handful of other feature requests on the code site. I'm not sure which of these will make it into 0.3.3, but I'm expecting to do one more...</summary>
    <author>
        <name>kyle scholz</name>
        <uri>kylescholz.com</uri>
    </author>
            <category term="html" />
            <category term="jsviz" />
            <category term="layout" />
            <category term="patch" />
            <category term="performance" />
            <category term="svg" />
    
    <content type="html" xml:lang="en" xml:base="http://www.jsviz.org/blog/">
        <![CDATA[<p>Howdy friends, I've just uploaded another patch to 0.3.3. This patch covers some issues from the <a href="http://groups.google.com/group/jsviz">discussion board</a>:</p>

<p><b>Improved SVG Rendering Performance</b></p>

<p><a href="http://groups.google.com/group/jsviz/browse_thread/thread/bb1ff68341d40b04">See the discussion here</a>. No interface changes were required.</p>

<p><b>Added configurations for "type-driven" Force Directed Graph attributes</b></p>

<p><a href="http://groups.google.com/group/jsviz/browse_thread/thread/d8e7b86c63de1e00">See discussion here.</a> The constants used by ForceDirectedLayout.js have been removed in favor of a default configuration.</p>

<p>See comments and code in <a href="http://www.jsviz.org/files/jsviz/0.3.3/examples/XMLLoader_ForceDirected.html">Example Force Directed Graph</a> for more details. I don't currently have a good example of directed edge configurations (If you make one, I'd love to use it!).</p>

<p><b>Modified HTMLGraphView to place graph in contained</b></p>

<p>Until now, containers were used to help dictate graph placement, but HTML elements in graphs were rendered in the document.body. This made it difficult to use relatively positioned containers, and impossible to assert that if your graph exceeds the bounds, it doesn't overlap other content. No interface changes were required for this update.</p>

<p><a href="http://www.jsviz.org/files/jsviz/0.3.3/examples/XMLLoader_Snowflake_Container.html">Example #1: Our Snowflake Graph in a containing DIV</a><br />
<a href="http://www.jsviz.org/files/jsviz/0.3.3/examples/XMLLoader_Snowflake_Container_Relative.html">Example #2: Our Snowflake Graph in a relative-positioned containing DIV, with hidden overflow</a></p>

<p>There are a handful of other <a href="http://code.google.com/p/jsviz/issues/list">feature requests</a> on the code site. I'm not sure which of these will make it into 0.3.3, but I'm expecting to do one more patch before 0.3.4.</p>

<p>Ideas, contributions, and comments are always welcome. <a href="http://groups.google.com/group/jsviz">The discussion board</a> is the best place for feedback and help.</p>]]>
        
    </content>
</entry>
<entry>
    <title>Google Web Toolkit Wrapper for JSViz</title>
    <link rel="alternate" type="text/html" href="http://www.jsviz.org/blog/2007/02/google_web_toolkit_wrapper_for.html" />
    <link rel="service.edit" type="application/atom+xml" href="http://www.jsviz.org/cgi-bin/mt/mt-atom.cgi/weblog/blog_id=1/entry_id=8" title="Google Web Toolkit Wrapper for JSViz" />
    <id>tag:www.jsviz.org,2007:/blog//1.8</id>
    
    <published>2007-02-14T15:51:08Z</published>
    <updated>2007-02-14T16:02:54Z</updated>
    
    <summary>Alistair Rutherford has created a wrapper that enables use of JSViz from the Java-based Google Web Toolkit. Check out the announcement on the Discussion Board or visit the Project Site for more details. Also check out Alistair's traffic visualization site at http://www.gtraffic.info/. Nice work Alistair!...</summary>
    <author>
        <name>kyle scholz</name>
        <uri>kylescholz.com</uri>
    </author>
            <category term="gwt-jsviz" />
            <category term="jsviz" />
    
    <content type="html" xml:lang="en" xml:base="http://www.jsviz.org/blog/">
        <![CDATA[<p>Alistair Rutherford has created a wrapper that enables use of JSViz from the Java-based Google Web Toolkit. Check out the announcement on the <a href="http://groups.google.com/group/jsviz/browse_thread/thread/9bc743e67e64130">Discussion Board</a> or visit the <a href="http://code.google.com/p/gwt-jsviz/">Project Site</a> for more details.</p>

<p>Also check out Alistair's traffic visualization site at <a href="http://www.gtraffic.info/">http://www.gtraffic.info/</a>. Nice work Alistair!</p>]]>
        
    </content>
</entry>
<entry>
    <title>New Project Tools</title>
    <link rel="alternate" type="text/html" href="http://www.jsviz.org/blog/2007/02/new_project_tools.html" />
    <link rel="service.edit" type="application/atom+xml" href="http://www.jsviz.org/cgi-bin/mt/mt-atom.cgi/weblog/blog_id=1/entry_id=7" title="New Project Tools" />
    <id>tag:www.jsviz.org,2007:/blog//1.7</id>
    
    <published>2007-02-10T02:26:37Z</published>
    <updated>2007-02-10T02:49:26Z</updated>
    
    <summary>So if you've visited the JSViz.org website recently, you've probably noticed that we're now using some new tools to manage the project. We've set up issue tracking and migrated the documentation wiki over to Google Code. Join up and you can submit issues and contribute to the documentation effort. We've also created a discussion group on Google Groups. This is a good place to make feature requests, share your ideas and observations, and tell us about your projects. This is all part of an effort to help JSViz users contribute to the project. Over the past months, user suggestions and code contributions have been a great asset. A number of users are currently working on contributions and projects that compliment JSViz and I'm eager to see these released. To date, the discussion has taken place in isolation, via e-mail or in my kitchen. While this has it's place, I think the project will benefit from more open conversation. So have at it! Let us know what you think!...</summary>
    <author>
        <name>kyle scholz</name>
        <uri>kylescholz.com</uri>
    </author>
            <category term="jsviz" />
            <category term="project" />
    
    <content type="html" xml:lang="en" xml:base="http://www.jsviz.org/blog/">
        <![CDATA[<p>So if you've visited the <a href="http://www.jsviz.org">JSViz.org website</a> recently, you've probably noticed that we're now using some new tools to manage the project.</p>

<p>We've set up <a href="http://code.google.com/p/jsviz/issues/list">issue tracking</a> and migrated the <a href="http://code.google.com/p/jsviz/w/list">documentation wiki</a> over to <a href="http://code.google.com/p/jsviz/">Google Code</a>. Join up and you can submit issues and contribute to the documentation effort.</p>

<p>We've also created a <a href="http://groups.google.com/group/jsviz">discussion group</a> on <a href="http://groups.google.com/group/jsviz">Google Groups</a>. This is a good place to make feature requests, share your ideas and observations, and tell us about your projects.</p>

<p>This is all part of an effort to help JSViz users contribute to the project. Over the past months, user suggestions and code contributions have been a great asset. A number of users are currently working on contributions and projects that compliment JSViz and I'm eager to see these released. To date, the discussion has taken place in isolation, via e-mail or in my kitchen. While this has it's place, I think the project will benefit from more open conversation. So have at it! Let us know what you think!</p>]]>
        
    </content>
</entry>
<entry>
    <title>JSViz 0.3.3 Patched ... and License Change</title>
    <link rel="alternate" type="text/html" href="http://www.jsviz.org/blog/2007/02/jsviz_033_patched.html" />
    <link rel="service.edit" type="application/atom+xml" href="http://www.jsviz.org/cgi-bin/mt/mt-atom.cgi/weblog/blog_id=1/entry_id=6" title="JSViz 0.3.3 Patched ... and License Change" />
    <id>tag:www.jsviz.org,2007:/blog//1.6</id>
    
    <published>2007-02-10T02:24:01Z</published>
    <updated>2007-02-10T03:18:03Z</updated>
    
    <summary>I've just posted a patch to the 0.3.3 release that includes some bug fixes. See the change log for details. Oh! I almost forgot. We've migrated to the Apache 2.0 License. This should be functionally identical to the Creative Commons Attribution License that we've used in the past. The reason for the change is that Creative Commons license isn't intended for software -- Though it sure would be convenient if we could cover blog content and software with one license. In any event, we wanted to use a license that enables developers to comfortably integrate and distribute JSViz with their projects. I think the Apache license hits the mark....</summary>
    <author>
        <name>kyle scholz</name>
        <uri>kylescholz.com</uri>
    </author>
            <category term="jsviz" />
            <category term="project" />
    
    <content type="html" xml:lang="en" xml:base="http://www.jsviz.org/blog/">
        <![CDATA[<p>I've just posted a patch to the 0.3.3 release that includes some bug fixes. See the <a href="http://code.google.com/p/jsviz/wiki/ChangeLog">change log</a> for details.</p>

<p>Oh! I almost forgot. We've migrated to the <a href="http://www.apache.org/licenses/LICENSE-2.0.html">Apache 2.0 License</a>. This should be functionally identical to the Creative Commons Attribution License that we've used in the past. The reason for the change is that Creative Commons license <a href="http://wiki.creativecommons.org/FAQ#Can_I_use_a_Creative_Commons_license_for_software.3F">isn't intended for software</a> -- Though it sure would be convenient if we could cover blog content and software with one license. In any event, we wanted to use a license that enables developers to comfortably integrate and distribute JSViz with their projects. I think the Apache license hits the mark.</p>]]>
        
    </content>
</entry>
<entry>
    <title>Tutorial: Building a Snowflake Graph from XML</title>
    <link rel="alternate" type="text/html" href="http://www.jsviz.org/blog/2007/01/tutorial_building_a_snowflake.html" />
    <link rel="service.edit" type="application/atom+xml" href="http://www.jsviz.org/cgi-bin/mt/mt-atom.cgi/weblog/blog_id=1/entry_id=5" title="Tutorial: Building a Snowflake Graph from XML" />
    <id>tag:www.jsviz.org,2007:/blog//1.5</id>
    
    <published>2007-01-22T04:49:14Z</published>
    <updated>2007-01-23T01:28:52Z</updated>
    
    <summary> JSViz 0.3.3 includes a few examples to help you get started. In this tutorial, I'm going to go over one of them. We'll create a Snowflake Graph from the contents of an XML file. You can find the example source, with comments based on this tutorial in the 0.3.3 Distribution. Here's the final product 1) Start with a new HTML file Add appropriate JSViz imports and an empty "init()" function body:...</summary>
    <author>
        <name>kyle scholz</name>
        <uri>kylescholz.com</uri>
    </author>
            <category term="jsviz" />
            <category term="layout" />
            <category term="project" />
            <category term="snowflake" />
            <category term="tutorial" />
    
    <content type="html" xml:lang="en" xml:base="http://www.jsviz.org/blog/">
        <![CDATA[<p>
JSViz 0.3.3 includes a few examples to help you get started. In this tutorial, I'm going to go over one of them. We'll create a Snowflake Graph from the contents of an XML file. You can find the example source, with comments based on this tutorial in the <a href="http://www.jsviz.org/wiki/index.php/Download">0.3.3 Distribution</a>.
</p>

<a href="http://jsviz.org/files/jsviz/0.3.3/examples/XMLLoader_Snowflake.html">Here's the final product</a>

<p>
<b>1) Start with a new HTML file</b>
</p>

<p>Add appropriate JSViz imports and an empty "init()" function body:
</p>]]>
        <![CDATA[<pre><code>&lt;html>
  &lt;head>
    &lt;script language="JavaScript" src="../geometry/SnowflakeGraphModel.js">&lt;/script>
    &lt;script language="JavaScript" src="../layout/graph/SnowflakeLayout.js">&lt;/script>
    &lt;script language="JavaScript" src="../layout/view/HTMLGraphView.js">&lt;/script>
    &lt;script language="JavaScript" src="../layout/view/SVGGraphView.js">&lt;/script>

    &lt;script language="JavaScript" src="../util/Timer.js">&lt;/script>
    &lt;script language="JavaScript" src="../util/EventHandler.js">&lt;/script>

    &lt;script language="JavaScript" src="../io/DataGraph.js">&lt;/script>
    &lt;script language="JavaScript" src="../io/HTTP.js">&lt;/script>
    &lt;script language="JavaScript" src="../io/XMLTreeLoader.js">&lt;/script>

    &lt;script language="JavaScript">
      function init() {

      }
    &lt;/style>
    &lt;style type="text/css">
      body { margin: 0; padding: 0; }
    &lt;/style>
  &lt;/head>
  &lt;body onload="init()">
  &lt;/body>
&lt;/html></code></pre>

<p>
<b>2) Create a new SnowflakeLayout</b>
</p>

<p>
You can create your graph in virtually any HTML element. If you're going to place the graph in an element other than the &lt;body>, remember that the element must have a known size and position (via element.offsetWidth, element.offsetHeight, element.offsetTop, element.offsetLeft). Append the following to "init()"
</p>

<pre><code>var layout = new SnowflakeLayout( document.body, true );</code></pre>

<p>
<b>3) Configure the layout</b>
</p>

<p>
A configuration defines how we handle the addition of different kinds of nodes to the graph. For each "type" of node, we tell the layout how to create a "model" and "view" of the new node.
</p>

<pre><code>layout.config._default = {
  model: function( dataNode ) {
    return {
      childRadius: 40,
      fanAngle: dataNode.root ? 360: 100,
      rootAngle: 0
    }
  },
</code></pre>

<p>
The <b>model</b> attribute in this configuration dictates the underlying structure of our graph. For a SnowflakeModel, we need to define the following for each node:
<ul style="padding-left:14px">
<li>childRadius: the edge length to this node's children</li>
<li>fanAngle: the maximum angle in which child nodes will be layed out</li>
<li>rootAngle: the base angle of the graph at the origin (this is automatically determined for all child nodes)</li>
</ul>
</p>

<p>
These parameters determine how this new node will interact with other nodes in our graph. The "model" attribute of a class in our configuration must return a JavaScript Object containing these values.
</p>

<pre><code>  view: function( dataNode, modelNode ) {
    if ( layout.svg ) {
      var nodeElement = document.createElementNS("http://www.w3.org/2000/svg", "circle");
      nodeElement.setAttribute('stroke', '#888888');
      nodeElement.setAttribute('stroke-width', '.25px');
      nodeElement.setAttribute('fill', dataNode.color);
      nodeElement.setAttribute('r', 6 + 'px');
      nodeElement.onmousedown =  new EventHandler( layout, layout.handleMouseDownEvent, modelNode.id )
      return nodeElement;
    } else {
      var nodeElement = document.createElement( 'div' );
      nodeElement.style.position = "absolute";
      nodeElement.style.width = "12px";
      nodeElement.style.height = "12px";
        
      var color = dataNode.color.replace( "#", "" );
      nodeElement.style.backgroundImage = "url(http://kylescholz.com/cgi-bin/bubble.pl?title=&r=12&pt=8&b=888888&c=" + color + ")";
      nodeElement.innerHTML = '<img width="1" height="1">';
      nodeElement.onmousedown =  new EventHandler( layout, layout.handleMouseDownEvent, modelNode.id )
      return nodeElement;
    }
  }
}</code></pre>

<p>
The <b>view</b> defines what the nodes in our graph look like. The view attribute of a configuration class must return a DOM element --  JSViz supports most HTML and SVG elements. You can control the appearance and behavior of view elements just like any DOM element. For more details, see the comments in the example source.
</p>

<p>
<b>4) Override the default edge properties</b>.
</p>

<p>
This is optional, of course. The SnowflakeLayout provides a default implementation, but let's replace it with a custom edge builder that draws edges in the color of the parent node.
</p>

<pre><code>layout.viewEdgeBuilder = function( dataNodeSrc, dataNodeDest ) {
  if ( this.svg ) {
    return {
      'stroke': dataNodeSrc.color,
      'stroke-width': '2px',
      'stroke-dasharray': '2,4'
    }
  } else {
    return {
      'pixelColor': dataNodeSrc.color,
      'pixelWidth': '2px',
      'pixelHeight': '2px',
      'pixels': 8
    }
  }
}</code></pre>

<p><b>5) Instantiate a loader to process the contents of our file.</b></p>

<p>The XMLTreeLoader is included in the JSViz distribution. It builds a simple graph based on the hierarchical structure of an XML document.</p>

<pre><code>var loader = new XMLTreeLoader( layout.dataGraph );
loader.load( "treedata1.xml" );</code></pre>

<p>
<a href="http://jsviz.org/files/jsviz/0.3.3/examples/treedata1.xml">See the XML source here</a>
</p>

<p>
For your own projects, you may write a custom loader that reads XML, JSON or other formatted data from a file or REST interface.
</p>

<p><b>6) Create a builder to add all of the nodes to the graph once we've finished reading the file.</b></p>

<pre><code>var SimpleBuilder = function() {
  this.started = false;
  this.update = function() {
    var d = layout.dequeueNode();
    if ( !this.started && d ) {
      this.started=true;
      while( layout.dequeueNode() ) {};
    }
    if ( this.started && !d ) { return false; }
  }
}        
var buildTimer = new Timer(0);
buildTimer.subscribe( new SimpleBuilder );
buildTimer.start();</code></pre>

<p>Check out the example source contains an alternate strategy for adding nodes.</p>

<p><b>We're finished.</b> <a href="http://jsviz.org/files/jsviz/0.3.3/examples/XMLLoader_Snowflake.html">Take another look at the product.</a></p>

<p>So what can you do with JSViz 0.3.3? While we' post more examples and tutorials over the coming days and weeks, we encourage you to share your projects, ideas, and suggestions.</p>]]>
    </content>
</entry>
<entry>
    <title>JSViz 0.3.3 Released</title>
    <link rel="alternate" type="text/html" href="http://www.jsviz.org/blog/2007/01/jsviz_033_released.html" />
    <link rel="service.edit" type="application/atom+xml" href="http://www.jsviz.org/cgi-bin/mt/mt-atom.cgi/weblog/blog_id=1/entry_id=4" title="JSViz 0.3.3 Released" />
    <id>tag:www.jsviz.org,2007:/blog//1.4</id>
    
    <published>2007-01-22T03:20:23Z</published>
    <updated>2007-01-29T15:09:40Z</updated>
    
    <summary>JSViz 0.3.3 is now available. This release includes two major features: Snowflake Model is an updated implementation of the "Tree Model" offered in JSViz 0.2. This is a geometric model, offering superior speed to Force Directed layouts, but only capable of representing hierarchical data (sorry, no circuits). An Example Snowflake Graph Layouts offer a simplified interface to the core JSViz libraries. New projects can now be created with minimal code and simple configuration. Additional examples, using Layouts: An Example Force Directed Graph with Data Loader An Example Force Directed Graph with Randomly Generated Data You can download the full source as a single ZIP archive or browse individual files on the Download page I'll follow up with tutorials shortly....</summary>
    <author>
        <name>kyle scholz</name>
        <uri>kylescholz.com</uri>
    </author>
            <category term="jsviz" />
    
    <content type="html" xml:lang="en" xml:base="http://www.jsviz.org/blog/">
        <![CDATA[<p>JSViz 0.3.3 is now available. This release includes two major features:</p>

<p><b>Snowflake Model</b> is an updated implementation of the "Tree Model" offered in JSViz 0.2. This is a geometric model, offering superior speed to Force Directed layouts, but only capable of representing hierarchical data (sorry, no circuits).</p>

<p><a href="http://jsviz.org/files/jsviz/0.3.3/examples/XMLLoader_Snowflake.html">An Example Snowflake Graph</a></p>

<p><b>Layouts</b> offer a simplified interface to the core JSViz libraries. New projects can now be created with minimal code and simple configuration. Additional examples, using Layouts:</p>

<p><a href="http://jsviz.org/files/jsviz/0.3.3/examples/XMLLoader_ForceDirected.html">An Example Force Directed Graph with Data Loader</a><br />
<a href="http://jsviz.org/files/jsviz/0.3.3/examples/RandomCircuit_ForceDirected.html">An Example Force Directed Graph with Randomly Generated Data</a></p>

<p>You can download the full source as a single ZIP archive or browse individual files on the <a href="http://jsviz.org/wiki/index.php/Download">Download page</a></p>

<p>I'll follow up with tutorials shortly.</p>]]>
        
    </content>
</entry>
<entry>
    <title>Welcome to the new jsviz.org!</title>
    <link rel="alternate" type="text/html" href="http://www.jsviz.org/blog/2006/01/welcome_to_the_new_jsviz_org.html" />
    <link rel="service.edit" type="application/atom+xml" href="http://www.jsviz.org/cgi-bin/mt/mt-atom.cgi/weblog/blog_id=1/entry_id=1" title="Welcome to the new jsviz.org!" />
    <id>tag:www.jsviz.org,2006:/blog//1.1</id>
    
    <published>2006-01-22T01:36:48Z</published>
    <updated>2007-01-22T03:58:36Z</updated>
    
    <summary> Welcome to the new official home of JSViz. I've put together this website to better facilitate collaboration as this project moves forward. While things are a little sparse at the moment, in time you'll find: documentation answers to frequent questions opportunities to request and comment on new features bug submission and tracking the latest downloads and resources for contributing to the JSViz project Everything on the site is read/write. Feel free to comment and edit whenever you can. Thanks, and have fun! Kyle Scholz...</summary>
    <author>
        <name>kyle scholz</name>
        <uri>kylescholz.com</uri>
    </author>
            <category term="jsviz" />
    
    <content type="html" xml:lang="en" xml:base="http://www.jsviz.org/blog/">
        <![CDATA[<p>
Welcome to the new official home of JSViz. I've put together this website to better facilitate collaboration as this project moves forward.
</p>

<p>
While things are a little sparse at the moment, in time you'll find:
<ul style="padding-left:14px">
<li>documentation</li>
<li>answers to frequent questions</li>
<li>opportunities to request and comment on new features</li>
<li>bug submission and tracking</li>
<li>the latest downloads</li>
<li>and resources for contributing to the JSViz project</li>
</ul></p>

<p>
Everything on the site is read/write. Feel free to comment and edit whenever you can. Thanks, and have fun!
</p>

<p>
Kyle Scholz
</p>]]>
        
    </content>
</entry>

</feed>
