// Numbas version: exam_results_page_options {"name": "Graphs: Stacked Bar Charts", "extensions": ["jsxgraph"], "custom_part_types": [], "resources": [], "navigation": {"allowregen": true, "showfrontpage": false, "preventleave": false, "typeendtoleave": false}, "question_groups": [{"pickingStrategy": "all-ordered", "questions": [{"name": "Graphs: Stacked Bar Charts", "tags": [], "metadata": {"description": "

Reading a value from a stacked bar chart.

", "licence": "Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International"}, "statement": "", "advice": "

Since we are interested in {year}, we can concentrate on this bar.

We need the value for numbers of children, and numbers of adults.

We can read the child value by looking at the height of the child bar, in this case {printchild}.

The value for adults is slightly trickier, as this is a stacked bar chart, we need to find the height of just the adult component.
We find this by calculating
$\\var{printadult+printchild} - \\var{printchild} = \\var{printadult}$.

To find this as a percentage we calculate the adults as a fraction of the total, and then multiply by 100 (to convert to a percentage)

\n

i.e.

\n

$\\frac{\\var{printadult}}{\\var{printadult+printchild}} \\times 100$

\n

$=\\var{answer} %$.

", "rulesets": {"std": ["all", "fractionNumbers"]}, "extensions": ["jsxgraph"], "builtin_constants": {"e": true, "pi,\u03c0": true, "i": true}, "constants": [], "variables": {"yo3": {"name": "yo3", "group": "Ungrouped variables", "definition": "random(850..1400#50 except yo1)", "description": "", "templateType": "anything", "can_override": false}, "fakeanswer2": {"name": "fakeanswer2", "group": "Ungrouped variables", "definition": "precround(bb*answervector[ii],2)", "description": "", "templateType": "anything", "can_override": false}, "yo4": {"name": "yo4", "group": "Ungrouped variables", "definition": "random(20..40#1 except yo1)", "description": "", "templateType": "anything", "can_override": false}, "yo5": {"name": "yo5", "group": "Ungrouped variables", "definition": "100-yo3-yo4", "description": "", "templateType": "anything", "can_override": false}, "yo9": {"name": "yo9", "group": "Ungrouped variables", "definition": "random(20..40#1 except yo0 except yo3 except yo6)", "description": "", "templateType": "anything", "can_override": false}, "b": {"name": "b", "group": "Ungrouped variables", "definition": "random(1.1..1.3#0.01 except a)", "description": "", "templateType": "anything", "can_override": false}, "year": {"name": "year", "group": "Ungrouped variables", "definition": "yearvector[ii]", "description": "", "templateType": "anything", "can_override": false}, "bb": {"name": "bb", "group": "Ungrouped variables", "definition": "random(0.6..1.15#0.01 except 1 except aa)", "description": "", "templateType": "anything", "can_override": false}, "hsh": {"name": "hsh", "group": "Ungrouped variables", "definition": "if(selector='hsh',random(-3..3 except 0),0)", "description": "

horizontal shift

", "templateType": "anything", "can_override": false}, "selector": {"name": "selector", "group": "Ungrouped variables", "definition": "'vsc'", "description": "", "templateType": "anything", "can_override": false}, "yo1": {"name": "yo1", "group": "Ungrouped variables", "definition": "random(200..700#50 except yo0)", "description": "", "templateType": "anything", "can_override": false}, "vsc": {"name": "vsc", "group": "Ungrouped variables", "definition": "if(selector='vsc',random(-2,-1,-0.5,0.5,2),1)", "description": "", "templateType": "anything", "can_override": false}, "ii": {"name": "ii", "group": "Ungrouped variables", "definition": "random(0,1)", "description": "", "templateType": "anything", "can_override": false}, "yn": {"name": "yn", "group": "Ungrouped variables", "definition": "map(vsc*y+vsh,y,yo)", "description": "

new y values after the transformation

", "templateType": "anything", "can_override": false}, "yo0": {"name": "yo0", "group": "Ungrouped variables", "definition": "random(200..700#50)", "description": "", "templateType": "anything", "can_override": false}, "yo6": {"name": "yo6", "group": "Ungrouped variables", "definition": "random(20..40#1 except yo0 except yo3)", "description": "", "templateType": "anything", "can_override": false}, "xo": {"name": "xo", "group": "Ungrouped variables", "definition": "list(-2..2)", "description": "

original x values

", "templateType": "anything", "can_override": false}, "a": {"name": "a", "group": "Ungrouped variables", "definition": "random(1.1..1.3#0.01)", "description": "", "templateType": "anything", "can_override": false}, "yo10": {"name": "yo10", "group": "Ungrouped variables", "definition": "random(20..40#1 except yo1 except yo4 except yo7)", "description": "", "templateType": "anything", "can_override": false}, "cc": {"name": "cc", "group": "Ungrouped variables", "definition": "random(0.6..1.15#0.01 except 1 except aa except bb)", "description": "", "templateType": "anything", "can_override": false}, "answer": {"name": "answer", "group": "Ungrouped variables", "definition": "precround(answervector[ii],2)", "description": "", "templateType": "anything", "can_override": false}, "maxx": {"name": "maxx", "group": "Ungrouped variables", "definition": "max(map(abs(a),a,xn)+5)+1", "description": "", "templateType": "anything", "can_override": false}, "vsh": {"name": "vsh", "group": "Ungrouped variables", "definition": "if(selector='vsh',random(-3..3#0.5 except 0),0)\n", "description": "

vertical shift

", "templateType": "anything", "can_override": false}, "fakeanswer4": {"name": "fakeanswer4", "group": "Ungrouped variables", "definition": "precround(dd*answervector[ii],2)", "description": "", "templateType": "anything", "can_override": false}, "dd": {"name": "dd", "group": "Ungrouped variables", "definition": "random(0.6..1.15#0.01 except 1 except aa except bb except cc)", "description": "", "templateType": "anything", "can_override": false}, "yo": {"name": "yo", "group": "Ungrouped variables", "definition": "repeat(random(-5..5),5)", "description": "

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

", "templateType": "anything", "can_override": false}, "yo11": {"name": "yo11", "group": "Ungrouped variables", "definition": "100-yo10-yo9", "description": "", "templateType": "anything", "can_override": false}, "yearvector": {"name": "yearvector", "group": "Ungrouped variables", "definition": "vector(2015,2016)", "description": "", "templateType": "anything", "can_override": false}, "yo2": {"name": "yo2", "group": "Ungrouped variables", "definition": "random(850..1400#50)", "description": "", "templateType": "anything", "can_override": false}, "yo7": {"name": "yo7", "group": "Ungrouped variables", "definition": "random(20..40#1 except yo1 except yo4)", "description": "", "templateType": "anything", "can_override": false}, "xn": {"name": "xn", "group": "Ungrouped variables", "definition": "map((x-hsh)/hsc,x,xo)", "description": "

new transformed x values

", "templateType": "anything", "can_override": false}, "aa": {"name": "aa", "group": "Ungrouped variables", "definition": "random(0.6..1.15#0.01 except 1)", "description": "", "templateType": "anything", "can_override": false}, "fakeanswer3": {"name": "fakeanswer3", "group": "Ungrouped variables", "definition": "precround(cc*answervector[ii],2)", "description": "", "templateType": "anything", "can_override": false}, "f": {"name": "f", "group": "Ungrouped variables", "definition": "random(1.1..1.3#0.01 except a except b except c except d except e)", "description": "", "templateType": "anything", "can_override": false}, "c": {"name": "c", "group": "Ungrouped variables", "definition": "random(1.1..1.3#0.01 except a except b)", "description": "", "templateType": "anything", "can_override": false}, "increase": {"name": "increase", "group": "Ungrouped variables", "definition": "random(10..40#5)", "description": "", "templateType": "anything", "can_override": false}, "fakeanswer1": {"name": "fakeanswer1", "group": "Ungrouped variables", "definition": "precround(aa*answervector[ii],2)", "description": "", "templateType": "anything", "can_override": false}, "number": {"name": "number", "group": "Ungrouped variables", "definition": "random(1000..5000#200)", "description": "", "templateType": "anything", "can_override": false}, "yo8": {"name": "yo8", "group": "Ungrouped variables", "definition": "100-yo7-yo6", "description": "", "templateType": "anything", "can_override": false}, "answervector": {"name": "answervector", "group": "Ungrouped variables", "definition": "vector((yo2-yo0)/yo2*100,(yo3-yo1)/yo3*100)", "description": "", "templateType": "anything", "can_override": false}, "d": {"name": "d", "group": "Ungrouped variables", "definition": "random(1.1..1.3#0.01 except a except b except c)", "description": "", "templateType": "anything", "can_override": false}, "percent": {"name": "percent", "group": "Ungrouped variables", "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)", "description": "", "templateType": "anything", "can_override": false}, "hsc": {"name": "hsc", "group": "Ungrouped variables", "definition": "if(selector='hsc',random(-2,-1,-0.5,0.5,2),1)", "description": "", "templateType": "anything", "can_override": false}, "eee": {"name": "eee", "group": "Ungrouped variables", "definition": "random(1.1..1.3#0.01 except a except b except c except d)", "description": "", "templateType": "anything", "can_override": false}, "printchild": {"name": "printchild", "group": "Ungrouped variables", "definition": "if(year=\"2015\", yo0, yo1)", "description": "", "templateType": "anything", "can_override": false}, "printadult": {"name": "printadult", "group": "Ungrouped variables", "definition": "if(year=\"2015\", yo2-yo0, yo3-yo1)", "description": "", "templateType": "anything", "can_override": false}}, "variablesTest": {"condition": "fakeanswer1<100", "maxRuns": "1000"}, "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", "printchild", "printadult"], "variable_groups": [], "functions": {}, "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.2,1450,4,-80], axis:false, grid:false});\n \n $(question.getPart('p0').display.html).find('#dragpoint').append(div);\n \n var board = div.board;\n \n var xaxis = board.create('axis', [[0, 0], [3, 0]], {withLabel: false, name: \"Bank\", label: {offset: [250,-30]}});\n \n xaxis.removeAllTicks(); \n \n board.create('axis', [[0, 0], [0, 1400]], {hideTicks:true, withLabel: false, name: \"\", label: {offset: [-110,300]}});\n \n var pop0 = board.create('point', [1,-40],{name:'2015',fixed:true,size:0,color:'white',face:'diamond', label:{offset:[-20,-8]}});\n var pop1 = board.create('point',[3,-40],{name:'2016',fixed:true,size:0,color:'white',face:'diamond', label:{offset:[-20,-8]}});\n\n var leg1 = board.create('point',[1.8,600],{name:'Children',fixed:true,size:8,color:'#8F1D5E', face:'square', label:{offset:[11,0]}});\n var leg2 = board.create('point',[1.8,700],{name:'Adult',fixed:true,size:8,color:'#9999CC', face:'square', label:{offset:[11,0]}});\n \n var a = board.create('chart', [[1,1,3,3],[yo0,yo2,yo1,yo3]], {chartStyle:'bar',colors:['#DA2228','#6F1B75','#DA2228','#6F1B75'],width:1,fillOpacity:0.5});\n \n var txt1 = board.create('text',[-0.1,500, 'Number of Visitors'], {fontColor:'black', fontSize:14, rotate:90});\n\n}\n\nquestion.signals.on('HTMLAttached',function() {\n dragpoint_board();\n});", "css": "table#values th {\n background: white;\n text-align: center;\n}"}, "parts": [{"type": "1_n_2", "useCustomName": false, "customName": "", "marks": 0, "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "prompt": "
Number of visitors to Lakesville Theme Park
\n

\n

What percentage of visitors to the theme park in {year} were adults? 

", "minMarks": 0, "maxMarks": 0, "shuffleChoices": true, "displayType": "radiogroup", "displayColumns": 0, "showCellAnswerState": true, "choices": ["

{answer}%     

", "

{fakeanswer1}%        

", "

{fakeanswer2}%        

", "

{fakeanswer3}%          

", "

{fakeanswer4}%         

"], "matrix": ["1", 0, 0, 0, 0], "distractors": ["", "", "", "", ""]}], "partsMode": "all", "maxMarks": 0, "objectives": [], "penalties": [], "objectiveVisibility": "always", "penaltyVisibility": "always", "contributors": [{"name": "Gareth Woods", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/978/"}, {"name": "Ruth Hand", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/3228/"}]}]}], "contributors": [{"name": "Gareth Woods", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/978/"}, {"name": "Ruth Hand", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/3228/"}]}