// Numbas version: finer_feedback_settings {"name": "Horizontal Bar Charts Question 4", "extensions": ["jsxgraph"], "custom_part_types": [], "resources": [], "navigation": {"allowregen": true, "showfrontpage": false, "preventleave": false, "typeendtoleave": false}, "question_groups": [{"pickingStrategy": "all-ordered", "questions": [{"variables": {"eee": {"description": "", "name": "eee", "group": "Ungrouped variables", "templateType": "anything", "definition": "random(1.1..1.3#0.01 except a except b except c except d)"}, "cc": {"description": "", "name": "cc", "group": "Ungrouped variables", "templateType": "anything", "definition": "random(0.7..1.3#0.01 except 1 except aa except bb)"}, "yo10": {"description": "", "name": "yo10", "group": "Ungrouped variables", "templateType": "anything", "definition": "random(3.2..5#0.2 except yo9)"}, "aa": {"description": "", "name": "aa", "group": "Ungrouped variables", "templateType": "anything", "definition": "random(0.7..1.3#0.01 except 1)"}, "year": {"description": "", "name": "year", "group": "Ungrouped variables", "templateType": "anything", "definition": "yearvector[ii]"}, "yn": {"description": "

new y values after the transformation

", "name": "yn", "group": "Ungrouped variables", "templateType": "anything", "definition": "map(vsc*y+vsh,y,yo)"}, "answervector": {"description": "", "name": "answervector", "group": "Ungrouped variables", "templateType": "anything", "definition": "vector((yo5-yo0)/yo0*100, (yo6-yo1)/yo1*100,(yo7-yo2)/yo2*100,(yo8-yo3)/yo3*100, (yo9-yo4)/yo4*100)"}, "b": {"description": "", "name": "b", "group": "Ungrouped variables", "templateType": "anything", "definition": "random(1.1..1.3#0.01 except a)"}, "yo": {"description": "

the (random) original y values which relate to the x values

", "name": "yo", "group": "Ungrouped variables", "templateType": "anything", "definition": "repeat(random(-5..5),5)"}, "d": {"description": "", "name": "d", "group": "Ungrouped variables", "templateType": "anything", "definition": "random(1.1..1.3#0.01 except a except b except c)"}, "yo9": {"description": "", "name": "yo9", "group": "Ungrouped variables", "templateType": "anything", "definition": "random(3.2..5#0.2)"}, "vsh": {"description": "

vertical shift

", "name": "vsh", "group": "Ungrouped variables", "templateType": "anything", "definition": "if(selector='vsh',random(-3..3#0.5 except 0),0)\n"}, "vsc": {"description": "", "name": "vsc", "group": "Ungrouped variables", "templateType": "anything", "definition": "if(selector='vsc',random(-2,-1,-0.5,0.5,2),1)"}, "c": {"description": "", "name": "c", "group": "Ungrouped variables", "templateType": "anything", "definition": "random(1.1..1.3#0.01 except a except b)"}, "bb": {"description": "", "name": "bb", "group": "Ungrouped variables", "templateType": "anything", "definition": "random(0.7..1.3#0.01 except 1 except aa)"}, "answer": {"description": "", "name": "answer", "group": "Ungrouped variables", "templateType": "anything", "definition": "precround((yo8+yo9+yo10+yo11)/(yo4+yo5+yo6+yo7),2)"}, "students": {"description": "", "name": "students", "group": "Ungrouped variables", "templateType": "anything", "definition": "random(120..320#1)"}, "yo1": {"description": "", "name": "yo1", "group": "Ungrouped variables", "templateType": "anything", "definition": "random(3.2..5#0.2 except yo0)"}, "a": {"description": "", "name": "a", "group": "Ungrouped variables", "templateType": "anything", "definition": "random(1.1..1.3#0.01)"}, "yo2": {"description": "", "name": "yo2", "group": "Ungrouped variables", "templateType": "anything", "definition": "random(3.2..5#0.2 except yo1)"}, "yo5": {"description": "", "name": "yo5", "group": "Ungrouped variables", "templateType": "anything", "definition": "random(3.2..5#0.2)"}, "yo8": {"description": "", "name": "yo8", "group": "Ungrouped variables", "templateType": "anything", "definition": "random(2..3#0.2 except yo0 except yo1)"}, "yo11": {"description": "", "name": "yo11", "group": "Ungrouped variables", "templateType": "anything", "definition": "random(3.2..5#0.2 except yo9 except yo10)"}, "yo7": {"description": "", "name": "yo7", "group": "Ungrouped variables", "templateType": "anything", "definition": "random(3.2..5#0.2 except yo5 except yo6)"}, "maxx": {"description": "", "name": "maxx", "group": "Ungrouped variables", "templateType": "anything", "definition": "max(map(abs(a),a,xn)+5)+1"}, "yo4": {"description": "", "name": "yo4", "group": "Ungrouped variables", "templateType": "anything", "definition": "random(2..3#0.2 except yo0)"}, "ii": {"description": "", "name": "ii", "group": "Ungrouped variables", "templateType": "anything", "definition": "random(3..6#1)"}, "yo3": {"description": "", "name": "yo3", "group": "Ungrouped variables", "templateType": "anything", "definition": "random(3.2..5#0.2 except yo1 except yo2)"}, "selector": {"description": "", "name": "selector", "group": "Ungrouped variables", "templateType": "anything", "definition": "'vsc'"}, "fakeanswer1": {"description": "", "name": "fakeanswer1", "group": "Ungrouped variables", "templateType": "anything", "definition": "precround(aa*answer,2)"}, "hsh": {"description": "

horizontal shift

", "name": "hsh", "group": "Ungrouped variables", "templateType": "anything", "definition": "if(selector='hsh',random(-3..3 except 0),0)"}, "dd": {"description": "", "name": "dd", "group": "Ungrouped variables", "templateType": "anything", "definition": "random(0.7..1.3#0.01 except 1 except aa except bb except cc)"}, "percent": {"description": "", "name": "percent", "group": "Ungrouped variables", "templateType": "anything", "definition": "random(2..20#0.1 except 2 except 3 except 4 except 5 except 6 except 7 except 8 except 9 except 10 except 11 except 12 except 13 except 14 except 15 except 16 except 17 except 18 except 19 except 20)"}, "yo0": {"description": "", "name": "yo0", "group": "Ungrouped variables", "templateType": "anything", "definition": "random(2..3#0.2)"}, "fakeanswer4": {"description": "", "name": "fakeanswer4", "group": "Ungrouped variables", "templateType": "anything", "definition": "precround(dd*answer,2)"}, "xn": {"description": "

new transformed x values

", "name": "xn", "group": "Ungrouped variables", "templateType": "anything", "definition": "map((x-hsh)/hsc,x,xo)"}, "xo": {"description": "

original x values

", "name": "xo", "group": "Ungrouped variables", "templateType": "anything", "definition": "list(-2..2)"}, "yearvector": {"description": "", "name": "yearvector", "group": "Ungrouped variables", "templateType": "anything", "definition": "vector(2007,2008,2009,2010,2011,2012,2013)"}, "fakeanswer2": {"description": "", "name": "fakeanswer2", "group": "Ungrouped variables", "templateType": "anything", "definition": "precround(bb*answer,2)"}, "f": {"description": "", "name": "f", "group": "Ungrouped variables", "templateType": "anything", "definition": "random(1.1..1.3#0.01 except a except b except c except d except e)"}, "fakeanswer3": {"description": "", "name": "fakeanswer3", "group": "Ungrouped variables", "templateType": "anything", "definition": "precround(cc*answer,2)"}, "increase": {"description": "", "name": "increase", "group": "Ungrouped variables", "templateType": "anything", "definition": "random(10..40#5)"}, "yo6": {"description": "", "name": "yo6", "group": "Ungrouped variables", "templateType": "anything", "definition": "random(3.2..5#0.2 except yo5)"}, "hsc": {"description": "", "name": "hsc", "group": "Ungrouped variables", "templateType": "anything", "definition": "if(selector='hsc',random(-2,-1,-0.5,0.5,2),1)"}}, "variablesTest": {"maxRuns": 100, "condition": ""}, "extensions": ["jsxgraph"], "variable_groups": [], "statement": "", "rulesets": {"std": ["all", "fractionNumbers"]}, "parts": [{"prompt": "
Monthly Rainfall Figures 2012 (inches)
\n
\n
\n
Within the four months detailed above, what is the approximate ratio of Manchester’s rainfall to London’s rainfall?
", "variableReplacements": [], "distractors": ["", "", "", "", ""], "choices": ["

1:{answer}    

", "

1:{fakeanswer1}        

", "

1:{fakeanswer2}        

", "

1:{fakeanswer3}          

", "

1:{fakeanswer4}         

"], "shuffleChoices": true, "showFeedbackIcon": true, "scripts": {}, "variableReplacementStrategy": "originalfirst", "displayColumns": 0, "matrix": ["1", 0, 0, 0, 0], "maxMarks": 0, "type": "1_n_2", "marks": 0, "showCorrectAnswer": true, "minMarks": 0, "displayType": "radiogroup"}], "tags": [], "advice": "", "functions": {}, "preamble": {"css": "table#values th {\n background: none;\n text-align: center;\n}", "js": "function dragpoint_board() {\n var scope = question.scope;\n \n JXG.Options.text.display = 'internal';\n\n var yo0 = scope.variables.yo0.value;\n var yo1 = scope.variables.yo1.value;\n var yo2 = scope.variables.yo2.value;\n var yo3 = scope.variables.yo3.value;\n \n var yo4 = scope.variables.yo4.value;\n var yo5 = scope.variables.yo5.value;\n var yo6 = scope.variables.yo6.value;\n var yo7 = scope.variables.yo7.value; \n \n var yo8 = scope.variables.yo8.value;\n var yo9 = scope.variables.yo9.value;\n var yo10 = scope.variables.yo10.value;\n var yo11 = scope.variables.yo11.value; \n \n var div = Numbas.extensions.jsxgraph.makeBoard('400px','400px',{boundingBox:[-0.6,16,8,-0.5], axis:false, grid:true});\n \n $(question.display.html).find('#dragpoint').append(div);\n \n var board = div.board;\n \nboard.suspendUpdate(); \n\n \n //var dataArr = [yo0,yo5,0,yo1,yo6,0,yo2,yo7,0,yo3,yo8,0,yo4,yo9]; \n \n var yaxis = board.create('axis', [[0, 0], [0, 15]], {withLabel: false, name: \"Bank\", label: {offset: [250,-30]}});\n \n yaxis.removeAllTicks(); \n \n board.create('axis', [[0, 0], [15, 0]], {hideTicks:true, withLabel: false, name: \"\", label: {offset: [-110,300]}});\n \n //var pop0 = board.create('point', [1.5,0],{name:'Morgan',fixed:true,size:0,color:'black',face:'diamond', label:{offset:[-20,-8]}});\n // var pop1 = board.create('point',[4.5,0],{name:'Strome',fixed:true,size:0,color:'black',face:'diamond', label:{offset:[-20,-8]}});\n // var pop2 = board.create('point',[7.5,0],{name:'Bentley',fixed:true,size:0,color:'black', face:'diamond', label:{offset:[-15,-8]}});\n // var pop3 = board.create('point',[10.5,0],{name:'Sand',fixed:true,size:0,color:'black', face:'diamond', label:{offset:[-15,-8]}});\n // var pop4 = board.create('point',[13.5,0],{name:'Karchen',fixed:true,size:0,color:'black', face:'diamond', label:{offset:[-15,-8]}});\n\n //var leg1 = board.create('point',[12,75],{name:'last year',fixed:true,size:6,color:'maroon', face:'square', label:{offset:[9,6]}});\n //var leg2 = board.create('point',[12,72],{name:'this year',fixed:true,size:6,color:'darkslateblue', face:'square', label:{offset:[9,6]}});\n \n \n var a = board.create('chart', [[1,2,3,4,5],[yo0,yo1,yo2,yo3,0]], {chartStyle:'bar',width:1,colors:['#DA2228','#CA147A','#6F1B75','#0F408D'],fillOpacity:1,dir:'horizontal'});\n var b = board.create('chart', [[6,7,8,9,10],[yo4,yo5,yo6,yo7,0]], {chartStyle:'bar',width:1,colors:['#DA2228','#CA147A','#6F1B75','#0F408D'],fillOpacity:1,dir:'horizontal'});\n var c = board.create('chart', [[11,12,13,14,15],[yo8,yo9,yo10,yo11,0]], {chartStyle:'bar',width:1,colors:['#DA2228','#CA147A','#6F1B75','#0F408D'],fillOpacity:1,dir:'horizontal'}); \n // var d = board.create('chart', [[16,17,18,119],[12,13,14,15]], {chartStyle:'bar',width:1,fillOpacity:1,dir:'horizontal'});\n // var d = board.create('chart', [[10,11,12],[yo3,yo8,0]], {chartStyle:'bar',width:1,fillOpacity:1});\n // var e = board.create('chart', [[13,14],[yo4,yo9]], {chartStyle:'bar',width:1,fillOpacity:1});\n \n board.unsuspendUpdate();\n \n \n var txt = board.create('text',[-0.35,1, 'Birmingham'], {fontSize:14, rotate:90});\n var txt1 = board.create('text',[-0.35,6, 'Manchester'], {fontSize:14, rotate:90});\n var txt2 = board.create('text',[-0.35,11.5, 'London'], {fontSize:14, rotate:90});\n \n var leg1 = board.create('point',[6.3,8],{name:'September',fixed:true,size:6,color:'#0F408D', face:'square', label:{offset:[9,0]}});\n var leg2 = board.create('point',[6.3,7],{name:'October',fixed:true,size:6,color:'#6F1B75', face:'square', label:{offset:[9,0]}});\n var leg3 = board.create('point',[6.3,6],{name:'November',fixed:true,size:6,color:'#CA147A', face:'square', label:{offset:[9,0]}});\n var leg4 = board.create('point',[6.3,5],{name:'December',fixed:true,size:6,color:'#DA2228', face:'square', label:{offset:[9,0]}});\n//var leg5 = board.create('point',[6.3,5],{name:'December',fixed:true,size:6,color:'#DA2228', face:'square', label:{offset:[9,0]}}); \n \n \n var txt1 = board.create('text',[5,1, '1 inch = 2.54cm'], {fontColor:'black', fontSize:14, rotate:0});\n \n // var txt2 = board.create('text',[8,73, 'blue bars represents 2011'], {fontSize:14, rotate:90});\n\n // var myColors = new Array('red', 'blue', 'white','red', 'blue', 'white','red', 'blue', 'white','red', 'blue', 'white','red', 'blue');\n \n \n \n //board.unsuspendUpdate();\n\n // Rotate text around the lower left corner (-2,-1) by 30 degrees.\n // var tRot = board.create('transform', [90.0*Math.PI/180.0, -1,40], {type:'rotate'}); \n // tRot.bindTo(txt);\n // board.update();\n\n \n//var chart2 = board.createElement('chart', dataArr, {chartStyle:'line,point'});\n//chart2[0].setProperty('strokeColor:black','strokeWidth:2','shadow:true');\n//for(var i=0; i<11;i++) {\n // chart2[1][i].setProperty({strokeColor:'black',fillColor:'white',face:'[]', size:4, strokeWidth:2});\n//}\n//board.unsuspendUpdate(); \n \n //board.unsuspendUpdate();\n\n}\n\nquestion.signals.on('HTMLAttached',function() {\n dragpoint_board();\n});"}, "metadata": {"description": "

Widget Sales

", "licence": "Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International"}, "ungrouped_variables": ["selector", "vsh", "hsh", "vsc", "hsc", "yo", "yn", "xo", "xn", "yo0", "yo1", "yo2", "yo3", "yo4", "maxx", "yo6", "yo7", "yo8", "yo9", "yo11", "yo5", "yo10", "a", "b", "c", "d", "eee", "f", "answer", "fakeanswer1", "fakeanswer2", "fakeanswer3", "fakeanswer4", "aa", "bb", "cc", "dd", "percent", "students", "yearvector", "ii", "year", "answervector", "increase"], "name": "Horizontal Bar Charts Question 4", "type": "question", "contributors": [{"name": "Gareth Woods", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/978/"}]}]}], "contributors": [{"name": "Gareth Woods", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/978/"}]}