init({
range: [[-0.05, 1], [0, 1.1]],
scale: 360
});
rectchart([1, DENOMINATOR - 1], [ RED, "#CCC" ]);
style({ color: RED }, function() {
label([DENOMINATOR_FRACTION / 2, 1.05], "\\frac{" + 1 + "}{" + DENOMINATOR + "}", "center" );
});
Divide \red{\dfrac{1}{DENOMINATOR}}
into \blue{INTEGER}
pieces.
rect(0, 0, DENOMINATOR_FRACTION, INTEGER_FRACTION, {fill: BLUE, stroke: KhanUtil._BACKGROUND});
style({ color: BLUE }, function() {
label([0, 1 / (2 * INTEGER)], "\\frac{" + 1 + "}{" + INTEGER + "}", "left" );
});
for (var i=1; i < INTEGER; i++) {
line([0, i * INTEGER_FRACTION], [DENOMINATOR_FRACTION, i * INTEGER_FRACTION], {stroke: KhanUtil._BACKGROUND});
}
Each piece is \green{\dfrac{1}{DENOMINATOR * INTEGER}}
of the whole.
rect(0, 0, DENOMINATOR_FRACTION, 1, {fill: "#CCC", stroke: KhanUtil._BACKGROUND, opacity: 0.7});
rect(0, 0, DENOMINATOR_FRACTION, INTEGER_FRACTION, {fill: GREEN, stroke: KhanUtil._BACKGROUND});
style({ color: BLACK }, function() {
label([DENOMINATOR_FRACTION/2, 1 / (2 * INTEGER)], "\\frac{" + 1 + "}{" + (DENOMINATOR * INTEGER) + "}", "center" );
});
for (var i=1; i < INTEGER; i++) {
line([0, i * INTEGER_FRACTION], [1, i * INTEGER_FRACTION], {stroke: KhanUtil._BACKGROUND});
}
\dfrac{1}{DENOMINATOR} \div INTEGER = \dfrac{1}{DENOMINATOR * INTEGER}