Skip to content

Commit

Permalink
Merge pull request #26 from curran/patch-1
Browse files Browse the repository at this point in the history
Adopt ES6 in README
  • Loading branch information
Fil committed Jan 11, 2021
2 parents f5ab074 + 2bc4f5d commit d5523c9
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions README.md
Expand Up @@ -12,7 +12,7 @@ If you use NPM, `npm install d3-hexbin`. Otherwise, download the [latest release
<script src="https://d3js.org/d3-hexbin.v0.2.min.js"></script>
<script>
var hexbin = d3.hexbin();
const hexbin = d3.hexbin();
</script>
```
Expand All @@ -37,7 +37,7 @@ Each bin in the returned array is an array containing the bin’s points. Only n
These *x*- and *y*-coordinates of the hexagon center can be used to render the hexagon at the appropriate location in conjunction with [*hexbin*.hexagon](#hexbin_hexagon). For example, given a hexbin generator:

```js
var hexbin = d3.hexbin();
const hexbin = d3.hexbin();
```

You could display a hexagon for each non-empty bin as follows:
Expand All @@ -46,7 +46,7 @@ You could display a hexagon for each non-empty bin as follows:
svg.selectAll("path")
.data(hexbin(points))
.enter().append("path")
.attr("d", function(d) { return "M" + d.x + "," + d.y + hexbin.hexagon(); });
.attr("d", d => `M${d.x},${d.y}${hexbin.hexagon()}`);
```

Alternatively, using a transform:
Expand All @@ -55,7 +55,7 @@ Alternatively, using a transform:
svg.selectAll("path")
.data(hexbin(points))
.enter().append("path")
.attr("transform", function(d) { return "translate(" + d.x + "," + d.y + ")"; })
.attr("transform", d => `translate(${d.x},${d.y})`)
.attr("d", hexbin.hexagon());
```

Expand Down

0 comments on commit d5523c9

Please sign in to comment.