// Numbas version: exam_results_page_options {"name": "Horizontal Bar Charts Question 1", "extensions": ["jsxgraph"], "custom_part_types": [], "resources": [], "navigation": {"allowregen": true, "showfrontpage": false, "preventleave": false, "typeendtoleave": false}, "question_groups": [{"pickingStrategy": "all-ordered", "questions": [{"extensions": ["jsxgraph"], "tags": [], "variables": {"yo3": {"group": "Ungrouped variables", "description": "", "definition": "random(3.2..5#0.2 except yo1 except yo2)", "name": "yo3", "templateType": "anything"}, "answer": {"group": "Ungrouped variables", "description": "", "definition": "precround((yo0+yo4+yo8)*(1-percent/100)*2.54,2)", "name": "answer", "templateType": "anything"}, "yn": {"group": "Ungrouped variables", "description": "

new y values after the transformation

", "definition": "map(vsc*y+vsh,y,yo)", "name": "yn", "templateType": "anything"}, "dd": {"group": "Ungrouped variables", "description": "", "definition": "random(0.7..1.3#0.01 except 1 except aa except bb except cc)", "name": "dd", "templateType": "anything"}, "yo0": {"group": "Ungrouped variables", "description": "", "definition": "random(2..3#0.2)", "name": "yo0", "templateType": "anything"}, "aa": {"group": "Ungrouped variables", "description": "", "definition": "random(0.7..1.3#0.01 except 1)", "name": "aa", "templateType": "anything"}, "yo7": {"group": "Ungrouped variables", "description": "", "definition": "random(3.2..5#0.2 except yo5 except yo6)", "name": "yo7", "templateType": "anything"}, "hsc": {"group": "Ungrouped variables", "description": "", "definition": "if(selector='hsc',random(-2,-1,-0.5,0.5,2),1)", "name": "hsc", "templateType": "anything"}, "students": {"group": "Ungrouped variables", "description": "", "definition": "random(120..320#1)", "name": "students", "templateType": "anything"}, "yo1": {"group": "Ungrouped variables", "description": "", "definition": "random(3.2..5#0.2 except yo0)", "name": "yo1", "templateType": "anything"}, "yo9": {"group": "Ungrouped variables", "description": "", "definition": "random(3.2..5#0.2)", "name": "yo9", "templateType": "anything"}, "ii": {"group": "Ungrouped variables", "description": "", "definition": "random(3..6#1)", "name": "ii", "templateType": "anything"}, "yearvector": {"group": "Ungrouped variables", "description": "", "definition": "vector(2007,2008,2009,2010,2011,2012,2013)", "name": "yearvector", "templateType": "anything"}, "answervector": {"group": "Ungrouped variables", "description": "", "definition": "vector((yo5-yo0)/yo0*100, (yo6-yo1)/yo1*100,(yo7-yo2)/yo2*100,(yo8-yo3)/yo3*100, (yo9-yo4)/yo4*100)", "name": "answervector", "templateType": "anything"}, "f": {"group": "Ungrouped variables", "description": "", "definition": "random(1.1..1.3#0.01 except a except b except c except d except e)", "name": "f", "templateType": "anything"}, "d": {"group": "Ungrouped variables", "description": "", "definition": "random(1.1..1.3#0.01 except a except b except c)", "name": "d", "templateType": "anything"}, "cc": {"group": "Ungrouped variables", "description": "", "definition": "random(0.7..1.3#0.01 except 1 except aa except bb)", "name": "cc", "templateType": "anything"}, "fakeanswer3": {"group": "Ungrouped variables", "description": "", "definition": "precround(cc*answer,2)", "name": "fakeanswer3", "templateType": "anything"}, "yo6": {"group": "Ungrouped variables", "description": "", "definition": "random(3.2..5#0.2 except yo5)", "name": "yo6", "templateType": "anything"}, "yo5": {"group": "Ungrouped variables", "description": "", "definition": "random(3.2..5#0.2)", "name": "yo5", "templateType": "anything"}, "yo11": {"group": "Ungrouped variables", "description": "", "definition": "random(3.2..5#0.2 except yo9 except yo10)", "name": "yo11", "templateType": "anything"}, "percent": {"group": "Ungrouped variables", "description": "", "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)", "name": "percent", "templateType": "anything"}, "a": {"group": "Ungrouped variables", "description": "", "definition": "random(1.1..1.3#0.01)", "name": "a", "templateType": "anything"}, "hsh": {"group": "Ungrouped variables", "description": "

horizontal shift

", "definition": "if(selector='hsh',random(-3..3 except 0),0)", "name": "hsh", "templateType": "anything"}, "yo": {"group": "Ungrouped variables", "description": "

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

", "definition": "repeat(random(-5..5),5)", "name": "yo", "templateType": "anything"}, "increase": {"group": "Ungrouped variables", "description": "", "definition": "random(10..40#5)", "name": "increase", "templateType": "anything"}, "vsh": {"group": "Ungrouped variables", "description": "

vertical shift

", "definition": "if(selector='vsh',random(-3..3#0.5 except 0),0)\n", "name": "vsh", "templateType": "anything"}, "fakeanswer2": {"group": "Ungrouped variables", "description": "", "definition": "precround(bb*answer,2)", "name": "fakeanswer2", "templateType": "anything"}, "bb": {"group": "Ungrouped variables", "description": "", "definition": "random(0.7..1.3#0.01 except 1 except aa)", "name": "bb", "templateType": "anything"}, "yo8": {"group": "Ungrouped variables", "description": "", "definition": "random(2..3#0.2 except yo0 except yo1)", "name": "yo8", "templateType": "anything"}, "maxx": {"group": "Ungrouped variables", "description": "", "definition": "max(map(abs(a),a,xn)+5)+1", "name": "maxx", "templateType": "anything"}, "b": {"group": "Ungrouped variables", "description": "", "definition": "random(1.1..1.3#0.01 except a)", "name": "b", "templateType": "anything"}, "xn": {"group": "Ungrouped variables", "description": "

new transformed x values

", "definition": "map((x-hsh)/hsc,x,xo)", "name": "xn", "templateType": "anything"}, "yo2": {"group": "Ungrouped variables", "description": "", "definition": "random(3.2..5#0.2 except yo1)", "name": "yo2", "templateType": "anything"}, "yo4": {"group": "Ungrouped variables", "description": "", "definition": "random(2..3#0.2 except yo0)", "name": "yo4", "templateType": "anything"}, "fakeanswer1": {"group": "Ungrouped variables", "description": "", "definition": "precround(aa*answer,2)", "name": "fakeanswer1", "templateType": "anything"}, "selector": {"group": "Ungrouped variables", "description": "", "definition": "'vsc'", "name": "selector", "templateType": "anything"}, "year": {"group": "Ungrouped variables", "description": "", "definition": "yearvector[ii]", "name": "year", "templateType": "anything"}, "yo10": {"group": "Ungrouped variables", "description": "", "definition": "random(3.2..5#0.2 except yo9)", "name": "yo10", "templateType": "anything"}, "vsc": {"group": "Ungrouped variables", "description": "", "definition": "if(selector='vsc',random(-2,-1,-0.5,0.5,2),1)", "name": "vsc", "templateType": "anything"}, "c": {"group": "Ungrouped variables", "description": "", "definition": "random(1.1..1.3#0.01 except a except b)", "name": "c", "templateType": "anything"}, "fakeanswer4": {"group": "Ungrouped variables", "description": "", "definition": "precround(dd*answer,2)", "name": "fakeanswer4", "templateType": "anything"}, "xo": {"group": "Ungrouped variables", "description": "

original x values

", "definition": "list(-2..2)", "name": "xo", "templateType": "anything"}, "eee": {"group": "Ungrouped variables", "description": "", "definition": "random(1.1..1.3#0.01 except a except b except c except d)", "name": "eee", "templateType": "anything"}}, "rulesets": {"std": ["all", "fractionNumbers"]}, "variable_groups": [], "functions": {}, "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"], "statement": "", "metadata": {"description": "

Widget Sales

", "licence": "Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International"}, "parts": [{"displayType": "radiogroup", "minMarks": 0, "shuffleChoices": true, "prompt": "
Monthly Rainfall Figures 2012 (inches)
\n

\n

If the rainfall is expected to decrease in January by {percent}% from December’s figures, what is the total January rainfall (in cm) for all three cities?

", "displayColumns": 0, "variableReplacements": [], "type": "1_n_2", "showFeedbackIcon": true, "scripts": {}, "variableReplacementStrategy": "originalfirst", "showCorrectAnswer": true, "marks": 0, "maxMarks": 0, "distractors": ["", "", "", "", ""], "choices": ["

{answer}cm     

", "

{fakeanswer1}cm        

", "

{fakeanswer2}cm        

", "

{fakeanswer3}cm          

", "

{fakeanswer4}cm         

"], "matrix": ["1", 0, 0, 0, 0]}], "preamble": {"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});", "css": "table#values th {\n background: none;\n text-align: center;\n}"}, "advice": "", "name": "Horizontal Bar Charts Question 1", "variablesTest": {"condition": "", "maxRuns": 100}, "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/"}]}