From a5294567e68eb81519afe41fe146484652e5ad32 Mon Sep 17 00:00:00 2001 From: Richard Hitier Date: Sat, 10 Apr 2021 20:55:30 +0200 Subject: [PATCH] Rewrite anonymous functions style --- app/main/static/js/charges.js | 22 ++++++---------------- 1 file changed, 6 insertions(+), 16 deletions(-) diff --git a/app/main/static/js/charges.js b/app/main/static/js/charges.js index ed49471..acd66a2 100644 --- a/app/main/static/js/charges.js +++ b/app/main/static/js/charges.js @@ -136,7 +136,7 @@ function build_chart(div_selector, data_url, project_name, category) { var y_max = d3.max(data, function (d) { return d3.max(categories, function (c) { - return +d[c] + return +d[c] }) }); y_max = y_max * height_ratio @@ -153,9 +153,7 @@ function build_chart(div_selector, data_url, project_name, category) { .data(data) .enter() .append("g") - .attr("transform", function (d) { - return "translate(" + xScale(d.period) + ",0)"; - }) + .attr("transform", d => "translate(" + xScale(d.period) + ",0)") .selectAll("rect") .data(function (d) { return categories.map(function (key) { @@ -163,19 +161,11 @@ function build_chart(div_selector, data_url, project_name, category) { }); }) .enter().append("rect") - .attr("x", function (d) { - return xCategories(d.key); - }) - .attr("y", function (d) { - return yScale(d.value); - }) + .attr("x", d => xCategories(d.key)) + .attr("y", d => yScale(d.value)) .attr("width", xCategories.bandwidth()) - .attr("height", function (d) { - return height - yScale(d.value); - }) - .attr("fill", function (d) { - return colorScale(d.key); - }); + .attr("height", d => height - yScale(d.value)) + .attr("fill", d => colorScale(d.key)); } -- libgit2 0.21.2