-
Notifications
You must be signed in to change notification settings - Fork 23
CTATFractionBar
A component for visualizing and manipulating fractions. This component displays a rectangular area that can be subdivided into fractional parts of the whole area. For a circular display, see CTATPieChart.
<div id="fraction_bar" class="CTATFractionBar"
data-ctat-value="1/2+1/4+(0*1/8)"></div>
-
id
: Required. The name of the component, must be a valid html id name. -
class
: Required. The class list, must includeCTATFractionBar
and no other CTAT<component> classes. -
data-ctat-enabled
:true
orfalse
. Default istrue
. Controls if the component will accept student interaction. -
data-ctat-tutor
:true
orfalse
. Default istrue
. Controls if direct actions on the component trigger grading. -
data-ctat-show-feedback
:true
orfalse
. Default istrue
unlessdata-ctat-tutor="false"
. Determines if grading feedback is shown on the component. -
data-ctat-show-hint-highlight
:true
orfalse
. Default istrue
. Determines if hint highlighting is shown on the component. -
data-ctat-disable-on-correct
:true
orfalse
. Default istrue
. Determines if the component becomes locked when it is graded as correct. -
data-ctat-value
: A string representation of fractions. Default is "1/2+1/4+(0*1/8)". -
data-ctat-ctrl-denominator
: a ; separated list of CTAT controller components which control the number of pieces without changing the value represented. -
data-ctat-ctrl-numerator
: a ; separated list of CTAT controller components which control the number of selected pieces. -
data-ctat-ctrl-partition
: a ; separated list of CTAT controller components which control the number of pieces without changing the number of selected pieces.
The format of the value attribute and the Input of SetPieces
uses an algebraic style notation were fractions are represented by numerator
/denominator
. Multiplying by zero (eg) (0*1/8)
will add an deselected piece of the given fraction size. Multiple pieces can be displayed by using a +
between each fraction.
Valid CTAT controller components include CTATButton, CTATImageButton, CTATTextInput, and CTATNumericStepper.
In addition to the common Actions listed in Often Used TPAs this component supports the following actions:
Action | Input | Notes |
---|---|---|
SetPieces | a fraction string | See above for the format of this string. |
AddPiece | a fraction string | Adds a piece of the given value. |
set_denominator | an integer | Set the number of pieces without changing the value represented. |
set_number_pieces | an integer | Set the number of pieces without changing the number of pieces selected. |
.CTATFractionBar { width: 240px; height: 70px; } /* default size */
.CTATFractionBar--container { /* fraction bar container */
border: 2px solid #CCCCCC;
border-radius: 5px;
}
.CTATFractionBar--piece { /* fraction bar piece */
padding: 2px;
stroke-width: 1px;
stroke: black;
fill: purple;
}
.CTATFractionBar--piece[data-selected="false"] { /* deselected fraction bar piece */
fill-opacity: 0.2;
}
.CTATFractionBar--label { /* fraction bar piece value labels */
display: none;
pointer-events: none;
}
To show fraction labels on the pieces add the following CSS:
#my_fraction_bar .CTATFractionBar--label {
display: initial;
}
Example for mass producing the initial value of a CTATFractionBar:
<div id="fraction_bar" class="CTATFractionBar"
data-ctat-value="%(fb-value)%"></div>
Getting Started
Using CTAT
HTML Components
- HTML Examples
- CTATAudioButton
- CTATButton
- CTATChatPanel
- CTATCheckBox
- CTATComboBox
- CTATDoneButton
- CTATDragNDrop
- CTATFractionBar
- CTATGroupingComponent
- CTATHintButton
- CTATHintWindow
- CTATImageButton
- CTATJumble
- CTATNumberLine
- CTATNumericStepper
- CTATPieChart
- CTATRadioButton
- CTATSkillWindow
- CTATSubmitButton
- CTATTable
- CTATTextArea
- CTATTextField
- CTATTextInput
- CTATVideo