-
-
Save sharonhoward/ff90f038b01ba47eb38320b9f075fa2b to your computer and use it in GitHub Desktop.
Revisions
-
iosonosempreio revised this gist
Aug 2, 2018 . 1 changed file with 2 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,5 +1,5 @@ let width = 960 let height = 500 let svg = d3.select('body').append('svg') .attr('width', width) -
iosonosempreio revised this gist
Aug 2, 2018 . 1 changed file with 2 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,3 +1,5 @@ How to create custom symbols to use with d3.symbol(). As far as I understood, commands are [theese](https://www.w3.org/TR/2dcontext/#canvaspathmethods). Readapted from this [fiddle](https://jsfiddle.net/nimezhu/anzqbm6e/). -
iosonosempreio revised this gist
Aug 2, 2018 . 1 changed file with 1 addition and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,2 +1,3 @@ How to create custom symbols to use with d3.symbol(). As far as I understood, commands are [theese](https://www.w3.org/TR/2dcontext/#canvaspathmethods). Readapted from this [fiddle](https://jsfiddle.net/nimezhu/anzqbm6e/). -
iosonosempreio revised this gist
Aug 2, 2018 . 1 changed file with 0 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -13,7 +13,6 @@ </style> <body> <script src="//d3js.org/d3.v5.min.js"></script> <script src="script.js"></script> </body> -
iosonosempreio revised this gist
Aug 2, 2018 . 1 changed file with 2 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,2 @@ How to create custom symbols to use with d3.symbol(). Readapted from this [fiddle](https://jsfiddle.net/nimezhu/anzqbm6e/). -
iosonosempreio created this gist
Aug 2, 2018 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,21 @@ <html> <style> line { stroke: #dadada; stroke-width: 1px; } path { fill: none; stroke: black; stroke-width: 1px; } </style> <body> <h1>D3 V5 custom symbols</h1> <script src="//d3js.org/d3.v5.min.js"></script> <script src="script.js"></script> </body> </html> This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,51 @@ let width = 600 let height = 400 let svg = d3.select('body').append('svg') .attr('width', width) .attr('height', height) let g = svg.append('g') .attr('transform', 'translate(' + width / 2 + ',' + height / 2 + ')') g.append('line') .attr('x1', 0) .attr('y1', -height / 2) .attr('x2', 0) .attr('y2', height / 2) g.append('line') .attr('x1', -width / 2) .attr('y1', 0) .attr('x2', width / 2) .attr('y2', 0) .style('stroke', '#DADADA') .style('stroke-width', 1) var cross = { draw: function(context, size) { context.moveTo(-size / 2, -size / 2) context.lineTo(size / 2, size / 2) context.moveTo(size / 2, -size / 2) context.lineTo(-size / 2, size / 2) } } var diamond = { draw: function(context, size) { context.moveTo(0, -size / 2) context.lineTo(size / 3, 0) context.lineTo(0, size / 2) context.lineTo(-size / 3, 0) context.lineTo(0, -size / 2) context.closePath(); } } let size = 50; g.append("path") .attr("d", d3.symbol().type(cross).size(size)) g.append("path") .attr("d", d3.symbol().type(diamond).size(size*1.3))