(function() {
  let data = [{party:'ANO',color:'330066',mandate:'72'},{party:'SPOLU',color:'8497B0',mandate:'71'},{party:'Piráti+STAN',color:'555555',mandate:'37'},{party:'SPD',color:'993344',mandate:'20'}];
  d3.select('#rects')
    .append('ul')
    .style('list-style-type', 'none')
    .selectAll('.rect')
    .data(data)
    .enter()
    .append('li')
    .style('background', 'none')
    .style('display', 'inline')
    .append('div')
    .style('display', 'inline-block')
    .style('margin', '5px')
    .style('height', '25px')
    .append('svg')
    .attr('class', 'svgRect')
    .attr('height', 16)
    .attr('width', 170)
    .append('rect')
    .attr('class', 'rect')
    .attr('fill', function (d) { return '#' + d.color; })
    .attr('stroke', '#000')
    .attr('stroke-width', .5)
    .attr('x', 1)
    .attr('y', 1)
    .attr('height', 14)
    .attr('width', 15)
    .select(function () { return this.parentNode })
    .append('text')
    .attr('x', 25)
    .attr('y', 15)
    .text(function (d) { return d.party + ': ' + d.mandate });
})();
