Commit a5294567e68eb81519afe41fe146484652e5ad32

Authored by hitier
1 parent a07df204

Rewrite anonymous functions style

Showing 1 changed file with 6 additions and 16 deletions   Show diff stats
app/main/static/js/charges.js
... ... @@ -136,7 +136,7 @@ function build_chart(div_selector, data_url, project_name, category) {
136 136  
137 137 var y_max = d3.max(data, function (d) {
138 138 return d3.max(categories, function (c) {
139   - return +d[c]
  139 + return +d[c]
140 140 })
141 141 });
142 142 y_max = y_max * height_ratio
... ... @@ -153,9 +153,7 @@ function build_chart(div_selector, data_url, project_name, category) {
153 153 .data(data)
154 154 .enter()
155 155 .append("g")
156   - .attr("transform", function (d) {
157   - return "translate(" + xScale(d.period) + ",0)";
158   - })
  156 + .attr("transform", d => "translate(" + xScale(d.period) + ",0)")
159 157 .selectAll("rect")
160 158 .data(function (d) {
161 159 return categories.map(function (key) {
... ... @@ -163,19 +161,11 @@ function build_chart(div_selector, data_url, project_name, category) {
163 161 });
164 162 })
165 163 .enter().append("rect")
166   - .attr("x", function (d) {
167   - return xCategories(d.key);
168   - })
169   - .attr("y", function (d) {
170   - return yScale(d.value);
171   - })
  164 + .attr("x", d => xCategories(d.key))
  165 + .attr("y", d => yScale(d.value))
172 166 .attr("width", xCategories.bandwidth())
173   - .attr("height", function (d) {
174   - return height - yScale(d.value);
175   - })
176   - .attr("fill", function (d) {
177   - return colorScale(d.key);
178   - });
  167 + .attr("height", d => height - yScale(d.value))
  168 + .attr("fill", d => colorScale(d.key));
179 169  
180 170 }
181 171  
... ...