Create a scaffold from d3Kit CanvasChart.
Last active
October 17, 2016 13:51
-
-
Save kristw/2cc83b10a1677a16f6448a5108b322a1 to your computer and use it in GitHub Desktop.
Using d3Kit to scaffold <canvas>
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 characters
license: mit |
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 characters
<!DOCTYPE html> | |
<title>blockup</title> | |
<link href='style.css' rel='stylesheet' /> | |
<body> | |
<div id="chart"></div> | |
<script src="https://d3js.org/d3.v4.min.js"></script> | |
<script src="https://rawgit.com/twitter/d3kit/v3/dist/d3kit.min.js"></script> | |
<script src='main.js'></script> | |
</body> |
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 characters
var chart = new d3Kit.CanvasChart('#chart', { | |
initialWidth: 720, | |
initialHeight: 500, | |
margin: { top: 30, right: 30, bottom: 30, left: 30 } | |
}); | |
var ctx = chart.getContext2d(); | |
ctx.fillStyle = 'red'; | |
ctx.fillRect(10, 10, chart.getInnerWidth(), chart.getInnerHeight()); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment