Revisions
-
dysbulic revised this gist
Feb 3, 2021 . 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 @@ -175,6 +175,7 @@ .attr('y', centroid[1]) .attr('dy', '0.33em') .style('fill', ({ data }) => data.alliance) .attr('title', d.data.name) .text(d.data.symbol) }) -
dysbulic revised this gist
Aug 6, 2020 . No changes.There are no files selected for viewing
-
dysbulic revised this gist
Aug 6, 2020 . 1 changed file with 27 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 @@ -29,7 +29,8 @@ var pieGenerator = d3.pie() .value(function(d) {return d.quantity;}) .sort(function(a, b) { console.log(b) return a.starts <= b.starts; }); var months = [ @@ -39,80 +40,104 @@ symbol: '♑', starts: new Date('2021/01/21 17:15'), ends: new Date('2021/02/16 17:47'), color: 'gold', alliance: 'blue', }, { name: 'Aquarius', symbol: '♒', starts: new Date('2021/02/16 17:47'), ends: new Date('2021/03/11 17:47'), color: 'brown', alliance: 'purple', }, { name: 'Pisces', symbol: '♓', starts: new Date('2021/03/11 17:47'), ends: new Date('2021/04/18 17:45'), color: 'silver', alliance: 'purple', }, { name: 'Aries', symbol: '♈', starts: new Date('2021/04/18 17:45'), ends: new Date('2021/05/13 17:45'), color: 'black', alliance: 'red', }, { name: 'Taurus', symbol: '♉', starts: new Date('2021/05/13 17:45'), ends: new Date('2021/06/21 17:45'), color: 'green', alliance: 'red', }, { name: 'Gemini', symbol: '♊', starts: new Date('2021/06/21 17:45'), ends: new Date('2021/07/20 17:45'), color: 'yellow', alliance: 'purple', }, { name: 'Cancer', symbol: '♋', starts: new Date('2021/07/20 17:45'), ends: new Date('2021/08/10 17:45'), color: 'violet', alliance: 'blue', }, { name: 'Leo', symbol: '♌', starts: new Date('2021/08/10 17:45'), ends: new Date('2021/09/16 17:45'), color: '#f5c389', //'peach', alliance: 'blue', }, { name: 'Virgo', symbol: '♍', starts: new Date('2021/09/16 17:45'), ends: new Date('2021/10/30 17:45'), color: '#c99f32', //'copper', alliance: 'purple', }, { name: 'Libra', symbol: '♎', starts: new Date('2021/10/30 17:45'), ends: new Date('2021/11/23 17:45'), color: 'white', alliance: 'red', }, { name: 'Scorpio', symbol: '♏', starts: new Date('2021/11/23 17:45'), ends: new Date('2021/11/29 17:45'), color: 'pink', alliance: 'red', }, { name: 'Ophiuchus', symbol: '⛎', starts: new Date('2021/11/29 17:45'), ends: new Date('2021/12/27 17:45'), color: 'cyan', alliance: 'purple', }, { name: 'Sagittarius', symbol: '♐', starts: new Date('2021/12/27 17:45'), ends: new Date('2022/01/20 17:45'), color: 'orange', alliance: 'blue', }, ] -
dysbulic revised this gist
Aug 6, 2020 . 1 changed file with 3 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 @@ -12,7 +12,7 @@ } text { font-family: "Helvetica Neue", Helvetica, sans-serif; font-size: 25px; font-weight: bold; fill: white; text-anchor: middle; @@ -134,7 +134,7 @@ .enter() .append('path') .attr('d', arcGenerator) .style('fill', ({ data }) => data.color) // Labels @@ -149,6 +149,7 @@ .attr('x', centroid[0]) .attr('y', centroid[1]) .attr('dy', '0.33em') .style('fill', ({ data }) => data.alliance) .text(d.data.symbol) }) -
dysbulic revised this gist
Aug 6, 2020 . 1 changed file with 1 addition 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 @@ -134,7 +134,7 @@ .enter() .append('path') .attr('d', arcGenerator) .style('fill', ({ data }) => console.log(data)) // Labels -
dysbulic revised this gist
Aug 6, 2020 . 3 changed files with 8 additions and 4 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 @@ -5,6 +5,7 @@ </head> <style> svg { max-height: 98vh; } path { fill: orange; stroke: white; @@ -38,6 +39,8 @@ symbol: '♑', starts: new Date('2021/01/21 17:15'), ends: new Date('2021/02/16 17:47'), color: 'yellow', alliance: 'blue', }, { name: 'Aquarius', @@ -130,7 +133,8 @@ .data(arcData) .enter() .append('path') .attr('d', arcGenerator) .style('fill', 'green') // Labels @@ -145,8 +149,8 @@ .attr('x', centroid[0]) .attr('y', centroid[1]) .attr('dy', '0.33em') .text(d.data.symbol) }) // Readable d3.select('body') @@ -157,7 +161,7 @@ .each(function(d) { d3.select(this) .text(`${d.symbol}: ${d.name} <${d.starts.getMonth() + 1}/${d.starts.getDate()} - ${d.ends.getMonth() + 1}/${d.ends.getDate()}>`) }) </script> </body> </html> LoadingSorry, something went wrong. Reload?Sorry, we cannot display this file.Sorry, this file is invalid so it cannot be displayed.LoadingSorry, something went wrong. Reload?Sorry, we cannot display this file.Sorry, this file is invalid so it cannot be displayed. -
dysbulic revised this gist
Apr 29, 2019 . 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 @@ -19,8 +19,8 @@ </style> <body> <svg width="100%" height="100%" viewBox="0 -150 300 300"> <g transform="translate(150, 0)"></g> </svg> <script src="https://cdnjs.cloudflare.com/ajax/libs/d3/4.2.2/d3.min.js"></script> -
dysbulic revised this gist
Apr 29, 2019 . No changes.There are no files selected for viewing
-
dysbulic revised this gist
Apr 1, 2019 . No changes.There are no files selected for viewing
-
dysbulic revised this gist
Apr 1, 2019 . 1 changed file with 2 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 @@ -32,6 +32,7 @@ }); var months = [ {}, // Don't know why that's needed { name: 'Capricorn', symbol: '♑', @@ -155,7 +156,7 @@ .append('li') .each(function(d) { d3.select(this) .text(`${d.symbol}: ${d.name} <${d.starts.getMonth() + 1}/${d.starts.getDate()} - ${d.ends.getMonth() + 1}/${d.ends.getDate()}>`) }); </script> </body> -
dysbulic revised this gist
Apr 1, 2019 . 1 changed file with 4 additions and 3 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 @@ -148,13 +148,14 @@ }); // Readable d3.select('body') .append('ul') .data(months) .enter() .append('li') .each(function(d) { d3.select(this) .text(d.name); }); </script> </body> -
dysbulic revised this gist
Apr 1, 2019 . 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 @@ -154,7 +154,6 @@ .enter() .append('li') .each(function(d) { console.log(d) }); </script> -
dysbulic revised this gist
Apr 1, 2019 . No changes.There are no files selected for viewing
-
dysbulic revised this gist
Apr 1, 2019 . No changes.There are no files selected for viewing
-
dysbulic revised this gist
Apr 1, 2019 . 1 changed file with 11 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 @@ -146,6 +146,17 @@ .attr('dy', '0.33em') .text(d.data.symbol); }); // Readable d3.select('ul') .selectAll('li') .data(months) .enter() .append('li') .each(function(d) { var centroid = arcGenerator.centroid(d); console.log(d) }); </script> </body> </html> -
dysbulic revised this gist
Mar 17, 2019 . 1 changed file with 5 additions and 11 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 @@ -112,20 +112,14 @@ }, ] for(var i = 0; i < months.length; i++) { months[i].quantity = (months[i].ends - months[i].starts) / (60 * 60 * 60 * 24 * 10) } // Create an arc generator with configuration var arcGenerator = d3.arc() .innerRadius(30) .outerRadius(150); var arcData = pieGenerator(months); @@ -150,7 +144,7 @@ .attr('x', centroid[0]) .attr('y', centroid[1]) .attr('dy', '0.33em') .text(d.data.symbol); }); </script> </body> -
dysbulic revised this gist
Mar 17, 2019 . 4 changed files with 165 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 @@ -31,6 +31,89 @@ return a.name.localeCompare(b.name); }); var months = [ { name: 'Capricorn', symbol: '♑', starts: new Date('2021/01/21 17:15'), ends: new Date('2021/02/16 17:47'), }, { name: 'Aquarius', symbol: '♒', starts: new Date('2021/02/16 17:47'), ends: new Date('2021/03/11 17:47'), }, { name: 'Pisces', symbol: '♓', starts: new Date('2021/03/11 17:47'), ends: new Date('2021/04/18 17:45'), }, { name: 'Aries', symbol: '♈', starts: new Date('2021/04/18 17:45'), ends: new Date('2021/05/13 17:45'), }, { name: 'Taurus', symbol: '♉', starts: new Date('2021/05/13 17:45'), ends: new Date('2021/06/21 17:45'), }, { name: 'Gemini', symbol: '♊', starts: new Date('2021/06/21 17:45'), ends: new Date('2021/07/20 17:45'), }, { name: 'Cancer', symbol: '♋', starts: new Date('2021/07/20 17:45'), ends: new Date('2021/08/10 17:45'), }, { name: 'Leo', symbol: '♌', starts: new Date('2021/08/10 17:45'), ends: new Date('2021/09/16 17:45'), }, { name: 'Virgo', symbol: '♍', starts: new Date('2021/09/16 17:45'), ends: new Date('2021/10/30 17:45'), }, { name: 'Libra', symbol: '♎', starts: new Date('2021/10/30 17:45'), ends: new Date('2021/11/23 17:45'), }, { name: 'Scorpio', symbol: '♏', starts: new Date('2021/11/23 17:45'), ends: new Date('2021/11/29 17:45'), }, { name: 'Ophiuchus', symbol: '⛎', starts: new Date('2021/11/29 17:45'), ends: new Date('2021/12/27 17:45'), }, { name: 'Sagittarius', symbol: '♐', starts: new Date('2021/12/27 17:45'), ends: new Date('2022/01/20 17:45'), }, ] var fruits = [ {name: 'Apples', quantity: 20}, {name: 'Bananas', quantity: 40}, @@ -41,10 +124,10 @@ // Create an arc generator with configuration var arcGenerator = d3.arc() .innerRadius(30) .outerRadius(100); var arcData = pieGenerator(months); // Create a path element and set its d attribute d3.select('g') LoadingSorry, something went wrong. Reload?Sorry, we cannot display this file.Sorry, this file is invalid so it cannot be displayed.LoadingSorry, something went wrong. Reload?Sorry, we cannot display this file.Sorry, this file is invalid so it cannot be displayed.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,80 @@ [ { name: 'Capricorn', symbol: '♑', starts: new Date('2021/01/21 17:15'), ends: new Date('2021/02/16 17:47'), }, { name: 'Aquarius', symbol: '♒', starts: new Date('2021/02/16 17:47'), ends: new Date('2021/03/11 17:47'), }, { name: 'Pisces', symbol: '♓', starts: new Date('2021/03/11 17:47'), ends: new Date('2021/04/18 17:45'), }, { name: 'Aries', symbol: '♈', starts: new Date('2021/04/18 17:45'), ends: new Date('2021/05/13 17:45'), }, { name: 'Taurus', symbol: '♉', starts: new Date('2021/05/13 17:45'), ends: new Date('2021/06/21 17:45'), }, { name: 'Gemini', symbol: '♊', starts: new Date('2021/06/21 17:45'), ends: new Date('2021/07/20 17:45'), }, { name: 'Cancer', symbol: '♋', starts: new Date('2021/07/20 17:45'), ends: new Date('2021/08/10 17:45'), }, { name: 'Leo', symbol: '♌', starts: new Date('2021/08/10 17:45'), ends: new Date('2021/09/16 17:45'), }, { name: 'Virgo', symbol: '♍', starts: new Date('2021/09/16 17:45'), ends: new Date('2021/10/30 17:45'), }, { name: 'Libra', symbol: '♎', starts: new Date('2021/10/30 17:45'), ends: new Date('2021/11/23 17:45'), }, { name: 'Scorpio', symbol: '♏', starts: new Date('2021/11/23 17:45'), ends: new Date('2021/11/29 17:45'), }, { name: 'Ophiuchus', symbol: '⛎', starts: new Date('2021/11/29 17:45'), ends: new Date('2021/12/27 17:45'), }, { name: 'Sagittarius', symbol: '♐', starts: new Date('2021/12/27 17:45'), ends: new Date('2022/01/20 17:45'), }, ] -
animateddata revised this gist
Aug 2, 2017 . 2 changed files with 0 additions and 0 deletions.There are no files selected for viewing
LoadingSorry, something went wrong. Reload?Sorry, we cannot display this file.Sorry, this file is invalid so it cannot be displayed.LoadingSorry, something went wrong. Reload?Sorry, we cannot display this file.Sorry, this file is invalid so it cannot be displayed. -
peterrcook created this gist
Dec 15, 2016 .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,3 @@ license: gpl-3.0 height: 230 border: no 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,3 @@ Pie sort. From [D3 in Depth](http://d3indepth.com) book by [Peter Cook](http://animateddata.co.uk). 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,74 @@ <!DOCTYPE html> <meta charset="utf-8"> <head> <title>Pie sort</title> </head> <style> path { fill: orange; stroke: white; } text { font-family: "Helvetica Neue", Helvetica, sans-serif; font-size: 12px; font-weight: bold; fill: white; text-anchor: middle; } </style> <body> <svg width="700" height="220"> <g transform="translate(300, 110)"></g> </svg> <script src="https://cdnjs.cloudflare.com/ajax/libs/d3/4.2.2/d3.min.js"></script> <script> var pieGenerator = d3.pie() .value(function(d) {return d.quantity;}) .sort(function(a, b) { return a.name.localeCompare(b.name); }); var fruits = [ {name: 'Apples', quantity: 20}, {name: 'Bananas', quantity: 40}, {name: 'Cherries', quantity: 50}, {name: 'Damsons', quantity: 10}, {name: 'Elderberries', quantity: 30}, ]; // Create an arc generator with configuration var arcGenerator = d3.arc() .innerRadius(20) .outerRadius(100); var arcData = pieGenerator(fruits); // Create a path element and set its d attribute d3.select('g') .selectAll('path') .data(arcData) .enter() .append('path') .attr('d', arcGenerator); // Labels d3.select('g') .selectAll('text') .data(arcData) .enter() .append('text') .each(function(d) { var centroid = arcGenerator.centroid(d); d3.select(this) .attr('x', centroid[0]) .attr('y', centroid[1]) .attr('dy', '0.33em') .text(d.data.name); }); </script> </body> </html>