Thursday, January 1, 2015

D3: Simple javascript class wrapper for Association Graph

This is a simple javascript class wrapper (in both css and js) for the Association Graph Visualization at, The interface separates json data, html element, and the actual HeroGraphPlot class. It is modified so that it will be easier for a web developer to easily add a association graph chart into their application.

Below is the link to the source code (remember to put in in the web folder of a web server such as xamp so that the html page will be able to download the json in the same folder):

Below is the html which includes the javascript that download a json data and then display as a HeroGraphPlot chart:


<link href="lib/herograph.css" rel="stylesheet"></link>

<script src="lib/jquery-2.1.3.min.js" type="text/javascript"></script>
<script src="lib/d3.min.js" type="text/javascript"></script>
<script src="lib/underscore-min.js" type="text/javascript"></script>
<script src="lib/herograph.js" type="text/javascript"></script>

function plotBiPartite()
 d3.json("herograph.json", function(graphData) {
  var plot = new HeroGraphPlot("chart", "info", graphData);
padding-top: 10px;
    <svg id="chart" class="herograph">
       <marker id="Triangle"
         refX="0" refY="3" 
         markerWidth="6" markerHeight="6"
         <path d="M 0 0 L 6 3 L 0 6 z" />

   <div id="info" class="herographinfo"></div>

No comments:

Post a Comment