(function(){
var isPassed = false;
window.mheAdditionalActivities = window.mheAdditionalActivities || {};
window.mheAdditionalActivities.chapter_12_graph_activity_1 = {};
window.mheAdditionalActivities.chapter_12_graph_activity_1.initialize = function( section ) {
Init( section );
};
window.mheAdditionalActivities.chapter_12_graph_activity_1.show = function( section ) {
Show( section );
};
window.mheAdditionalActivities.chapter_12_graph_activity_1.showAnswer = function() {
showAnswer();
};
var board,
graph,
bars,
currentSection,
continueBtn,
submitGraphBtn,
feedbackGraph,
barLines = [],
midpoints = [],
tries = 0,
SEC_ID = "#digfir_section_36", // brb
DISABLED = false, // brb
ANSWERS = [
5.03,
4.57,
-100 ,
6.27,
5.57,
-100,
8.1,
6.6
];
var BOARD_OPTIONS = {
boundingbox: [ 0, 10, 11, 0],
showCopyright: false,
showNavigation: false
},
AXIS_OPTIONS_Y = {
straightFirst: false,
straightLast: true,
lastArrow: false,
strokeWidth: 4,
ticks: {
minorTicks: 0,
minTicksDistance: 16,
drawLabels: true,
majorHeight: 1000,
label: {
offset: [-20, 0],
highlight: false
}
},
highlight: false
},
AXIS_OPTIONS_X = {
straightFirst: true,
straightLast: false,
lastArrow: false,
strokeWidth: 2,
ticks: {
majorHeight: 0,
tickEndings: [0, -1],
opacity: 0.2,
label: {
visible: false,
offset: [0, -15],
highlight: false
}
},
highlight: false
},
TICKS_X_OPTIONS = {
tickEndings: [0, 1],
strokeColor: '#000',
strokeWidth: 2,
minorTicks: 0,
majorheight: 15,
labels: ["Early", "Middle", "Late"],
label: {
offset: [ -25, -10 ]
},
drawLabels: true,
drawZero: true
},
AXIS_ARR_Y = [
[0, 0],
[0, 1]
],
AXIS_ARR_X = [
[0, 0],
[16, 0]
];
var
BAR_OPTIONS = {
chartStyle: 'bar',
width: 1,
withLines: true,
opacity: 1,
colors: ["#2C9DBA", "#D40013", "white", "#2C9DBA", "#D40013", "white", "#2C9DBA", "#D40013" ]
},
POINTS_MALE_OPTIONS = {
name: "Females",
face: "[]",
color: "#D40013",
label: {
offset: [9, 0]
},
frozen: true,
highlight: false
},
POINTS_FEMALE_OPTIONS = {
name: "Males",
face: "[]",
color: "#2C9DBA",
label: {
offset: [9, 0]
},
frozen: true,
highlight: false
},
LINE_OPTIONS = {
straightFirst: false,
straightLast: false,
opacity: 0,
point1: {
snapSizeY: 1,
snapSizeX: 0.01
},
point2: {
snapSizeY: 1,
snapSizeX: 0.01
},
frozen: true,
highlight: false
},
POINTS_OPTIONS = {
name: "",
showInfobox: false,
visible: false
};
var Init = function( section ) {
currentSection = section;
submitGraphBtn = document.querySelector(".submit_graph");
feedbackGraph = document.querySelector(".feedback_graph");
};
// brb: This function gets called EVERY TIME the user navigates
// to the page.
var Show = function( section ){
// brb: if we have already disabled this graph then there is
// nothing that needs to be done;
if (DISABLED) {
return;
}
section.jq[0].style.display = "block";
// brb: if we have already completed this graph then set
// isPassed to true.
var all_arga_answered = true;
if (player.ARGA_running) {
var $curr_sec = $(SEC_ID);
$curr_sec.find("[data-type='question']").each(function() {
var $this = $(this);
var q_index = $this.attr("data-question_index");
var question = player.activity.questions[q_index];
all_arga_answered = all_arga_answered && (Number(question.queries[0].grade) > -1);
});
if (all_arga_answered) {
isPassed = true;
}
}
if( !graph ){
createGraph();
/*var patternID = 'diagonalHatchPattern';
var $board = $('#digfir_section_36 #G2Dbox2');
$board.find('defs').append(
'