Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var dataset = [
- [5, 20], [480, 90], [250, 50], [100, 33], [330, 95],
- [410, 12], [475, 44], [25, 67], [85, 21], [220, 88]
- ];
- var visualizacion = {
- svgWidth: 500,
- svgHeight: 100,
- circle: "null",
- texto: "null",
- }
- var svg = d3.select("body").append("svg")
- .attr("width", visualizacion.svgWidth)
- .attr("height", visualizacion.svgHeight);
- visualizacion.circle = svg.selectAll("circle")
- .data(dataset).enter()
- .append("circle");
- visualizacion.circle
- .attr("cx", function(d)
- {return d[0];})
- .attr("cy", function(d)
- {return d[1];})
- .attr("r", function(d) {
- return Math.sqrt(visualizacion.svgHeight - d[1]);
- })
- .attr("fill", "green");
- visualizacion.texto = svg.selectAll("text")
- .data(dataset).enter()
- .append("text");
- visualizacion.texto
- .text(function(d) {
- return d[0] + "," + d[1];
- })
- .attr("x", function(d) {
- return d[0];
- })
- .attr("y", function(d) {
- return d[1];
- })
- .attr("font-family", "sans-serif")
- .attr("font-size", "11px")
- .attr("fill", "red");
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement