maybe a bit better?
This commit is contained in:
parent
020afbb419
commit
fa66efa361
@ -91,14 +91,18 @@ const y = d3.scaleLinear()
|
|||||||
.attr("text-anchor", "start")
|
.attr("text-anchor", "start")
|
||||||
.text("↑ Daily km ($)"));
|
.text("↑ Daily km ($)"));
|
||||||
|
|
||||||
d3.csv("../public/csv/stats.csv", function(d) {
|
d3.csv("../public/csv/stats.csv").then(function(data) {
|
||||||
return { date : d3.timeParse("%Y-%m-%d")(d.date), value : d.km }
|
data.forEach(function(d) {
|
||||||
|
d.date = d3.timeParse("%Y-%m-%d")(d.date);
|
||||||
|
d.km = +d.km;
|
||||||
|
console.log(d);
|
||||||
|
});
|
||||||
|
|
||||||
}, function(error, data) {
|
}, function(error, data) {
|
||||||
if (error) throw error;
|
if (error) throw error;
|
||||||
|
|
||||||
x.domain(d3.extent(data, function(d) { return d.date; }));
|
x.domain(d3.extent(data, function(d) { return d.date; }));
|
||||||
y.domain(d3.extent(data, function(d) { return d.km; }));
|
y.domain(d3.extent(data, function(d) { return d.km; }));
|
||||||
|
|
||||||
g.append("g")
|
g.append("g")
|
||||||
.attr("transform", "translate(0," + height + ")")
|
.attr("transform", "translate(0," + height + ")")
|
||||||
|
Loading…
Reference in New Issue
Block a user