~smagoun/whoopsie/whoopsie-lp1017637

« back to all changes in this revision

Viewing changes to backend/stats/static/js/d3/examples/axis/axis-orientations.html

  • Committer: Evan Dandrea
  • Date: 2012-05-09 05:53:45 UTC
  • Revision ID: evan.dandrea@canonical.com-20120509055345-z2j41tmcbf4as5uf
The backend now lives in lp:daisy and the website (errors.ubuntu.com) now lives in lp:errors.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
<!DOCTYPE html>
2
 
<html>
3
 
  <head>
4
 
    <script type="text/javascript" src="../../d3.v2.js"></script>
5
 
    <style type="text/css">
6
 
 
7
 
body {
8
 
  font: 10px sans-serif;
9
 
}
10
 
 
11
 
.axis line, .axis path {
12
 
  fill: none;
13
 
  stroke: #000;
14
 
  shape-rendering: crispEdges;
15
 
}
16
 
 
17
 
    </style>
18
 
  </head>
19
 
  <body>
20
 
    <script type="text/javascript">
21
 
 
22
 
var m = [20, 40, 20, 40],
23
 
    w = 960 - m[1] - m[3],
24
 
    h = 500 - m[0] - m[2],
25
 
    x = d3.time.scale().domain([new Date(2011, 07, 01), new Date(2011, 07, 08)]).range([0, w]),
26
 
    y = d3.scale.sqrt().range([h, 0]);
27
 
 
28
 
var xAxis = d3.svg.axis()
29
 
    .scale(x)
30
 
    .ticks(d3.time.days)
31
 
    .tickFormat(d3.time.format("%m/%d"));
32
 
 
33
 
var yAxis = d3.svg.axis()
34
 
    .scale(y);
35
 
 
36
 
var svg = d3.select("body").append("svg")
37
 
    .attr("width", w + m[1] + m[3])
38
 
    .attr("height", h + m[0] + m[2])
39
 
  .append("g")
40
 
    .attr("transform", "translate(" + m[3] + "," + m[0] + ")");
41
 
 
42
 
svg.append("g")
43
 
    .attr("class", "bottom axis")
44
 
    .attr("transform", "translate(0," + h + ")")
45
 
    .call(xAxis.orient("bottom"));
46
 
 
47
 
svg.append("g")
48
 
    .attr("class", "top axis")
49
 
    .call(xAxis.orient("top"));
50
 
 
51
 
svg.append("g")
52
 
    .attr("class", "left axis")
53
 
    .call(yAxis.orient("left"));
54
 
 
55
 
svg.append("g")
56
 
    .attr("class", "right axis")
57
 
    .attr("transform", "translate(" + w + ",0)")
58
 
    .call(yAxis.orient("right"));
59
 
 
60
 
    </script>
61
 
  </body>
62
 
</html>