Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

last

  • Loading branch information...
commit 0aae73fbbe42d96014d930f2220d603389e847d3 1 parent 3767b2f
Andrew W. Hill andrewxhill authored

Showing 1 changed file with 42 additions and 0 deletions. Show diff stats Hide diff stats

  1. +42 0 examples/linechart_advanced.html
42 examples/linechart_advanced.html
... ... @@ -0,0 +1,42 @@
  1 +<!--
  2 +You are free to copy and use this sample in accordance with the terms of the
  3 +Apache license (http://www.apache.org/licenses/LICENSE-2.0.html)
  4 +-->
  5 +
  6 +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
  7 +<html xmlns="http://www.w3.org/1999/xhtml">
  8 +<head>
  9 + <meta http-equiv="content-type" content="text/html; charset=utf-8" />
  10 + <title>D3 Visualization API Sample</title>
  11 + <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.5.2/jquery.min.js"></script>
  12 + <script type="text/javascript" src="libs/underscore-1.1.6.js"></script>
  13 + <script type="text/javascript" src="libs/backbone.js"></script>
  14 + <script type="text/javascript" src="libs/d3.min.js"></script>
  15 + <script type="text/javascript" src="backbone.cartodb.js"></script>
  16 + <script type="text/javascript" src="d3.cartodb.js"></script>
  17 + <link href='css/cartodb.d3.default.css' rel='stylesheet' type='text/css' />
  18 + <style type="text/css">
  19 + #cartodb_d3 {
  20 + float: left; width: 800px;
  21 + }
  22 + </style>
  23 + <script type="text/javascript">
  24 + var CartoDB = Backbone.CartoDB({user: 'viz2'});
  25 + var Populations = CartoDB.CartoDBCollection.extend({
  26 + sql: function() {
  27 + //return "SELECT country_or_area as country,year_n as year,floor(value) as population FROM un_population_projections where variant = 'Medium variant' AND country_or_area in ('United States of America', 'China', 'Brazil') ORDER BY country_or_area, year_n";
  28 + return "SELECT EXTRACT(EPOCH FROM to_date(lpad(datestop,8,'0'), 'MMDDYYYY')) as datereal, race, count(*) as ct FROM stop_frisk_saleiva group by datestop, race ORDER BY to_date(lpad(datestop,8,'0'), 'MMDDYYYY')";
  29 + }
  30 + });
  31 + var pops = new Populations();
  32 +
  33 + var CartoD3 = Backbone.CartoD3(pops);
  34 + $(document).ready(function() {
  35 + var barchart = new CartoD3.LineChart({ el: $("#cartodb_d3"), group: 'race', variable: 'ct', independent: 'datereal', label: 'race', stroke_width: 1, legend: false, legend_terms: null, borders: true});
  36 + });
  37 + </script>
  38 +</head>
  39 +<body style="font-family: Arial;border: 0 none;">
  40 +<div id="cartodb_d3"></div>
  41 +</body>
  42 +</html>

0 comments on commit 0aae73f

Please sign in to comment.
Something went wrong with that request. Please try again.