Skip to content

Instantly share code, notes, and snippets.

@lilykonings
Last active November 30, 2016 14:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lilykonings/a35687613ab0f4991f37 to your computer and use it in GitHub Desktop.
Save lilykonings/a35687613ab0f4991f37 to your computer and use it in GitHub Desktop.
[
{"title":"2000","conflicttype":0,"creationdate":2001.9386,"pageedits":2918,"description":"As there was no year zero, the millennium we are currently in started in 2001.","pagesofdiscussion":9},
{"title":"User: Jimbo Wales","conflicttype":9,"creationdate":2002.1546,"pageedits":8721,"description":"A war over the background colour of various parts of the user page","pagesofdiscussion":9},
{"title":"2006 Atlantic Hurricane Season","conflicttype":0,"creationdate":2004.9726,"pageedits":3254,"description":"Tropical Storm Zeta formed on 30 December, 2005 and lasted until 6 January, 2006. Which hurricane season does this count as?","pagesofdiscussion":9},
{"title":"Alumin(i)um","conflicttype":4,"creationdate":2001.9101,"pageedits":5462,"description":"International spelling of element and metal","pagesofdiscussion":8},
{"title":"Andre the Giant","conflicttype":6,"creationdate":2001.9715,"pageedits":3766,"description":"Was his height 7'4\" or 6'10\"? Was his height even consistent?","pagesofdiscussion":9},
{"title":"Angels & Airwaves","conflicttype":0,"creationdate":2005.7801,"pageedits":8055,"description":"Angels & Airwaves IS a band or ARE a band","pagesofdiscussion":9},
{"title":"Ann Coulter","conflicttype":6,"creationdate":2003.3416,"pageedits":10790,"description":"Was she born in 1961 or 1963? Settled at 1961.","pagesofdiscussion":12},
{"title":"Anus","conflicttype":2,"creationdate":2001.9386,"pageedits":2136,"description":"Should article use an image of a human anus?","pagesofdiscussion":5},
{"title":"Aphex Twin","conflicttype":0,"creationdate":2001.4249,"pageedits":2439,"description":"Is Aphex Twin really IDM?","pagesofdiscussion":7},
{"title":"Arachnophobia","conflicttype":2,"creationdate":2012.1886,"pageedits":640,"description":"Appropriate to include a huge picture of a spider?","pagesofdiscussion":5},
{"title":"Brazil/Brasil","conflicttype":3,"creationdate":2001.8322,"pageedits":11751,"description":"Which spelling to use?","pagesofdiscussion":6},
{"title":"Cat","conflicttype":7,"creationdate":2001.9413,"pageedits":10996,"description":"Which words describes the correct relationship between man and beast: 'owner', 'caregiver', or 'human companion'?","pagesofdiscussion":7},
{"title":"Christianity","conflicttype":5,"creationdate":2001.9550,"pageedits":15647,"description":"An argument about syntax in a sentence regarding the Church's historical definition of orthodoxy and heresy.","pagesofdiscussion":13},
{"title":"Clover (creature)","conflicttype":6,"creationdate":2008.1409,"pageedits":2155,"description":"Cloverfield, Clover, The Cloverfield creature, or Clover (creature)?","pagesofdiscussion":6},
{"title":"Cow Tipping","conflicttype":7,"creationdate":2001.8443,"pageedits":2155,"description":"Approriate to include a picture of a cow with the caption 'An unsuspecting potential victim'?","pagesofdiscussion":6},
{"title":"Cute","conflicttype":7,"creationdate":2004.9824,"pageedits":21,"description":"Is it a Neutral Point Of View to say an animal is 'cute'?","pagesofdiscussion":5},
{"title":"Daffy Duck","conflicttype":6,"creationdate":2002.4441,"pageedits":1412,"description":"Did Daffy Duck father any children?","pagesofdiscussion":5},
{"title":"Death Star","conflicttype":8,"creationdate":2001.9452,"pageedits":1856,"description":"120 km or 160 km in diameter?","pagesofdiscussion":5},
{"title":"Doctor Who (Turn Left)","conflicttype":0,"creationdate":2008.3361,"pageedits":1065,"description":"Should past companions making cameos be listed as 'companions' or 'additional/special guest stars'?","pagesofdiscussion":26},
{"title":"Europe","conflicttype":1,"creationdate":2001.9361,"pageedits":7916,"description":"Is Europe a continent or not?","pagesofdiscussion":7},
{"title":"Exploding Whale","conflicttype":9,"creationdate":2004.5548,"pageedits":1196,"description":"Is a reporter's comment, 'the blast blasted blubber beyond all believable bounds,' worthy of inclusion?","pagesofdiscussion":5},
{"title":"Feces","conflicttype":2,"creationdate":2001.8904,"pageedits":5224,"description":"Should this page include a picture of human feces?","pagesofdiscussion":10},
{"title":"Gasoline/Petrol","conflicttype":4,"creationdate":2001.8158,"pageedits":2927,"description":"International vocabulary for a fossil fuel for reciprocating piston engines equipped with spark plugs","pagesofdiscussion":7},
{"title":"Freddie Mercury","conflicttype":3,"creationdate":2002.2406,"pageedits":11439,"description":"Of Iranian, Indian, Parsi or Azeri ancestry?","pagesofdiscussion":8},
{"title":"Frederic Chopin","conflicttype":3,"creationdate":2001.6694,"pageedits":3333,"description":"Was Chopin Polish, French, Polish-French, or French-Polish?","pagesofdiscussion":80},
{"title":"Futurama","conflicttype":0,"creationdate":2003.4605,"pageedits":8731,"description":"Was protagonist Fry cryonically frozen or crygenically frozen (or even cryogenically frozen)?","pagesofdiscussion":6},
{"title":"Gay Icon","conflicttype":6,"creationdate":2004.2966,"pageedits":2282,"description":"Do Grace Kelly and Cher count as a gay icon?","pagesofdiscussion":5},
{"title":"Grand Theft Auto IV","conflicttype":3,"creationdate":2005.6078,"pageedits":11091,"description":"Is the main character Serbian, Slovak, Bosnian, or non-specifically Eastern European?","pagesofdiscussion":7},
{"title":"Gray Squirrel/Grey Squirrel","conflicttype":4,"creationdate":2003.9671,"pageedits":11091,"description":"A species native to North America invades the United Kingdom. Who decides how to spell its name?","pagesofdiscussion":5},
{"title":"'Heather' of Silent Hill 3","conflicttype":6,"creationdate":2003.9315,"pageedits":3095,"description":"What is the last name of the video game's protagonist?","pagesofdiscussion":12},
{"title":"Her Late Majesty","conflicttype":6,"creationdate":2002.3322,"pageedits":3095,"description":"Must a queen deceased for over a century still be styled 'Her Majesty', an epithet usually reserved for a current monarch?","pagesofdiscussion":5},
{"title":"House, M.D.","conflicttype":2,"creationdate":2004.9507,"pageedits":8423,"description":"Should we mention the show's lack of asian diversity?","pagesofdiscussion":6},
{"title":"Hummus","conflicttype":3,"creationdate":2002.7297,"pageedits":2076,"description":"Should hummus be in the 'Israeli cuisine' category, or is it a purely Arab food?","pagesofdiscussion":5},
{"title":"Iron Maiden","conflicttype":6,"creationdate":2002.9507,"pageedits":9388,"description":"Which is more famous, the band or the torture device?","pagesofdiscussion":9},
{"title":"J.K. Rowling","conflicttype":6,"creationdate":2001.8130,"pageedits":5950,"description":"Pronounced 'rolling' or to rhyme with 'howling'?","pagesofdiscussion":8},
{"title":"Jennifer Aniston","conflicttype":3,"creationdate":2002.2215,"pageedits":5950,"description":"American or American-born? Greek American? English-American?","pagesofdiscussion":7},
{"title":"Jesus","conflicttype":5,"creationdate":2001.2562,"pageedits":21864,"description":"A very long dispute over whether to use BC or AD","pagesofdiscussion":16},
{"title":"Jimmy Wales","conflicttype":9,"creationdate":2003.5521,"pageedits":8628,"description":"The Wikipedia founder edited his own birthdate","pagesofdiscussion":8},
{"title":"John Kerry","conflicttype":6,"creationdate":2003.1053,"pageedits":12629,"description":"Was his Purple Heart awarded for a 'wound' or a 'minor wound'? Was it 'bandaged' or just 'wrapped with gauze'?","pagesofdiscussion":13},
{"title":"John Logie Baird","conflicttype":3,"creationdate":2002.2352,"pageedits":1122,"description":"Can you be both Scottish and British?","pagesofdiscussion":8},
{"title":"Kiev/Kyiv","conflicttype":3,"creationdate":2002.2324,"pageedits":3026,"description":"This spelling battle involved both Russian and Ukrainian governments.","pagesofdiscussion":7},
{"title":"Limp Bizkit","conflicttype":0,"creationdate":2002.1244,"pageedits":6372,"description":"Are the band 'nu metal/rapcore' or 'rapcore/nu metal'?","pagesofdiscussion":7},
{"title":"Lucky Charms","conflicttype":6,"creationdate":2002.7747,"pageedits":1304,"description":"Are they or aren't they sold in Ireland?","pagesofdiscussion":5},
{"title":"Mayonnaise","conflicttype":6,"creationdate":2002.6190,"pageedits":1984,"description":"Does traditional Mayonnaise contain lemon juice or not?","pagesofdiscussion":5},
{"title":"Micronations","conflicttype":1,"creationdate":2001.9073,"pageedits":3196,"description":"Two self-proclaimed leaders of micronations in a lengthy revert war in this and other articles about the comparative value and notability of their countries.","pagesofdiscussion":8},
{"title":"Milla Jovovich","conflicttype":3,"creationdate":2002.9671,"pageedits":2680,"description":"Serbian/Montenegran or just Serbian?","pagesofdiscussion":1},
{"title":"Money (Pink Floyd Song)","conflicttype":6,"creationdate":2004.4128,"pageedits":573,"description":"Is the song's time signature 7/8, 7/4 or even 21/8?","pagesofdiscussion":10},
{"title":"Nikola Tesla","conflicttype":3,"creationdate":2001.8416,"pageedits":7449,"description":"Born of Serbian parents in Austrian Empire, which became a part of the Hungarian half of Austria-Hungary and is now in Croatia.","pagesofdiscussion":7},
{"title":"Palin","conflicttype":6,"creationdate":2003.8130,"pageedits":289,"description":"Is the politician more famous than the Monty Python member?","pagesofdiscussion":35},
{"title":"Pluto","conflicttype":0,"creationdate":2001.9304,"pageedits":7067,"description":"Should the once-planet be accurately renamed 134340 Pluto, or keep its traditional, simpler name?","pagesofdiscussion":7},
{"title":"Potato Chip","conflicttype":4,"creationdate":2001.9425,"pageedits":2268,"description":"Are they 'flavored' or 'flavoured'? Compromise solution with 'seasoned'.","pagesofdiscussion":5},
{"title":"Preteen","conflicttype":6,"creationdate":2003.3240,"pageedits":544,"description":"Are they 8-12 years old? 9-12? 10-12? 8-13? Even 17 years old?","pagesofdiscussion":5},
{"title":"Pwned","conflicttype":6,"creationdate":2004.2801,"pageedits":26,"description":"What does it mean? Who invented it? How do you pronounce it?","pagesofdiscussion":6},
{"title":"Spore (video game)","conflicttype":0,"creationdate":2005.4578,"pageedits":7422,"description":"Is it a life simulation, a strategy game, a god game, or a sandbox game?","pagesofdiscussion":7},
{"title":"St Pancras/St Pancras International","conflicttype":0,"creationdate":2003.7610,"pageedits":1691,"description":"Should the article use the everyday 'St Pancras' or the (mostly) official 'St Pancras International'? Does the 'St' need a full stop?","pagesofdiscussion":5},
{"title":"Star Wars Episode III: Revenge of the Sith","conflicttype":8,"creationdate":2002.5219,"pageedits":7158,"description":"Are Anakin Skywalker and Darth Vader considered one character or two separate ones? Should the credit list duplicate the official credits at the end of the film, or be edited to include uncredited roles?","pagesofdiscussion":10},
{"title":"Star Wars Episode IV: A New Hope","conflicttype":8,"creationdate":2002.4715,"pageedits":2088,"description":"Is Star Wars Episode III the 'preceding film'? The events depicted occur chronologically earlier, but the film itself was made 30 years later.","pagesofdiscussion":8},
{"title":"Star Wars Episode V: The Empire Strikes Back","conflicttype":8,"creationdate":2002.4934,"pageedits":3623,"description":"Should Ian McDiarmid be included in the credits for his role in the Special Edition version?","pagesofdiscussion":8},
{"title":" List of Street Fighter Characters","conflicttype":6,"creationdate":2004.7461,"pageedits":2147,"description":"What are the correct heights and weights of the characters in Street Fighter? Solved by removing the statistics.","pagesofdiscussion":9},
{"title":"Sulfur/Sulphur","conflicttype":4,"creationdate":2001.6655,"pageedits":3950,"description":"International spelling of this element.","pagesofdiscussion":7},
{"title":"The Beatles","conflicttype":6,"creationdate":2001.8212,"pageedits":17608,"description":"Should they be listed in traditional order or alphabetically? Is it 'The Beatles' or 'the Beatles'?","pagesofdiscussion":7},
{"title":"Tiger","conflicttype":7,"creationdate":2001.8607,"pageedits":5303,"description":"The 'most powerful living cat'?","pagesofdiscussion":5},
{"title":"U2","conflicttype":6,"creationdate":2002.4742,"pageedits":10367,"description":"Are Bono's harmonica skills relevant?","pagesofdiscussion":9},
{"title":"United States Presidential Election, 2008","conflicttype":1,"creationdate":2003.9644,"pageedits":14957,"description":"Is Stephen Colbert considered a serious candidate? If so, was it Stephen Colbert (comedian) or Stephen Colbert (character)?","pagesofdiscussion":9},
{"title":"Werner Herzog","conflicttype":3,"creationdate":2001.4523,"pageedits":1156,"description":"Born in Germany, supposedly of a German mother and a Yugoslavian father, and raised in Bavaria, Germany. Does that make Herzog: a) Croatian or b) Serbian? How about the fact that the relatives live in Bosnia-Herzegovina?","pagesofdiscussion":13},
{"title":"Wii","conflicttype":6,"creationdate":2004.0970,"pageedits":20077,"description":"'Wii,' 'Nintendo Wii' or 'the Wii'? Should 'wee' link here or to the article on urine?","pagesofdiscussion":15},
{"title":"Wikipedia","conflicttype":9,"creationdate":2001.9331,"pageedits":29041,"description":"Is Jimmy Wales the founder or a co-founder with Larry Sanger?","pagesofdiscussion":18},
{"title":"Wrestlemania III","conflicttype":0,"creationdate":2004.7023,"pageedits":974,"description":"Was the event attended by 78,000 or 93,178 people?","pagesofdiscussion":9},
{"title":"Yoghurt/Yogurt","conflicttype":4,"creationdate":2002,"pageedits":3135.0301,"description":"International spelling of this food product.","pagesofdiscussion":6}
]
<!DOCTYPE html>
<style>
body {
font-family: 'Open Sans', sans-serif;
font-size: 12px;
}
.graph {
text-align: center;
}
svg {
background-color: #333947;
}
.title {
font-size: 16px;
font-weight: bold;
fill: #fff;
}
.caption {
fill: #ccc;
}
.axis path,
.axis line {
fill: none;
stroke: #eee;
shape-rendering: crispEdges;
}
.axis text {
fill: #fff;
}
.loading {
font-size: 15px;
}
.plot {
fill-opacity: 0.75;
}
.conflict0 { fill: #4990BF; }
.conflict1 { fill: #FF6363; }
.conflict2 { fill: #738b8c; }
.conflict3 { fill: #BC63FF; }
.conflict4 { fill: #EFFF63; }
.conflict5 { fill: #FF3D3D; }
.conflict6 { fill: #496EBF; }
.conflict7 { fill: #cda2a2; }
.conflict8 { fill: #E563FF; }
.conflict9 { fill: #63D8FF; }
.circle {
cursor: pointer;
opacity: 0.5;
}
.circle:hover {
stroke: #000;
stroke-width: 2px;
}
.title-tip,
.body-tip {
line-height: 1;
padding: 12px;
background: #000;
color: #fff;
line-height: 14px;
border-radius: 2px;
pointer-events: none;
text-align: center;
}
.body-tip {
max-width: 250px;
}
.title-tip div {
font-size: 10px;
color: #ccc;
}
/* Creates a small triangle extender for the tooltip */
.title-tip:after {
box-sizing: border-box;
display: inline;
font-size: 10px;
width: 100%;
line-height: 1;
color: #000;
position: absolute;
pointer-events: none;
}
.title-tip.n:after {
content: "\25BC";
margin: -1px 0 0 0;
top: 100%;
left: 0;
text-align: center;
}
.button {
height: 25px;
width: 125px;
stroke: #ccc;
stroke-width: 2px;
fill: #333947;
}
.button:hover,
.button-text:hover {
cursor: pointer;
}
.button-active {
stroke: #fff;
fill: #fff;
}
.button-text {
fill: #ccc;
}
.button-text-active {
fill: #000;
}
</style>
<div id="graph" class="graph"></div>
<script src="http://d3js.org/d3.v2.min.js"></script>
<script src="http://labratrevenge.com/d3-tip/javascripts/d3.tip.v0.6.3.js"></script>
<script>
var w = 1500;
var h = 800;
var pad = 40;
var above = 125;
var left = 225;
var titleTip = d3.tip()
.attr('class', 'title-tip')
.offset([-3, 0])
.html(function(d) {
return "<strong>" + d.title + "</strong><div>" + d.pageedits + " page edits</div>";
});
var bodyTip = d3.tip()
.attr('class', 'body-tip')
.html(function(d) { return d.description; });
var svg = d3.select("#graph")
.append("svg")
.attr("width", w)
.attr("height", h)
.call(titleTip)
.call(bodyTip);
var x = d3.scale.linear().domain([2001, 2006]).range([left, w-pad]);
var y = d3.scale.linear().domain([0, 9]).range([above, h-pad-above]);
var xAxis = d3.svg.axis().scale(x).orient("bottom")
.ticks(6)
.tickFormat(d3.format("d"))
var yAxis = d3.svg.axis().scale(y).orient("left")
.ticks(10)
.tickFormat(function (d, i) {
return ['Technicality','Political','Ethical','Ethnic','International Words','Religion','Culture','Animal Rights','Star Wars','Other'][d];
});
svg.append("text")
.attr("class", "title")
.attr("x", w/2)
.attr("y", above/3)
.attr("text-anchor", "middle")
.text("Most Debated Wikipedia Articles (2010)");
svg.append("text")
.attr("class", "caption")
.attr("x", w/2)
.attr("y", above/3+18)
.attr("text-anchor", "middle")
.text("Click each circle to read more!");
svg.append("g")
.attr("class", "axis")
.attr("transform", "translate(0, "+(h-pad)+")")
.call(xAxis);
svg.append("g")
.attr("class", "axis")
.attr("transform", "translate("+(left-pad)+", 0)")
.call(yAxis);
svg.append("text")
.attr("class", "loading")
.text("Loading...")
.attr("x", function () { return w/2; })
.attr("y", function () { return h/2-5; });
d3.json("data.json", function (data) {
var max_r = d3.max(data.map(function (d) { return d.pageedits; }));
var r1 = d3.scale.linear()
.domain([0, d3.max(data, function (d) { return d.pageedits; })])
.range([3, 100]);
var r2 = d3.scale.linear()
.domain([0, d3.max(data, function (d) { return d.pagesofdiscussion; })])
.range([3, 100]);
var displayCircles = function(flag) {
data.sort(function(a,b) {
var i,j;
if (flag == 0) {
i = a.pageedits;
j = b.pageedits;
} else {
i = a.pagesofdiscussion;
j = b.pagesofdiscussion;
}
if (i > j)
return -1;
if (i < j)
return 1;
return 0;
});
svg.selectAll("circle").remove();
svg.selectAll("circle")
.data(data)
.enter()
.append("circle")
.attr("class", function (d) { return "circle conflict"+d.conflicttype; })
.attr("cx", function (d) { return x(d.creationdate); })
.attr("cy", function (d) { return y(d.conflicttype); })
.on('mouseover', titleTip.show)
.on('mouseout', function(d) {
titleTip.hide();
bodyTip.hide(d);
})
.on('click', function (d) {
titleTip.hide();
bodyTip.show(d);
})
.transition()
.duration(800)
.attr("r", function (d) {
if (flag == 0) {
return r1(d.pageedits);
} else {
return r2(d.pagesofdiscussion);
}
});
titleTip.html(function(d) {
if (flag == 0) {
return "<strong>" + d.title + "</strong><div>" + d.pageedits + " page edits</div>";
} else {
return "<strong>" + d.title + "</strong><div>" + d.pagesofdiscussion + " pages of discussion</div>";
}
});
}
var toggleButton = function (flag) {
if (flag == 0) {
button1.attr("class", "button button-active");
button2.attr("class", "button");
buttonText1.attr("class", "button-text button-text-active");
buttonText2.attr("class", "button-text");
} else {
button1.attr("class", "button");
button2.attr("class", "button button-active");
buttonText1.attr("class", "button-text");
buttonText2.attr("class", "button-text button-text-active");
}
}
svg.selectAll(".loading").remove();
displayCircles(0);
var button1 = svg.append("rect")
.attr("class", "button button-active")
.attr("height", 25)
.attr("width", 125)
.attr("x", left/2)
.attr("y", above/2)
.attr("rx", 5)
.attr("ry", 5)
.on("click", function() {
toggleButton(0);
return displayCircles(0);
});
var buttonText1 = svg.append("text")
.attr("class", "button-text button-text-active")
.attr("x", left/2 + 63)
.attr("y", above/2 + 16)
.attr("text-anchor", "middle")
.text("Page Edits")
.on("click", function() {
toggleButton(0);
return displayCircles(0);
});
var button2 = svg.append("rect")
.attr("class", "button")
.attr("height", 25)
.attr("width", 125)
.attr("x", left/2+125)
.attr("y", above/2)
.attr("rx", 5)
.attr("ry", 5)
.on("click", function() {
toggleButton(1);
return displayCircles(1);
});
var buttonText2 = svg.append("text")
.attr("class", "button-text")
.attr("x", left/2 + 188)
.attr("y", above/2 + 16)
.attr("text-anchor", "middle")
.text("Pages of Discussion")
.on("click", function() {
toggleButton(1);
return displayCircles(1);
});
});
</script>
@lieonjebadurai
Copy link

Mam, Can u explain what you doing this project..??

@lilykonings
Copy link
Author

^ apologies for being massively late: http://bl.ocks.org/lllychen/a35687613ab0f4991f37

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment