chart_nuances2 = Plot.plot((() => {
const n = 5;
const color = {"M.":'grey', "Mme":'red'};
const this_data = data_senate_nuances.filter(d=>d.Type_candidat !=2);
[0,1,2,3,4,5,6,7,8].forEach(function (e) {
this_data.filter(d=>d.nuance_num == e).sort(function (a,b) { return a.Civ_num - b.Civ_num})
.forEach(function (d, i) {
d['id2'] = i
})
})
return {
height: 200,
axis: null,
grid:false,
marginLeft: 50,
marginBottom: 30,
marginTop: 10,
marginRight: 20,
marks: [
Plot.dot(this_data,
{x: (d) =>(d.id2 % n)/10 + d.nuance_num,
r:3,
fill:(d) => color[d.CivilitePsn],
y : (d) =>Math.floor(d.id2/n)
}),
Plot.text(partis_nuances, {x: (d) =>d[1], y:-5,text:(d) =>d[0], frameAnchor: "bottom-left", dx: -8,
fill:"black", fontSize:8}),
]
}
})())