Built with blockbuilder.org
Last active
July 12, 2019 23:36
-
-
Save fabiokandrade/9cb7421f7552cc9ff3f33530c36acae2 to your computer and use it in GitHub Desktop.
Agenda Cultural Lisboa
This file contains 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
license: mit |
This file contains 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
<!DOCTYPE html> | |
<head> | |
<meta charset="utf-8"> | |
<script src="https://cdnjs.cloudflare.com/ajax/libs/d3/4.2.2/d3.min.js"></script> | |
<script src="https://d3js.org/d3-array.v2.min.js"></script> | |
<style> | |
body { margin:0;position:fixed;top:0;right:0;bottom:0;left:0; } | |
svg { | |
font: 10px sans-serif; | |
} | |
.line { | |
fill: none; | |
stroke: red; | |
stroke-width: 0.5px; | |
} | |
</style> | |
</head> | |
<body> | |
<script> | |
//Margin Convention | |
var margin = {top: 20, right: 30, bottom: 20, left: 100}, | |
width = 900 - margin.left - margin.right, | |
height = 500 - margin.top - margin.bottom; | |
//Container | |
var svg = d3.select("body").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 + ")"); | |
// source: https://dados.gov.pt/pt/datasets/agenda-cultural-de-lisboa/ | |
// d3.json("https://agendalx.pt/wp-json/agendalx/v1/events/current", function(data) { | |
// console.log(data); | |
// LastDate: "2019-09-22" | |
// StartDate: "2019-07-13" | |
var grouped = Array.from(d3.group(data, d=>d.StartDate.substr(5,2) /* ,d => d.subject*/)) | |
console.log(grouped) | |
// var lineGenerator = d3.line(); | |
// var pathData = lineGenerator(points); | |
// d3.selectAll('path') | |
// .data(data) | |
// .enter() | |
// .append("path") | |
// .attr("d", function(d) { return lineGenerator(d); }) | |
}); | |
</script> | |
</body> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment