Skip to content

Instantly share code, notes, and snippets.

@ejfox
Created June 11, 2017 21:21
Show Gist options
  • Save ejfox/1c8e1055b954f4b9bd2739c6b708995f to your computer and use it in GitHub Desktop.
Save ejfox/1c8e1055b954f4b9bd2739c6b708995f to your computer and use it in GitHub Desktop.
fs = require 'fs'
d3Node = require 'd3-node'
canvasModule = require 'canvas-prebuilt'
d3n = new d3Node { canvasModule }
canvas = d3n.createCanvas 500,500
ctx = canvas.getContext '2d'
width = canvas.width
height = canvas.height
data = [0,1,2,3,4,5]
data.forEach((d,i) ->
ctx.beginPath()
ctx.rect i*25, 150, 10, 10
ctx.fillStyle = 'red'
ctx.fill()
ctx.closePath()
)
require('../lib/output.js')('index', d3n)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment