// Numbas version: exam_results_page_options {"name": "Bar Charts - Sports 2", "extensions": ["jsxgraph"], "custom_part_types": [], "resources": [], "navigation": {"allowregen": true, "showfrontpage": false, "preventleave": false, "typeendtoleave": false}, "question_groups": [{"pickingStrategy": "all-ordered", "questions": [{"variables": {"f": {"group": "Ungrouped variables", "templateType": "anything", "description": "", "definition": "random(1.1..1.3#0.01 except a except b except c except d except e)", "name": "f"}, "year": {"group": "Ungrouped variables", "templateType": "anything", "description": "", "definition": "yearvector[ii]", "name": "year"}, "yo5": {"group": "Ungrouped variables", "templateType": "anything", "description": "", "definition": "100-yo3-yo4", "name": "yo5"}, "fakeanswer4": {"group": "Ungrouped variables", "templateType": "anything", "description": "", "definition": "ceil(dd*answer)", "name": "fakeanswer4"}, "xn": {"group": "Ungrouped variables", "templateType": "anything", "description": "

new transformed x values

", "definition": "map((x-hsh)/hsc,x,xo)", "name": "xn"}, "ii": {"group": "Ungrouped variables", "templateType": "anything", "description": "", "definition": "random(3..6#1)", "name": "ii"}, "yo3": {"group": "Ungrouped variables", "templateType": "anything", "description": "", "definition": "random(20..40#1 except yo0)", "name": "yo3"}, "yn": {"group": "Ungrouped variables", "templateType": "anything", "description": "

new y values after the transformation

", "definition": "map(vsc*y+vsh,y,yo)", "name": "yn"}, "yo11": {"group": "Ungrouped variables", "templateType": "anything", "description": "", "definition": "100-yo10-yo9", "name": "yo11"}, "number": {"group": "Ungrouped variables", "templateType": "anything", "description": "", "definition": "random(1000..5000#200)", "name": "number"}, "selector": {"group": "Ungrouped variables", "templateType": "anything", "description": "", "definition": "'vsc'", "name": "selector"}, "vsh": {"group": "Ungrouped variables", "templateType": "anything", "description": "

vertical shift

", "definition": "if(selector='vsh',random(-3..3#0.5 except 0),0)\n", "name": "vsh"}, "dd": {"group": "Ungrouped variables", "templateType": "anything", "description": "", "definition": "random(0.7..1.3#0.01 except 1 except aa except bb except cc)", "name": "dd"}, "hsh": {"group": "Ungrouped variables", "templateType": "anything", "description": "

horizontal shift

", "definition": "if(selector='hsh',random(-3..3 except 0),0)", "name": "hsh"}, "answervector": {"group": "Ungrouped variables", "templateType": "anything", "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"}, "eee": {"group": "Ungrouped variables", "templateType": "anything", "description": "", "definition": "random(1.1..1.3#0.01 except a except b except c except d)", "name": "eee"}, "yo7": {"group": "Ungrouped variables", "templateType": "anything", "description": "", "definition": "random(20..40#1 except yo1 except yo4)", "name": "yo7"}, "percent": {"group": "Ungrouped variables", "templateType": "anything", "description": "", "definition": "random(5..20#0.1 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"}, "a": {"group": "Ungrouped variables", "templateType": "anything", "description": "", "definition": "random(1.1..1.3#0.01)", "name": "a"}, "yo10": {"group": "Ungrouped variables", "templateType": "anything", "description": "", "definition": "random(20..40#1 except yo1 except yo4 except yo7)", "name": "yo10"}, "fakeanswer1": {"group": "Ungrouped variables", "templateType": "anything", "description": "", "definition": "ceil(aa*answer)", "name": "fakeanswer1"}, "yo0": {"group": "Ungrouped variables", "templateType": "anything", "description": "", "definition": "random(20..40#1)", "name": "yo0"}, "fakeanswer2": {"group": "Ungrouped variables", "templateType": "anything", "description": "", "definition": "ceil(bb*answer)", "name": "fakeanswer2"}, "increase": {"group": "Ungrouped variables", "templateType": "anything", "description": "", "definition": "random(10..40#5)", "name": "increase"}, "yo6": {"group": "Ungrouped variables", "templateType": "anything", "description": "", "definition": "random(20..40#1 except yo0 except yo3)", "name": "yo6"}, "b": {"group": "Ungrouped variables", "templateType": "anything", "description": "", "definition": "random(1.1..1.3#0.01 except a)", "name": "b"}, "yo2": {"group": "Ungrouped variables", "templateType": "anything", "description": "", "definition": "100 - yo0 - yo1", "name": "yo2"}, "maxx": {"group": "Ungrouped variables", "templateType": "anything", "description": "", "definition": "max(map(abs(a),a,xn)+5)+1", "name": "maxx"}, "vsc": {"group": "Ungrouped variables", "templateType": "anything", "description": "", "definition": "if(selector='vsc',random(-2,-1,-0.5,0.5,2),1)", "name": "vsc"}, "bb": {"group": "Ungrouped variables", "templateType": "anything", "description": "", "definition": "random(0.7..1.3#0.01 except 1 except aa)", "name": "bb"}, "answer": {"group": "Ungrouped variables", "templateType": "anything", "description": "", "definition": "(yo2+yo5+yo8+yo11)*number/100", "name": "answer"}, "hsc": {"group": "Ungrouped variables", "templateType": "anything", "description": "", "definition": "if(selector='hsc',random(-2,-1,-0.5,0.5,2),1)", "name": "hsc"}, "yo": {"group": "Ungrouped variables", "templateType": "anything", "description": "

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

", "definition": "repeat(random(-5..5),5)", "name": "yo"}, "yo1": {"group": "Ungrouped variables", "templateType": "anything", "description": "", "definition": "random(20..40#1 except yo0)", "name": "yo1"}, "yo4": {"group": "Ungrouped variables", "templateType": "anything", "description": "", "definition": "random(20..40#1 except yo1)", "name": "yo4"}, "xo": {"group": "Ungrouped variables", "templateType": "anything", "description": "

original x values

", "definition": "list(-2..2)", "name": "xo"}, "yo9": {"group": "Ungrouped variables", "templateType": "anything", "description": "", "definition": "random(20..40#1 except yo0 except yo3 except yo6)", "name": "yo9"}, "aa": {"group": "Ungrouped variables", "templateType": "anything", "description": "", "definition": "random(0.7..1.3#0.01 except 1)", "name": "aa"}, "d": {"group": "Ungrouped variables", "templateType": "anything", "description": "", "definition": "random(1.1..1.3#0.01 except a except b except c)", "name": "d"}, "c": {"group": "Ungrouped variables", "templateType": "anything", "description": "", "definition": "random(1.1..1.3#0.01 except a except b)", "name": "c"}, "yo8": {"group": "Ungrouped variables", "templateType": "anything", "description": "", "definition": "100-yo7-yo6", "name": "yo8"}, "yearvector": {"group": "Ungrouped variables", "templateType": "anything", "description": "", "definition": "vector(2007,2008,2009,2010,2011,2012,2013)", "name": "yearvector"}, "cc": {"group": "Ungrouped variables", "templateType": "anything", "description": "", "definition": "random(0.7..1.3#0.01 except 1 except aa except bb)", "name": "cc"}, "fakeanswer3": {"group": "Ungrouped variables", "templateType": "anything", "description": "", "definition": "ceil(cc*answer)", "name": "fakeanswer3"}}, "extensions": ["jsxgraph"], "advice": "", "statement": "", "variablesTest": {"condition": "", "maxRuns": 100}, "name": "Bar Charts - Sports 2", "rulesets": {"std": ["all", "fractionNumbers"]}, "variable_groups": [], "parts": [{"marks": 0, "maxMarks": 0, "distractors": ["", "", "", "", ""], "showCorrectAnswer": true, "showFeedbackIcon": true, "displayType": "radiogroup", "scripts": {}, "minMarks": 0, "prompt": "
Sporting Preference Survey for ABC Television ( {number} surveyed in each region ). 
\n

\n

What is the total number of people, across all four regions, who chose cricket as their favourite sport?

", "matrix": ["1", 0, 0, 0, 0], "variableReplacementStrategy": "originalfirst", "type": "1_n_2", "choices": ["

{answer}     

", "

{fakeanswer1}        

", "

{fakeanswer2}        

", "

{fakeanswer3}          

", "

{fakeanswer4}         

"], "variableReplacements": [], "shuffleChoices": true, "displayColumns": 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 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 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('450px','450px',{boundingBox:[-0.8,62,16.4,-2], 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 xaxis = board.create('axis', [[0, 0], [12, 0]], {withLabel: false, name: \"Bank\", label: {offset: [250,-30]}});\n \n xaxis.removeAllTicks(); \n \n board.create('axis', [[0, 0], [0, 10]], {hideTicks:true, withLabel: false, name: \"\", label: {offset: [-110,300]}});\n \n var pop0 = board.create('point', [2,0],{name:'Region A',fixed:true,size:0,color:'black',face:'diamond', label:{offset:[-20,-8]}});\n var pop1 = board.create('point',[6,0],{name:'Region B',fixed:true,size:0,color:'black',face:'diamond', label:{offset:[-20,-8]}});\n var pop2 = board.create('point',[10,0],{name:'Region C',fixed:true,size:0,color:'black', face:'diamond', label:{offset:[-15,-8]}});\n var pop3 = board.create('point',[14,0],{name:'Region D',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,58],{name:'Football',fixed:true,size:8,color:'#DA2228', face:'square', label:{offset:[11,0]}});\n var leg2 = board.create('point',[12,55],{name:'Rugby',fixed:true,size:8,color:'#6F1B75', face:'square', label:{offset:[11,0]}});\n var leg3 = board.create('point',[12,52],{name:'Cricket',fixed:true,size:8,color:'#00ff80', face:'square', label:{offset:[11,0]}}); \n \n// var chart = board.createElement('chart', dataArr, \n // {chartStyle:'bar', fillOpacity:1, width:1,\n // colorArray:['#8E1B77','#8E1B77','Red','Red','blue','red','blue','red','red','blue', 'red','blue','red','red'], shadow:false});\n \n//var chart = board.createElement('chart', dataArr, \n // {chartStyle:'bar', width:1,fillOpacity:1, fillColor:'red', shadow:false}); \n \n \n var a = board.create('chart', [[1,2,3,4],[yo0,yo1,yo2,0]], {chartStyle:'bar',colors:['#DA2228','#6F1B75','#00ff80'],width:1,fillOpacity:1});\n var b = board.create('chart', [[5,6,7,8],[yo3,yo4,yo5,0]], {chartStyle:'bar',width:1,colors:['#DA2228','#6F1B75','#00ff80'],fillOpacity:1});\n var c = board.create('chart', [[9,10,11,12],[yo6,yo7,yo8,0]], {chartStyle:'bar',width:1,colors:['#DA2228','#6F1B75','#00ff80'],fillOpacity:1});\n var d = board.create('chart', [[13,14,15],[yo9,yo10,yo11]], {chartStyle:'bar',width:1,colors:['#DA2228','#6F1B75','#00ff80'],fillOpacity:1});\n // var e = board.create('chart', [[13,14],[yo4,yo9]], {chartStyle:'bar',width:1,colors:['#DA2228','#6F1B75'],fillOpacity:1});\n \n board.unsuspendUpdate();\n \n var txt1 = board.create('text',[-0.3,30, 'Percentage'], {fontColor:'black', fontSize:14, rotate:90});\n \n // var txt = board.create('text',[0.5,75, 'Investment (m)'], {fontSize:14, rotate:90});\n \n // var txt1 = board.create('text',[8,76, 'red bars represent 2010'], {fontColor:'red', fontSize:14, rotate:90});\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}"}, "ungrouped_variables": ["selector", "vsh", "hsh", "vsc", "hsc", "yo", "yn", "xo", "xn", "yo0", "yo1", "yo2", "yo3", "yo4", "maxx", "yo6", "yo7", "yo8", "yo9", "yo10", "yo5", "yo11", "a", "b", "c", "d", "eee", "f", "answer", "fakeanswer1", "fakeanswer2", "fakeanswer3", "fakeanswer4", "aa", "bb", "cc", "dd", "percent", "number", "yearvector", "ii", "year", "answervector", "increase"], "functions": {}, "tags": [], "metadata": {"description": "

Widget Sales

", "licence": "Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International"}, "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/"}]}