chart = {
let filtreData = filtre('G07Q03');
const test = d3.flatRollup(filtreData, (D) => D.length, (d) => d['G07Q03'], (d) => d['group']);
const donnee = test.map(([Reponse, Tranche, Value]) => ({Reponse, Tranche, Value}))
const donneeTriee = donnee.slice().sort((a, b) => d3.ascending(a.Reponse, b.Reponse) || d3.ascending(a.Tranche, b.Tranche))
const xy = (options) => marimekko({...options, x: 'Reponse', y: "Tranche", value: "Value"});
return Plot.plot({
width,
height: 960,
marginRight:50,
label: null,
x: {percent: true, ticks: 10, tickFormat: (d) => d === 100 ? `100%` : d},
y: {percent: true, ticks: 10, tickFormat: (d) => d === 100 ? `100%` : d},
marks: [
Plot.frame(),
Plot.rect(donneeTriee, xy({fill: "Tranche", fillOpacity: 0.5})),
Plot.text(donneeTriee, xy({text: d => ["Nombre de réponse : ", d.Value].join(" ")})),
Plot.text(donneeTriee, Plot.selectMaxX(xy({z: "Tranche", text: "Tranche", anchor: "right", textAnchor: "start", lineAnchor: "bottom", dx: 6}))),
Plot.text(donneeTriee, Plot.selectMaxY(xy({z: 'Reponse', text: 'Reponse', anchor: "top", lineAnchor: "bottom", dy: -6})))
]
});
}