// Numbas version: exam_results_page_options {"name": "Multiple Pie Charts", "extensions": ["jsxgraph"], "custom_part_types": [], "resources": [], "navigation": {"allowregen": true, "showfrontpage": false, "preventleave": false, "typeendtoleave": false}, "question_groups": [{"pickingStrategy": "all-ordered", "questions": [{"preamble": {"js": "function dragpoint_board() {\n var scope = question.scope;\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 \n var div = Numbas.extensions.jsxgraph.makeBoard('600px','600px',{boundingBox:[-0.5,82,16,-8], 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: true, 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', [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 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],[yo0,yo5,0]], {chartStyle:'bar',width:1,fillOpacity:1,dir:'horizontal'});\n var b = board.create('chart', [[4,5,6],[yo1,yo6,0]], {chartStyle:'bar',width:1,fillOpacity:1});\n var c = board.create('chart', [[7,8,9],[yo2,yo7,0]], {chartStyle:'bar',width:1,fillOpacity:1});\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.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}"}, "variable_groups": [], "variablesTest": {"condition": "", "maxRuns": 100}, "functions": {}, "name": "Multiple Pie Charts", "tags": [], "advice": "", "variables": {"maxx": {"description": "", "definition": "max(map(abs(a),a,xn)+5)+1", "name": "maxx", "group": "Ungrouped variables", "templateType": "anything"}, "bb": {"description": "", "definition": "random(0.7..1.3#0.01 except 1 except aa)", "name": "bb", "group": "Ungrouped variables", "templateType": "anything"}, "selector": {"description": "", "definition": "'vsc'", "name": "selector", "group": "Ungrouped variables", "templateType": "anything"}, "cc": {"description": "", "definition": "random(0.7..1.3#0.01 except 1 except aa except bb)", "name": "cc", "group": "Ungrouped variables", "templateType": "anything"}, "yearvector": {"description": "", "definition": "vector(2007,2008,2009,2010,2011,2012,2013)", "name": "yearvector", "group": "Ungrouped variables", "templateType": "anything"}, "yo41": {"description": "", "definition": "d*yo4", "name": "yo41", "group": "Ungrouped variables", "templateType": "anything"}, "yo01": {"description": "", "definition": "f*yo0", "name": "yo01", "group": "Ungrouped variables", "templateType": "anything"}, "yo5": {"description": "", "definition": "random(15..45#1 except yo1 except yo0 except yo2 except yo3 except yo4)", "name": "yo5", "group": "Ungrouped variables", "templateType": "anything"}, "yo": {"description": "

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

", "definition": "repeat(random(-5..5),5)", "name": "yo", "group": "Ungrouped variables", "templateType": "anything"}, "gradevector": {"description": "", "definition": "vector(yo0, yo1,yo2,yo3, yo4, yo5, yo6)", "name": "gradevector", "group": "Ungrouped variables", "templateType": "anything"}, "hsh": {"description": "

horizontal shift

", "definition": "if(selector='hsh',random(-3..3 except 0),0)", "name": "hsh", "group": "Ungrouped variables", "templateType": "anything"}, "fakeanswer4": {"description": "", "definition": "siground(dd*answer,2)", "name": "fakeanswer4", "group": "Ungrouped variables", "templateType": "anything"}, "yo2": {"description": "", "definition": "random(40..60#1 except yo1 except yo0)", "name": "yo2", "group": "Ungrouped variables", "templateType": "anything"}, "answer": {"description": "", "definition": "siground((students+ii*increase)*gradevector[ii]/100,3)", "name": "answer", "group": "Ungrouped variables", "templateType": "anything"}, "xn": {"description": "

new transformed x values

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

original x values

", "definition": "list(-2..2)", "name": "xo", "group": "Ungrouped variables", "templateType": "anything"}, "f": {"description": "", "definition": "random(1.1..1.3#0.01 except a except b except c except d except e)", "name": "f", "group": "Ungrouped variables", "templateType": "anything"}, "hsc": {"description": "", "definition": "if(selector='hsc',random(-2,-1,-0.5,0.5,2),1)", "name": "hsc", "group": "Ungrouped variables", "templateType": "anything"}, "yo31": {"description": "", "definition": "c*yo3", "name": "yo31", "group": "Ungrouped variables", "templateType": "anything"}, "yo21": {"description": "", "definition": "b*yo2", "name": "yo21", "group": "Ungrouped variables", "templateType": "anything"}, "maxvector": {"description": "", "definition": "vector(yo1, yo2,yo3, yo4, yo5, yo11, yo21,yo31, yo41, yo51)", "name": "maxvector", "group": "Ungrouped variables", "templateType": "anything"}, "d": {"description": "", "definition": "random(1.1..1.3#0.01 except a except b except c)", "name": "d", "group": "Ungrouped variables", "templateType": "anything"}, "fakeanswer2": {"description": "", "definition": "siground(bb*answer,2)", "name": "fakeanswer2", "group": "Ungrouped variables", "templateType": "anything"}, "fakeanswer1": {"description": "", "definition": "siground(aa*answer,2)", "name": "fakeanswer1", "group": "Ungrouped variables", "templateType": "anything"}, "yn": {"description": "

new y values after the transformation

", "definition": "map(vsc*y+vsh,y,yo)", "name": "yn", "group": "Ungrouped variables", "templateType": "anything"}, "yo7": {"description": "", "definition": "4", "name": "yo7", "group": "Ungrouped variables", "templateType": "number"}, "year": {"description": "", "definition": "yearvector[ii]", "name": "year", "group": "Ungrouped variables", "templateType": "anything"}, "yo1": {"description": "", "definition": "random(30..50#1 except yo0)", "name": "yo1", "group": "Ungrouped variables", "templateType": "anything"}, "dd": {"description": "", "definition": "random(0.7..1.3#0.01 except 1 except aa except bb except cc)", "name": "dd", "group": "Ungrouped variables", "templateType": "anything"}, "maxy": {"description": "", "definition": "max(list(maxvector)) + 1", "name": "maxy", "group": "Ungrouped variables", "templateType": "anything"}, "a": {"description": "", "definition": "random(1.1..1.3#0.01)", "name": "a", "group": "Ungrouped variables", "templateType": "anything"}, "fakeanswer3": {"description": "", "definition": "siground(cc*answer,2)", "name": "fakeanswer3", "group": "Ungrouped variables", "templateType": "anything"}, "aa": {"description": "", "definition": "random(0.7..1.3#0.01 except 1)", "name": "aa", "group": "Ungrouped variables", "templateType": "anything"}, "yo6": {"description": "", "definition": "random(25..45#1 except yo1 except yo0 except yo2 except yo3 except yo4 except yo5)", "name": "yo6", "group": "Ungrouped variables", "templateType": "anything"}, "students": {"description": "", "definition": "random(120..320#1)", "name": "students", "group": "Ungrouped variables", "templateType": "anything"}, "yo4": {"description": "", "definition": "random(10..30#1 except yo1 except yo0 except yo2 except yo3)", "name": "yo4", "group": "Ungrouped variables", "templateType": "anything"}, "yo11": {"description": "", "definition": "a*yo1", "name": "yo11", "group": "Ungrouped variables", "templateType": "anything"}, "yo3": {"description": "", "definition": "random(50..70#1 except yo1 except yo0 except yo2)", "name": "yo3", "group": "Ungrouped variables", "templateType": "anything"}, "yo8": {"description": "", "definition": "3..17#1", "name": "yo8", "group": "Ungrouped variables", "templateType": "range"}, "percent": {"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", "group": "Ungrouped variables", "templateType": "anything"}, "b": {"description": "", "definition": "random(1.1..1.3#0.01 except a)", "name": "b", "group": "Ungrouped variables", "templateType": "anything"}, "yo9": {"description": "", "definition": "5", "name": "yo9", "group": "Ungrouped variables", "templateType": "number"}, "vsc": {"description": "", "definition": "if(selector='vsc',random(-2,-1,-0.5,0.5,2),1)", "name": "vsc", "group": "Ungrouped variables", "templateType": "anything"}, "yo0": {"description": "", "definition": "random(20..40#1)", "name": "yo0", "group": "Ungrouped variables", "templateType": "anything"}, "increase": {"description": "", "definition": "random(10..40#5)", "name": "increase", "group": "Ungrouped variables", "templateType": "anything"}, "c": {"description": "", "definition": "random(1.1..1.3#0.01 except a except b)", "name": "c", "group": "Ungrouped variables", "templateType": "anything"}, "eee": {"description": "", "definition": "random(1.1..1.3#0.01 except a except b except c except d)", "name": "eee", "group": "Ungrouped variables", "templateType": "anything"}, "vsh": {"description": "

vertical shift

", "definition": "if(selector='vsh',random(-3..3#0.5 except 0),0)\n", "name": "vsh", "group": "Ungrouped variables", "templateType": "anything"}, "ii": {"description": "", "definition": "random(3..6#1)", "name": "ii", "group": "Ungrouped variables", "templateType": "anything"}, "yo51": {"description": "", "definition": "eee*yo5", "name": "yo51", "group": "Ungrouped variables", "templateType": "anything"}}, "parts": [{"scripts": {}, "showCorrectAnswer": true, "choices": ["

{answer} students         

", "

{fakeanswer1} students          

", "

{fakeanswer2} students          

", "

{fakeanswer3} students          

", "

{fakeanswer4} students          

"], "maxMarks": 0, "variableReplacements": [], "marks": 0, "shuffleChoices": true, "distractors": ["", "", "", "", ""], "type": "1_n_2", "minMarks": 0, "variableReplacementStrategy": "originalfirst", "displayColumns": 0, "matrix": ["1", 0, 0, 0, 0], "displayType": "radiogroup", "prompt": "
Student Pass Rate for Module Z
\n

\n

If there were {students} students on Module Z in 2007 and the numbers went up every year by {increase}, how many students passed the module in {year}?

", "showFeedbackIcon": true}], "ungrouped_variables": ["selector", "vsh", "hsh", "vsc", "hsc", "yo", "yn", "xo", "xn", "yo0", "yo1", "yo2", "yo3", "yo4", "maxx", "maxy", "yo01", "yo11", "yo21", "yo31", "yo41", "yo5", "yo51", "maxvector", "a", "b", "c", "d", "eee", "f", "answer", "fakeanswer1", "fakeanswer2", "fakeanswer3", "fakeanswer4", "aa", "bb", "cc", "dd", "percent", "students", "yo6", "yearvector", "ii", "year", "gradevector", "increase", "yo7", "yo9", "yo8"], "extensions": ["jsxgraph"], "metadata": {"description": "

Widget Sales

", "licence": "Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International"}, "statement": "", "rulesets": {"std": ["all", "fractionNumbers"]}, "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/"}]}