At Hogwarts, there are four houses:
toSentence(HOUSES). The bar chart below shows the
number of house points that each house received today.
How many house points did HOUSES[INDEX] receive?
init({
range: [[-2, 14], [-3, 11.5]],
scale: [27, 30]
});
_.times(10, function(y) {
label([0, y], y * 10, "left", false);
style({
stroke: "#000",
strokeWidth: 1,
opacity: 0.2
}, function() {
line([0, y], [13, y]);
});
});
_.each(VALUES, function(value, index) {
style({ stroke: null, fill: "#9ab8ed", opacity: 1.0 });
path([[index * 3 + 1.5, 0], [index * 3 + 1.5, value / 10],
[index * 3 + 2.5, value / 10],
[index * 3 + 2.5, 0], true]);
style({ opacity: 1.0 });
label([index * 3 + 2, 0], HOUSES[index], "below", false);
});
style({ stroke: "#000", strokeWidth: 2, opacity: 1.0 });
line( [ 0, 0 ], [ 13, 0 ] );
line( [ 0, 0 ], [ 0, 10 ] );
label( [ 6.5, -0.8 ],
$._("House"),
"below", false ).css('font-weight', 'bold');
label( [ -1.5, 5 ],
"House points",
"center", false ).addClass( "rotate" )
.css('font-weight', 'bold');
label( [ 6.5, 10.5 ],
"House points earned today",
"above", false ).css('font-weight', 'bold');
VALUES[INDEX]
house points
Find the bar for HOUSES[INDEX].
style({ stroke: PINK, fill: null, strokeWidth: 2 });
ellipse([INDEX * 3 + 2, -0.6], [1.5, 0.5]);
There is no bar for HOUSES[INDEX], which
means HOUSES[INDEX] recieved 0
house points.
Compare the height of the bar for
HOUSES[INDEX] to the scale on the left.
style({
stroke: PINK,
strokeWidth: 2,
arrows: "->",
strokeDasharray: "-"
});
line([INDEX * 3 + 1.5, VALUES[INDEX] / 10],
[0, VALUES[INDEX] / 10]);
HOUSES[INDEX] received
VALUES[INDEX]
house points.