wefra/lib/d3-v6-oop/text_chart.js

19 lines
504 B
JavaScript

TextChart = {
init: function(url, svg, textAccessor){
d3.json(url, config_requestArguments).then(function(dataset){
console.log(dataset);
svg.selectAll("text")
.data(dataset)
.enter()
.append("text")
.attr("x", 20)
.attr("y", function(d, i){ return 20 + i *20; })
.text( textAccessor )
.attr("font-family", "sans-serif")
//.attr("font-size", "10px")
.attr("fill", "black");
});
}
};