It seems that Chrome finally found a way to let us convert from svg to canvas to png without the tainted canvas security feature/bug.
This file contains 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 characters
// If you have data like this | |
const dataExample = { | |
charts: [ | |
{ | |
id: "chart1", | |
something1: { | |
something2: 1 | |
}, | |
something3: { | |
histogram: [1, 2, 3] |
This file contains 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 characters
<html> | |
<head> | |
<meta charset="utf-8"> | |
<link rel="stylesheet" href="./mapd3.min.css"> | |
<style> | |
.chart1 { | |
margin-top: 80px; | |
margin-left: 40px; | |
} | |
.mapd3 { |
This file contains 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 characters
<html> | |
<head> | |
<script src="https://cdnjs.cloudflare.com/ajax/libs/d3/5.7.0/d3.min.js"></script> | |
</head> | |
<body> | |
<div id="display"></div> | |
<script> | |
var start = ['peu', 'prou', 'fil', 'né', 'che', 'mir', 'tré', | |
'cor', 'fèri', 'mol', 'fente', 'chon', 'plume', 'mériè', | |
'mis', 'motte', 'saint-', 'bi', 'glu']; |
This file contains 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 characters
<head> | |
<script src="//unpkg.com/force-graph"></script> | |
<style> | |
body { | |
margin: 0; | |
padding: 0; | |
background: #1e1e1e; | |
} | |
</style> | |
</head> |
This file contains 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 characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="utf-8"> | |
<title></title> | |
<script type="text/javascript" src="http://d3js.org/d3.v3.min.js"></script> | |
<style type="text/css"> | |
</style> | |
</head> |
Built with blockbuilder.org
This file contains 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 characters
<!DOCTYPE html> | |
<html > | |
<head> | |
<script type="text/javascript" src="http://mbostock.github.com/d3/d3.js"></script> | |
</head> | |
<body> | |
<div class="example_div"></div> | |
<script type="text/javascript"> | |
var tooltip = d3.select("body") | |
.append("div") |
Parse and append an HTML or SVG string. I use it a lot for appending a template, instead of generating it with d3.
d3.select('.container').appendHTML('<div><svg><g><rect width="50" height="50" /></g></svg></div>');
Unlike using .html, .appendHTML can append multiple elements
d3.select('.container').html('<span id="a"></span>');
d3.select('.container').html('<span id="b"></span>'); // will replace content
d3.select('.container').appendHTML('<span id="c"></span>'); // will append content
This file contains 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 characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="utf-8"> | |
<script type="text/javascript" src="https://d3js.org/d3.v3.min.js"></script> | |
<script type="text/javascript" src="./tooltip.js"></script> | |
</head> | |
<body> | |
<div class="viz"></div> | |
<script type="text/javascript"> |
NewerOlder