Built with blockbuilder.org
Last active
December 7, 2016 20:36
-
-
Save steltenpower/1461659177ed2408665213410676ba0a to your computer and use it in GitHub Desktop.
nanda
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> | |
<html lang="en"> | |
<head> | |
<meta charset="utf-8"> | |
<title>TopTalent</title> | |
<script type="text/javascript" src="https://d3js.org/d3.v3.min.js"></script> | |
<style type="text/css"> | |
/* No style rules here yet */ | |
</style> | |
</head> | |
<body> | |
<script type="text/javascript"> | |
//=CONCATENATE("{land:'",E3,"',clusterVoorOpl:'",G3,"',geslacht:'",H3,"',academie:'",I3,"',studie:'",J3,"',TTprog:'",K3,"',startDate:'",DAY(V3),"/",MONTH(V3),"/",YEAR(V3),"',endDate:'",IF(W3="","",CONCATENATE(DAY(W3),"/",MONTH(W3),"/",YEAR(W3))),"',stopReason:'",REPT("early dropout",Z3),REPT("programma te zwaar",AA3),REPT("programma voldoet niet",AB3),REPT("positieve reden",AC3),REPT("eindstreepProbleem",AD3),REPT("onbekend",AE3),"'},") | |
/* | |
* Start HP (d-m-yyyy) ==> (x1=date1,y1=0,width=count1) | |
* Einde HP, (d-m-yyyy or ""=busy=today) (x2=date2,y2=(date2-date1)InYears,color=flunked/finished/busy OR flunk1/.../flunk6 | |
**reden einde: afgestudeerd, of uitvalcategorie (1 in de enige gekozen categorie) | |
earlyDropout / teZwaarProgramma / programmaVoldoetNiet / positieveReden / eindstreepProbleem / onbekend | |
How do we count? | |
For every date1,date2,color combination count, meaning every date1,count1 combination splits over count2 | |
*/ | |
var dataset = [{land:'Nederland',clusterVoorOpl:'HAVO',geslacht:'v',academie:'ACT',studie:'Technische Commerciële Textielkunde',TTprog:'Innovation and Business Creation',startDate:'1/9/2014',endDate:'',stopReason:''}, | |
{land:'Nederland',clusterVoorOpl:'VWO',geslacht:'m',academie:'HBS',studie:'Hoger Toeristisch & Recreatief Onderwijs',TTprog:'Innovation and Business Creation',startDate:'1/9/2014',endDate:'',stopReason:''}, | |
{land:'Nederland',clusterVoorOpl:'HAVO',geslacht:'m',academie:'MIM',studie:'Commerciële Economie',TTprog:'Innovation and Business Creation',startDate:'1/9/2014',endDate:'',stopReason:''}, | |
{land:'Nederland',clusterVoorOpl:'HAVO',geslacht:'m',academie:'BBT',studie:'Technische Bedrijfskunde',TTprog:'Innovation and Business Creation',startDate:'1/9/2014',endDate:'1/2/2015',stopReason:'programma voldoet niet'}]; | |
//Create SVG element | |
var svg = d3.select("body") | |
.append("svg") | |
.attr("width", 960) | |
.attr("height", 540); | |
var format=d3.time.format("%-d/%-m/%Y"); | |
var scaleX=d3.time.scale().domain([new Date(2010,0,1),new Date(2020,0,1)]).range([0,960]); | |
var scaleY=d3.time.scale().domain([0,6*d3.time.year]).range([0,540]); | |
var lines = svg.selectAll("line") | |
.data(dataset) | |
.enter() | |
.append("line"); | |
lines.attr("x1", function(d, i) { | |
var x1tmp=format.parse(d.startDate); | |
console.log("x1tmp="+x1tmp); | |
var x1ret=scaleX(x1tmp); | |
console.log("x1ret="+x1ret); | |
return x1ret; | |
}) | |
.attr("x2", function (d){ | |
var ED; | |
if (d.endDate==="") ED=new Date(); | |
else ED=d.endDate; | |
console.log(ED); | |
var x2tmp=format.parse(ED); | |
console.log("x2tmp="+x2tmp); | |
var x2ret=scaleX(x2tmp); | |
console.log("x2ret="+x2ret); | |
return x2ret; | |
}) | |
.attr("y1", scaleY(0)) | |
.attr("y2", function(d) { | |
return scaleY(format.parse(d.endDate)-format.parse(d.startDate)); | |
}); | |
</script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment