actors.csv
id,name,abbreviation,color,gain
1,Občanská demokratická strana,ODS,#004494,0.1123
2,Řád národa - Vlastenecká unie,ŘN-VU,#2b468b,0.0017
3,Cesta odpovědné společnosti,CESTA,#ab2324,0.0007
4,Česká strana sociálně demokratická,ČSSD,#F07D00,0.0727
5,Volte Pravý Blok www.cibulka.net,PB,#888888,0
6,Radostné Česko,RČ,#51ecf2,0.0007
7,Starostové a nezávislí,STAN,#5d8c00,0.0518
8,Komunistická strana Čech a Moravy,KSČM,#8c0000,0.0776
9,Strana zelených,Zelení,#06b15d,0.0146
10,ROZUMNÍ – stop migraci a diktátu EU,Rozumní,#6fb7c5,0.0072
11,Společnost proti developerské výstavbě v Prokopském údolí,SPDVPÚ,#676767,0
12,Strana svobodných občanů,Svobodní,#009982,0.0156
13,Blok proti islamizaci - Obrana domova,BPI,#e30613,0.001
14,Občanská demokratická aliance,ODA,#002d72,0.0015
15,Česká pirátská strana,Piráti,#000000,0.1079
16,Občané 2011,Občané 2011,#CBD4FF,0
17,"Unie hrdosti, aktivity, vlastenectví, empatie a lidskosti 2017",HAVEL,#777777,0
18,Česká národní fronta,ČNF,#F8F8F8,0
19,Referendum o Evropské unii,REU,#034ea2,0.0008
20,TOP 09,TOP 09,#723769,0.0531
21,ANO 2011,ANO,#261060,0.2964
22,Dobrá volba 2016,DV 2016,#d60a1e,0.0007
23,Sdružení pro republiku - Republikánská strana Československa Miroslava Sládka,SPR-RSČ,#ed1f24,0.0019
24,Křesťansko-demokratická unie - Československá strana lidová,KDU-ČSL,#e6ac21,0.058
25,Česká strana národně sociální,ČSNS,#ffd132,0
26,Realisté,Realisté,#013888,0.0071
27,Sportovci pro společnost,SPS,#999999,0.002
28,Dělnická strana sociální spravedlnosti,DSSS,#183F7C,0.002
29,Svoboda a přímá demokracie - Tomio Okamura,SPD,#0066a5,0.1064
30,Strana práv občanů,SPO,#115787,0.0036
31,Národ Sobě,NáS,#e8e5ce,0
cssd.svg
<svg width="930" height="400">
<g transform="translate(10,10)">
<rect width="182" height="158.54860350066403" x="364" y="93.45297097694069" fill="#f1953e"></rect>
<text x="455" y="172.7272727272727" dy="0" text-anchor="middle" fill="white" font-size="40px">ČSSD</text>
<text x="455" y="196.50956325237232" dy="0" text-anchor="middle" fill="white" font-size="20px">368,347</text>
<rect width="127.4" height="156.84322903835096" x="573.3" y="-5.268486660833162" fill="#f1953e"></rect>
<rect width="127.4" height="112.21510309146976" x="573.3" y="166.5747423775178" fill="#f1953e"></rect>
<rect width="127.4" height="30.08595628276032" x="573.3" y="293.78984546898755" fill="#f1953e"></rect>
<rect width="127.4" height="11.847230363630672" x="573.3" y="338.8758017517479" fill="#f1953e"></rect>
<path d="M700.518,-5.268486660833162L718.9,73.15312785834232L700.518,151.5747423775178L700.518,-5.268486660833162L700.518,0L700.518,0L718.9,0L700.518,0Z" fill="#f1953e"></path>
<path d="M700.518,166.5747423775178L718.9,222.68229392325267L700.518,278.78984546898755L700.518,166.5747423775178L700.518,0L700.518,0L718.9,0L700.518,0Z" fill="#f1953e"></path>
<path d="M700.518,293.78984546898755L718.9,308.8328236103677L700.518,323.8758017517479L700.518,293.78984546898755L700.518,0L700.518,0L718.9,0L700.518,0Z" fill="#f1953e"></path>
<path d="M700.518,338.8758017517479L718.9,344.7994169335632L700.518,350.72303211537854L700.518,338.8758017517479L700.518,0L700.518,0L718.9,0L700.518,0Z" fill="#f1953e"></path>
<text x="637" y="84.77114482414609" text-anchor="middle" fill="white" font-size="34.85405089741132">360,000</text>
<text x="637" y="230.99452378188005" text-anchor="middle" fill="white" font-size="24.93668957588217">260,000</text>
<text x="637" y="315.4994902770344" text-anchor="middle" fill="white" font-size="18">70,000</text>
<text x="637" y="351.46608360022987" text-anchor="middle" fill="white" font-size="18">30,000</text>
<rect width="127.4" height="21.355919724296513" x="191.1" y="148.94787657907924" fill="#888"></rect>
<rect width="127.4" height="11.2028725720904" x="191.1" y="185.30379630337575" fill="#8c0000"></rect>
<path d="M318.045,148.94787657907924L336.7,159.62583644122748L318.045,170.30379630337575L318.045,148.94787657907924L318.045,0L318.045,0L336.7,0L318.045,0Z" fill="#888"></path>
<path d="M318.045,185.30379630337575L336.7,190.90523258942096L318.045,196.50666887546615L318.045,185.30379630337575L318.045,0L318.045,0L336.7,0L318.045,0Z" fill="#8c0000"></path>
<text x="254.8" y="166.29250310789413" text-anchor="middle" fill="white" font-size="20">50,000</text>
<text x="254.8" y="197.57189925608762" text-anchor="middle" fill="white" font-size="20">30,000</text>
<rect width="145.6" height="156.84322903835096" x="764.4" y="-5.268486660833162" fill="#261060"></rect>
<rect width="145.6" height="112.21510309146976" x="764.4" y="166.5747423775178" fill="#888"></rect>
<rect width="145.6" height="30.08595628276032" x="764.4" y="293.78984546898755" fill="#0066a5"></rect>
<rect width="145.6" height="11.847230363630672" x="764.4" y="338.8758017517479" fill="#8c0000"></rect>
<text x="837.2" y="86.22339694487157" text-anchor="middle" fill="white" font-size="39.21080725958774">ANO</text>
<text x="837.2" y="232.03355251420848" text-anchor="middle" fill="white" font-size="28.053775772867443">nevoliči</text>
<text x="837.2" y="315.4994902770344" text-anchor="middle" fill="white" font-size="20">SPD</text>
<text x="837.2" y="351.46608360022987" text-anchor="middle" fill="white" font-size="20">KSČM</text>
<rect width="145.6" height="21.355919724296513" x="0" y="148.94787657907924" fill="#888"></rect>
<rect width="145.6" height="11.2028725720904" x="0" y="185.30379630337575" fill="#8c0000"></rect>
<text x="72.8" y="166.29250310789413" text-anchor="middle" fill="white" font-size="20">nevoliči</text>
<text x="72.8" y="197.57189925608762" text-anchor="middle" fill="white" font-size="20">KSČM</text>
</g>
</svg>
d3.tip.js
(function (root, factory) {
if (typeof define === 'function' && define.amd) {
define(['d3'], factory)
} else if (typeof module === 'object' && module.exports) {
module.exports = function(d3) {
d3.tip = factory(d3)
return d3.tip
}
} else {
root.d3.tip = factory(root.d3)
}
}(this, function (d3) {
return function() {
var direction = d3_tip_direction,
offset = d3_tip_offset,
html = d3_tip_html,
node = initNode(),
svg = null,
point = null,
target = null
function tip(vis) {
svg = getSVGNode(vis)
point = svg.createSVGPoint()
document.body.appendChild(node)
}
tip.show = function() {
var args = Array.prototype.slice.call(arguments)
if(args[args.length - 1] instanceof SVGElement) target = args.pop()
var content = html.apply(this, args),
poffset = offset.apply(this, args),
dir = direction.apply(this, args),
nodel = getNodeEl(),
i = directions.length,
coords,
scrollTop = document.documentElement.scrollTop || document.body.scrollTop,
scrollLeft = document.documentElement.scrollLeft || document.body.scrollLeft
nodel.html(content)
.style({ opacity: 1, 'pointer-events': 'all' })
while(i--) nodel.classed(directions[i], false)
coords = direction_callbacks.get(dir).apply(this)
nodel.classed(dir, true).style({
top: (coords.top + poffset[0]) + scrollTop + 'px',
left: (coords.left + poffset[1]) + scrollLeft + 'px'
})
return tip
}
tip.hide = function() {
var nodel = getNodeEl()
nodel.style({ opacity: 0, 'pointer-events': 'none' })
return tip
}
tip.attr = function(n, v) {
if (arguments.length < 2 && typeof n === 'string') {
return getNodeEl().attr(n)
} else {
var args = Array.prototype.slice.call(arguments)
d3.selection.prototype.attr.apply(getNodeEl(), args)
}
return tip
}
tip.style = function(n, v) {
if (arguments.length < 2 && typeof n === 'string') {
return getNodeEl().style(n)
} else {
var args = Array.prototype.slice.call(arguments)
d3.selection.prototype.style.apply(getNodeEl(), args)
}
return tip
}
tip.direction = function(v) {
if (!arguments.length) return direction
direction = v == null ? v : d3.functor(v)
return tip
}
tip.offset = function(v) {
if (!arguments.length) return offset
offset = v == null ? v : d3.functor(v)
return tip
}
tip.html = function(v) {
if (!arguments.length) return html
html = v == null ? v : d3.functor(v)
return tip
}
tip.destroy = function() {
if(node) {
getNodeEl().remove();
node = null;
}
return tip;
}
function d3_tip_direction() { return 'n' }
function d3_tip_offset() { return [0, 0] }
function d3_tip_html() { return ' ' }
var direction_callbacks = d3.map({
n: direction_n,
s: direction_s,
e: direction_e,
w: direction_w,
nw: direction_nw,
ne: direction_ne,
sw: direction_sw,
se: direction_se
}),
directions = direction_callbacks.keys()
function direction_n() {
var bbox = getScreenBBox()
return {
top: bbox.n.y - node.offsetHeight,
left: bbox.n.x - node.offsetWidth / 2
}
}
function direction_s() {
var bbox = getScreenBBox()
return {
top: bbox.s.y,
left: bbox.s.x - node.offsetWidth / 2
}
}
function direction_e() {
var bbox = getScreenBBox()
return {
top: bbox.e.y - node.offsetHeight / 2,
left: bbox.e.x
}
}
function direction_w() {
var bbox = getScreenBBox()
return {
top: bbox.w.y - node.offsetHeight / 2,
left: bbox.w.x - node.offsetWidth
}
}
function direction_nw() {
var bbox = getScreenBBox()
return {
top: bbox.nw.y - node.offsetHeight,
left: bbox.nw.x - node.offsetWidth
}
}
function direction_ne() {
var bbox = getScreenBBox()
return {
top: bbox.ne.y - node.offsetHeight,
left: bbox.ne.x
}
}
function direction_sw() {
var bbox = getScreenBBox()
return {
top: bbox.sw.y,
left: bbox.sw.x - node.offsetWidth
}
}
function direction_se() {
var bbox = getScreenBBox()
return {
top: bbox.se.y,
left: bbox.e.x
}
}
function initNode() {
var node = d3.select(document.createElement('div'))
node.style({
position: 'absolute',
top: 0,
opacity: 0,
'pointer-events': 'none',
'box-sizing': 'border-box'
})
return node.node()
}
function getSVGNode(el) {
el = el.node()
if(el.tagName.toLowerCase() === 'svg')
return el
return el.ownerSVGElement
}
function getNodeEl() {
if(node === null) {
node = initNode();
document.body.appendChild(node);
};
return d3.select(node);
}
function getScreenBBox() {
var targetel = target || d3.event.target;
while ('undefined' === typeof targetel.getScreenCTM && 'undefined' === targetel.parentNode) {
targetel = targetel.parentNode;
}
var bbox = {},
matrix = targetel.getScreenCTM(),
tbbox = targetel.getBBox(),
width = tbbox.width,
height = tbbox.height,
x = tbbox.x,
y = tbbox.y
point.x = x
point.y = y
bbox.nw = point.matrixTransform(matrix)
point.x += width
bbox.ne = point.matrixTransform(matrix)
point.y += height
bbox.se = point.matrixTransform(matrix)
point.x -= width
bbox.sw = point.matrixTransform(matrix)
point.y -= height / 2
bbox.w = point.matrixTransform(matrix)
point.x += width
bbox.e = point.matrixTransform(matrix)
point.x -= width / 2
point.y -= height / 2
bbox.n = point.matrixTransform(matrix)
point.y += height
bbox.s = point.matrixTransform(matrix)
return bbox
}
return tip
};
}));