text: const barHorizontal=()=>{const t=24,a=24,n=24,r=120;let e=0,o=0;const c=d3.select(".chart-lluvia-bar-horizontal"),s=c.select("svg"),l={};let i;const d=i=>{const d=c.node().offsetWidth;h=20*i.length,e=d-r-a,o=h-t-n,s.attr("width",d).attr("height",h);const x="translate("+r+","+t+")",g=s.select(".chart-lluvia-bar-horizontal-container");g.attr("transform",x),((t,a)=>{l.count.x.range([0,t]),l.count.y.range([a,0])})(e,o);const m=c.select(".area-container-chart-horizontal").selectAll(".bar-horizontal").data(i),b=m.enter().append("rect").attr("class","bar-horizontal bar-bgc5");m.merge(b).attr("x",0).attr("y",t=>l.count.y(t.nombre)).attr("height",o/i.length-5).attr("width",t=>l.count.x(t.renta)),(t=>{const a=d3.axisBottom(l.count.x).tickFormat(d3.format("d")).ticks(5).tickSize(-o);t.select(".axis-x").attr("transform","translate(0,"+o+")").call(a);const n=d3.axisLeft(l.count.y);t.select(".axis-y").call(n)})(g)};window.addEventListener("resize",()=>{d(i)}),d3.csv("renta.csv",(t,a)=>{t?console.log(t):((i=a).forEach(t=>{t.nombre=t.nombre,t.renta=+t.renta}),i.sort((t,a)=>t.renta-a.renta),(()=>{const t=s.select(".chart-lluvia-bar-horizontal-container");t.append("g").attr("class","axis axis-x"),t.append("g").attr("class","axis axis-y"),t.append("g").attr("class","area-container-chart-horizontal")})(),(()=>{const t=d3.scaleLinear().domain([0,d3.max(i,t=>t.renta)]),a=d3.scaleBand().domain(i.map(t=>t.nombre)).paddingInner(.1).paddingOuter(.5);l.count={x:t,y:a}})(),d(i))})};barHorizontal();