Skip to content

Instantly share code, notes, and snippets.

@nick3499
Forked from d3byex/index.html
Last active March 23, 2018 03:16
Show Gist options
  • Save nick3499/cb39d49c67a81e90354735a3921269ee to your computer and use it in GitHub Desktop.
Save nick3499/cb39d49c67a81e90354735a3921269ee to your computer and use it in GitHub Desktop.
D3byEX 9.10: Symbols (Adapted to D3.js v5)
<!DOCTYPE html>
<html><meta charset=utf-8>
<head>
<meta name="description" content="D3.js v5, built-in symbol array" />
</head>
<body>
<script src="http://d3js.org/d3.v5.min.js"></script>
<script src="https://d3js.org/d3-selection-multi.v1.min.js"></script>
<script>
var svg = d3.select('body')
.append('svg')
.attrs({ width: 500, height: 250 }); // v5
svg.selectAll('path')
.data(d3.symbols) // v5
.enter()
.append('path')
.attrs({ // v5
d: d3.symbol().type(function (d) { return d; }),
transform: function (d, i) {
return 'translate(' + (i * 20 + 10) + ',10)';
}
});
</script>
</body>
</html>
@nick3499
Copy link
Author

Updated script from v4 to v5

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment