indentedtree.html 2.81 KB
Newer Older
afe's avatar
afe committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127
<!DOCTYPE html>
<meta charset="utf-8">
<link href="../src/nv.d3.css" rel="stylesheet" type="text/css">
<style>

body {
  overflow-y:scroll;
}

</style>
<body>

  <div id="example1" style="width:600px"></div>


<script src="../lib/d3.v3.js"></script>
<script src="../nv.d3.js"></script>
<script src="../src/utils.js"></script>
<script src="../src/models/indentedTree.js"></script>
<script>

// THIS API WILL BE CHANGING!!  this was ported from a different graphing collection, its only been halfway ported to the nvd3 style

var testTree = [{
  key: 'NVD3',
  url: 'http://novus.github.com/nvd3',
  values: [
    {
      key: "Charts",
      _values: [
        {
          key: "Simple Line",
          type: "Historical",
          url: "http://novus.github.com/nvd3/ghpages/line.html"
        },
        {
          key: "Scatter / Bubble",
          type: "Snapshot",
          url: "http://novus.github.com/nvd3/ghpages/scatter.html"
        },
        {
          key: "Stacked / Stream / Expanded Area",
          type: "Historical",
          url: "http://novus.github.com/nvd3/ghpages/stackedArea.html"
        },
        {
          key: "Discrete Bar",
          type: "Snapshot",
          url: "http://novus.github.com/nvd3/ghpages/discreteBar.html"
        },
        {
          key: "Grouped / Stacked Multi-Bar",
          type: "Snapshot / Historical",
          url: "http://novus.github.com/nvd3/ghpages/multiBar.html"
        },
        {
          key: "Horizontal Grouped Bar",
          type: "Snapshot",
          url: "http://novus.github.com/nvd3/ghpages/multiBarHorizontal.html"
        },
        {
          key: "Line and Bar Combo",
          type: "Historical",
          url: "http://novus.github.com/nvd3/ghpages/linePlusBar.html"
        },
        {
          key: "Cumulative Line",
          type: "Historical",
          url: "http://novus.github.com/nvd3/ghpages/cumulativeLine.html"
        },
        {
          key: "Line with View Finder",
          type: "Historical",
          url: "http://novus.github.com/nvd3/ghpages/lineWithFocus.html"
        }
      ]
    },
    {
      key: "Chart Components",
      _values: [
        {
          key: "Legend",
          type: "Universal",
          url: "http://novus.github.com/nvd3/examples/legend.html"
        }
      ]
    }
  ]
}];



var testColumns = [
  {
    key: 'key',
    label: 'Name',
    showCount: true,
    width: '75%',
    type: 'text',
    classes: function(d) { return d.url ? 'clickable name' : 'name' },
    click: function(d) {
       if (d.url) window.location.href = d.url;
    }
  },
  {
    key: 'type',
    label: 'Type',
    width: '25%',
    type: 'text'
  }
];



nv.addGraph(function() {
  var chart = nv.models.indentedTree()
                .columns(testColumns);

  d3.select('#example1')
      .datum(testTree)
    .call(chart);
});




</script>