Create a Basic Google Map
http://www.w3schools.com/googleapi/google_maps_basic.asp
linear
scales (discussed earlier), D3 has several other built-in scale methods:sqrt
pow
log
quantize
quantile
quantize
, but with discrete values for its input domain (when you already have “buckets”).ordinal
d3.scale.category10()
, d3.scale.category20()
, d3.scale.category20b()
, andd3.scale.category20c()
d3.time.scale()
<style>
.chart div {
font: 10px sans-serif;
background-color: steelblue;
text-align: right;
padding: 3px;
margin: 1px;
color: white;
}
</style>
<div class="chart">
<div style="width: 40px;">4</div>
<div style="width: 80px;">8</div>
<div style="width: 150px;">15</div>
<div style="width: 160px;">16</div>
<div style="width: 230px;">23</div>
<div style="width: 420px;">42</div>
</div>
d3.select(".chart")
.selectAll("div")
.data(data)
.enter().append("div")
.style("width", function(d) { return d * 10 + "px"; })
.text(function(d) { return d; });
we have to use i,d as parameters
data is one of the property of
var theData = [ 1, 2, 3 ] var p = d3.select("body").selectAll("p") .data(theData) .enter() .append("p") .text(function (d,i) { return "i = " + i + " d = "+d; });