block by PatMartin 112191b94399a5e4172c7d2621b31df5

Treemap

Full Screen

Treemap

This demonstrates how to create a Treemap from csv data using dex.js.

This treemap is based upon Mike Bostocks excellent example.

Features

References

index.html

<!DOCTYPE html>
<meta charset="utf-8">
<style>
    html, body, #TreemapParent {
        height: 100%;
        min-height: 100%;
        width: 100%;
        min-width: 100%;
    }

</style>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/jqueryui/1.11.4/jquery-ui.min.css">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/jqueryui/1.11.4/jquery-ui.theme.min.css">
<link rel="stylesheet" href="https://dexjs.net/js/dex-jquery.css">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.7/css/bootstrap.css"/>
<link rel="stylesheet" href="https://dexjs.net/js/dex-bootstrap.css">
<link rel="stylesheet" href="https://dexjs.net/js/dex.css">

<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jqueryui/1.12.1/jquery-ui.min.js"></script>
<script src="https://dexjs.net/js/dex-jquery.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.7/js/bootstrap.min.js"></script>
<script src="https://dexjs.net/js/dex-bootstrap.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/underscore.js/1.8.3/underscore-min.js"></script>
<script src="https://dexjs.net/js/dex-libs.js"></script>
<script src="https://dexjs.net/js/dex.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/Faker/3.1.0/faker.min.js"></script>
<body>
<div id="TreemapParent"></div>
<script>
  d3.csv("crime2000.csv", function (error, data) {
    var crime = new dex.csv(data);

    var treemap = new dex.charts.d3.Treemap({
        'parent': '#TreemapParent',
        'csv': crime
      }
    ).render();
  });
</script>