randFromArray([[new Plural(function(e){return $.ngettext({lang:"es-ES",messages:["animales","animales"]},e)}),KhanUtil.animal],[new Plural(function(e){return $.ngettext({lang:"es-ES",messages:["colores","colores"]},e)}),KhanUtil.color],[new Plural(function(e){return $.ngettext({lang:"es-ES",messages:["frutas","frutas"]},e)}),KhanUtil.fruit],[new Plural(function(e){return $.ngettext({lang:"es-ES",messages:["cursos","cursos"]},e)}),KhanUtil.course]]) _.times(5, function(n) { return SUBJECT_FUNC(n + 1); } ) _.times(5, function() { return randRange(0, 10); } ) sum(DATA) randFromArray([new Plural(function(e){return $.ngettext({lang:"es-ES",messages:["estudiante","estudiantes"]},e)}),new Plural(function(e){return $.ngettext({lang:"es-ES",messages:["profesores","profesores"]},e)}),new Plural(function(e){return $.ngettext({lang:"es-ES",messages:["personas","personas"]},e)})]) shuffle(_.zip(DATA, CATEGORIES))

A TOTAL RESPONDENT se le preguntó sobre su SUBJECT favorito.A TOTAL plural_form(RESPONDENT, TOTAL) se les preguntó sobre su SUBJECT favorito. DATA[0] RESPONDENT dijo DATA[1].DATA[0] plural_form(RESPONDENT, DATA[0]) dijeron DATA[1].

Crea un gráfico de barras mostrando las plural_form(SUBJECT) favoritas de todos:

init({range:[[-2,17],[-3,12]],scale:[26,30]}),addMouseLayer();for(var y=0;10>=y;++y)label([0,y],y,"left",!1),style({stroke:"#000",strokeWidth:1,opacity:.3},function(){line([0,y],[16,y])});graph.leftPoints=[],graph.rightPoints=[],graph.lines=[];for(var index=0;index<CATEGORIES.length;++index){graph.leftPoints[index]=addMovablePoint({coord:[3*index+1,.5],visible:!1}),graph.rightPoints[index]=addMovablePoint({coord:[3*index+3,.5],visible:!1}),graph.lines[index]=addMovableLineSegment({pointA:graph.leftPoints[index],pointZ:graph.rightPoints[index],snapY:.5,constraints:{constrainX:!0}}),style({stroke:"none",fill:"#9ab8ed",opacity:1},function(){graph.lines[index].bar=path([[3*index+1,0],[3*index+1,.5],[3*index+3,.5],[3*index+3,0],[3*index+1,0]])}),label([3*index+2,0],CATEGORIES[index]+"","below",!1).css("text-transform","capitalize");var bar=index;graph.lines[index].onMove=function(e,r){(this.coordA[1]<0||this.coordA[1]>10)&&(this.coordA[1]-=r,this.coordZ[1]-=r),this.pointA.setCoord([this.pointA.coord[0],this.coordA[1]]),this.pointZ.setCoord([this.pointZ.coord[0],this.coordA[1]]),this.pointA.updateLineEnds(),this.pointZ.updateLineEnds(),this.bar.scale(1,Math.max(.01,2*this.coordA[1]),scalePoint(0)[0],scalePoint(0)[1])}}style({stroke:"#000",strokeWidth:2,opacity:1},function(){line([0,0],[16,0]),line([0,0],[0,10])}),label([8,-.8],SUBJECT+"","below",!1).css("text-transform","capitalize").css("font-weight","bold"),label([-1.5,5],$._("Número de %(respondent)s",{respondent:plural_form(RESPONDENT)}),"center",!1).css("font-weight","bold").addClass("rotate"),label([8,10.5],$._("%(subject)s favorito",{subject:plural_form(SUBJECT)}),"above",!1).css("font-weight","bold")
Crea un diagrama de barras arrastrando hacia arriba y hacia abajo la parte superior de cada barra.
_.times(5,function(e){return graph.lines[e].coordA[1]})
return _.isEqual(guess,[.5,.5,.5,.5,.5])?"":_.isEqual(guess,DATA)
$.each(guess,function(e){graph.lines[e].pointA.setCoord([graph.lines[e].pointA.coord[0],this]),graph.lines[e].pointZ.setCoord([graph.lines[e].pointZ.coord[0],this]),graph.lines[e].pointA.updateLineEnds(),graph.lines[e].pointZ.updateLineEnds(),graph.lines[e].bar.scale(1,Math.max(.01,2*this),scalePoint(0)[0],scalePoint(0)[1])})

NUM RESPONDENT said their favorite SUBJECT was CATEGORIES[ INDEX ]. Así que la barra superior de "CATEGORIES[ INDEX ]" debe alinearse con el número NUM del lado izquierdo de la tabla.Así que no debería haber ninguna barra sobre "CATEGORIES[ INDEX ]". Arrastra la parte superior de la barra hasta el fondo para deshacerse de la barra.

style({stroke:ORANGE,fill:"none",strokeWidth:1,strokeDasharray:"- "},function(){path([[3*INDEX+1,0],[3*INDEX+1,NUM],[3*INDEX+3,NUM],[3*INDEX+3,0]]).toBack()})