Skip to content

Instantly share code, notes, and snippets.

@iros
Created May 23, 2013 18:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save iros/5638523 to your computer and use it in GitHub Desktop.
Save iros/5638523 to your computer and use it in GitHub Desktop.
var data = [1,3,5,10,11,12,50];
var width = 500,
height = 100,
r = 5;
var xScale = d3.scale.linear()
.range([5, width-r])
.domain([1,50]);
var chart = d3.select("#vis")
.append("svg")
.attr("width", width)
.attr("height", height);
var circles = chart.append("g")
.classed("circles", true);
circles.selectAll("circle")
.data(data)
.enter()
.append("circle")
.classed("circle", true)
.style("fill", "red")
.attr("r", r)
.attr("cy", height/2)
.attr("cx", function(d) {
return xScale(d);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment