| <html> | |
| <body> | |
| <script type='text/javascript' src='http://d3js.org/d3.v3.min.js'></script> | |
| <script> | |
| var data = [ | |
| { 'a': 1, 'b': 2 }, | |
| { 'a': 42, 'b': 7 }, | |
| { 'a': 15, 'b': 3 }, | |
| { 'a': 32, 'b': 8 }, | |
| { 'a': 26, 'b': 9 }, | |
| { 'a': 18, 'b': 5 } | |
| ] | |
| var fullWidth = 500, fullHeight = 500 | |
| var x = d3.scale.linear() | |
| .domain([0, 5]) | |
| .range([0, 300]) | |
| var y = d3.scale.linear() | |
| .domain([0, 50]) | |
| .range([300, 0]) | |
| d3.select('body') | |
| .append('svg') | |
| .attr('width', fullWidth) | |
| .attr('height', fullHeight) | |
| .selectAll('circle').data(data) | |
| .enter().append('circle') | |
| .attr('r', 5) | |
| .attr('cx', function (d, i) { return x(i) }) | |
| .attr('cy', function (d, i) { return y(d.a) }) | |
| </script> | |
| </body> | |
| </html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment