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
| #! /bin/sh | |
| # ------------------------------------------------------------------------------ | |
| # SOME INFOS : fairly standard (debian) init script. | |
| # Note that node doesn't create a PID file (hence --make-pidfile) | |
| # has to be run in the background (hence --background) | |
| # and NOT as root (hence --chuid) | |
| # | |
| # MORE INFOS : INIT SCRIPT http://www.debian.org/doc/debian-policy/ch-opersys.html#s-sysvinit | |
| # INIT-INFO RULES http://wiki.debian.org/LSBInitScripts | |
| # INSTALL/REMOVE http://www.debian-administration.org/articles/28 |
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
| const width = $('svg').parent().width(); | |
| const height = width / 2.4; | |
| const svg = d3.select('svg'); |
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
| svg.attr('width', width); | |
| svg.attr('height', height); | |
| const margin = { | |
| top : 20, | |
| right : 80, | |
| bottom : 30, | |
| left : 30 | |
| }; |
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
| const x = d3.scaleTime().rangeRound([0, chartWidth]); | |
| const y = d3.scaleLinear().rangeRound([chartHeight, 0]); | |
| const color = d3.scaleOrdinal(d3.schemeCategory10); | |
| const timeFormat = d3.timeParse("%Y-%m-%d"), | |
| const bisectDate = d3.bisector(d => parseTime(d.x)).left; |
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
| const color = d3.scaleOrdinal([ | |
| "#3498db", | |
| "#2ecc71", | |
| "#f1c40f", | |
| "#e74c3c", | |
| "#9b59b6", | |
| "#f39c12", | |
| "#1abc9c" | |
| ]); |
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
| const line = d3.line() | |
| .x((d) => x(d.date)) | |
| .y((d) => y(d.count)) |
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
| color.domain(d3.keys(data[0]).filter((key) => key !== 'date') |
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
| data.forEach(d => { | |
| d.date = timeFormat(d.date); | |
| }); | |
| const metrics = color.domain().map(name => {{ | |
| name : name, | |
| values : data.map(d => {{ | |
| date : d.date, | |
| count : +d[name] | |
| }} |
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
| x.domain(d3.extent(data, d => d.date)); | |
| y.domain([ | |
| d3.min(metrics, c => d3.min(c.values, v => v.count)), | |
| d3.max(metrics, c => d3.max(c.values, v => v.count)) | |
| ]); |
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
| chartContainer | |
| .append('g') | |
| .attr('class', 'x axis') | |
| .attr('transform', 'translate(0,' + height + ')') | |
| .style('storke', '#000') | |
| .call(d3.axisBottom(x)); | |
| chartContainer | |
| .append('g') | |
| .attr('class', 'y axis') |
OlderNewer