Skip to content

Commit 99ae884

Browse files
committed
update empty graph
1 parent d079842 commit 99ae884

File tree

1 file changed

+28
-27
lines changed

1 file changed

+28
-27
lines changed

src/Graph.svelte

Lines changed: 28 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -298,33 +298,34 @@
298298
.selectAll('*')
299299
.remove();
300300
301-
// // size chart
302-
// var margin = { top: 20, right: 20, bottom: 70, left: 40 },
303-
// width = w - margin.left - margin.right,
304-
// height = 0.75 * w - margin.top - margin.bottom;
305-
306-
// // parse the date time
307-
// var parseDate = d3.timeParse('%Y%m%d');
308-
309-
// // set ranges
310-
// this.x = d3.scaleBand().rangeRound([0, width]);
311-
// this.y = d3.scaleLinear().range([height, 0]);
312-
313-
// // attach graphic
314-
// var svg = d3
315-
// .select(el)
316-
// .append('svg')
317-
// .attr('width', width + margin.left + margin.right)
318-
// .attr('height', height + margin.top + margin.bottom)
319-
// .append('g')
320-
// .attr('transform', 'translate(' + margin.left + ',' + margin.top + ')');
321-
322-
// // draw axes
323-
// svg
324-
// .append('g')
325-
// .attr('transform', 'translate(0,' + height + ')')
326-
// .call(d3.axisBottom(this.x).tickFormat(''));
327-
// svg.append('g').call(d3.axisLeft(this.y).tickFormat(''));
301+
if (w > 400) w = 400;
302+
// size chart
303+
var margin = { top: 20, right: 20, bottom: 70, left: 40 },
304+
width = w - margin.left - margin.right,
305+
height = 0.75 * w - margin.top - margin.bottom;
306+
307+
// parse the date time
308+
var parseDate = d3.timeParse('%Y%m%d');
309+
310+
// set ranges
311+
this.x = d3.scaleBand().rangeRound([0, width]);
312+
this.y = d3.scaleLinear().range([height, 0]);
313+
314+
// attach graphic
315+
var svg = d3
316+
.select(el)
317+
.append('svg')
318+
.attr('width', width + margin.left + margin.right)
319+
.attr('height', height + margin.top + margin.bottom)
320+
.append('g')
321+
.attr('transform', 'translate(' + margin.left + ',' + margin.top + ')');
322+
323+
// draw axes
324+
svg
325+
.append('g')
326+
.attr('transform', 'translate(0,' + height + ')')
327+
.call(d3.axisBottom(this.x).tickFormat(''));
328+
svg.append('g').call(d3.axisLeft(this.y).tickFormat(''));
328329
}
329330
330331
updateChart() {}

0 commit comments

Comments
 (0)