From 3a8c0a3c09cd4f493b01e2caf0920e1142ddd79a Mon Sep 17 00:00:00 2001 From: Radek Stepan Date: Wed, 21 Aug 2013 17:59:42 +0100 Subject: [PATCH] fix clearing of target --- src/modules/graph.coffee | 6 +++--- src/templates/graph.eco | 1 + 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/modules/graph.coffee b/src/modules/graph.coffee index 26dfbca..2124340 100644 --- a/src/modules/graph.coffee +++ b/src/modules/graph.coffee @@ -76,10 +76,10 @@ module.exports = # Render the D3 chart. 'render': ([ actual, ideal ], cb) -> - (target = document.querySelector('#graph')).innerHTML = '' + document.querySelector('#svg').innerHTML = '' # Get available space. - { height, width } = target.getBoundingClientRect() + { height, width } = document.querySelector('#graph').getBoundingClientRect() margin = { top: 30, right: 30, bottom: 40, left: 50 } width -= margin.left + margin.right @@ -115,7 +115,7 @@ module.exports = y.domain([ 0, ideal[0].points ]).nice() # Add an SVG element with the desired dimensions and margin. - svg = d3.select("#graph").append("svg") + svg = d3.select("#svg").append("svg") .attr("width", width + margin.left + margin.right) .attr("height", height + margin.top + margin.bottom) .append("g") diff --git a/src/templates/graph.eco b/src/templates/graph.eco index dd45acd..392a3b7 100644 --- a/src/templates/graph.eco +++ b/src/templates/graph.eco @@ -2,6 +2,7 @@

<%- @name %>

+
\ No newline at end of file