Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Tree: 0aae73fbbe
Fetching contributors…

Cannot retrieve contributors at this time

41 lines (39 sloc) 1.675 kB
<!--
You are free to copy and use this sample in accordance with the terms of the
Apache license (http://www.apache.org/licenses/LICENSE-2.0.html)
-->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>D3 Visualization API Sample</title>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.5.2/jquery.min.js"></script>
<script type="text/javascript" src="libs/underscore-1.1.6.js"></script>
<script type="text/javascript" src="libs/backbone.js"></script>
<script type="text/javascript" src="libs/d3.min.js"></script>
<script type="text/javascript" src="backbone.cartodb.js"></script>
<script type="text/javascript" src="d3.cartodb.js"></script>
<link href='css/cartodb.d3.default.css' rel='stylesheet' type='text/css' />
<style type="text/css">
#cartodb_d3 {
float: left; width: 800px;
}
</style>
<script type="text/javascript">
var CartoDB = Backbone.CartoDB({user: 'examples'});
var EarthQuakes = CartoDB.CartoDBCollection.extend({
sql: function() {
return "select month,avg(magnitude) as magnitude from earthquakes group by month order by month asc";
}
});
var eq = new EarthQuakes();
var CartoD3 = Backbone.CartoD3(eq);
$(document).ready(function() {
var barchart = new CartoD3.BarChart({ el: $("#cartodb_d3"), variable: 'magnitude', label: 'month', title: "Global Earthquake Magnitude by Month"});
});
</script>
</head>
<body style="font-family: Arial;border: 0 none;">
<div id="cartodb_d3"></div>
</body>
</html>
Jump to Line
Something went wrong with that request. Please try again.