Skip to content

Instantly share code, notes, and snippets.

@levvsha
Last active February 4, 2018 13:48
Show Gist options
  • Save levvsha/defd62c6b54bdc361801de3cafc01cec to your computer and use it in GitHub Desktop.
Save levvsha/defd62c6b54bdc361801de3cafc01cec to your computer and use it in GitHub Desktop.
function draw(data) {
const margin = { top: 20, right: 20, bottom: 50, left: 50 };
const width = 920 - margin.left - margin.right;
const height = 390 - margin.top - margin.bottom;
const x = d3.scaleTime()
.range([0, width]);
const y = d3.scaleLinear()
.range([height, 0]);
const colorScale = d3.scaleOrdinal(d3.schemeCategory20);
const svg = d3.select('.chart')
.append('svg')
.attr('width', width + margin.left + margin.right)
.attr('height', height + margin.top + margin.bottom)
.append('g')
.attr('transform', `translate(${ margin.left },${ margin.top })`);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment