Graphs and images
Charting
Set bar heights to complete a chart.
Delivery
Respond, review and evaluate
Authoring
Visual editor available
No print view in this package

Try the interaction
Live example: @pie-element/charting@13.0.4 · players 1.0.0-beta.5.
Open all examples for this element →Use it in an item
Map the tag to an exact package version and match the model ID to the markup. The item player loads the views. You can use any frontend framework.
{
"elements": {
"charting": "@pie-element/charting@13.0.4"
},
"markup": "<charting id=\"example\"></charting>",
"models": [
{
"id": "example",
"element": "charting",
"chartType": "bar",
"title": "Class Test Score Distribution",
"prompt": "<p><strong>Data Analysis:</strong> The bar chart shows test scores for five students. Student C scored 15 points less than the class average of 85. Update the chart to show the correct score for Student C.</p><p>You can also add additional students if needed.</p>",
"promptEnabled": true,
"teacherInstructions": "<p><strong>Scoring:</strong> Student C should have a score of 70 (85 - 15 = 70). Award full credit if students correctly calculate and enter 70 for Student C.</p>",
"teacherInstructionsEnabled": true,
"addCategoryEnabled": true,
"changeInteractiveEnabled": true,
"changeEditableEnabled": true,
"changeAddCategoryEnabled": true,
"studentNewCategoryDefaultLabel": "New Student",
"data": [
{
"label": "Student A",
"value": 95,
"interactive": false,
"editable": false
},
{
"label": "Student B",
"value": 88,
"interactive": false,
"editable": false
},
{
"label": "Student C",
"value": 75,
"interactive": true,
"editable": false
},
{
"label": "Student D",
"value": 82,
"interactive": false,
"editable": false
},
{
"label": "Student E",
"value": 90,
"interactive": false,
"editable": false
}
],
"correctAnswer": {
"data": [
{
"label": "Student A",
"value": 95
},
{
"label": "Student B",
"value": 88
},
{
"label": "Student C",
"value": 70
},
{
"label": "Student D",
"value": 82
},
{
"label": "Student E",
"value": 90
}
]
},
"domain": {
"label": "Students"
},
"range": {
"label": "Test Scores",
"min": 0,
"max": 100,
"labelStep": 10
},
"graph": {
"width": 480,
"height": 480
},
"scoringType": "partial scoring",
"rationale": "<p>Student C's score should be 70 because the class average is 85 and Student C scored 15 points less: 85 - 15 = 70.</p>",
"rationaleEnabled": true,
"rubricEnabled": false
}
]
} Responses and scoring
The controller defines scoring for this element. Browser scoring returns one outcome per element. Your application combines those outcomes into an item score and handles trusted server scoring.
Model, configuration and session reference
The model holds content, configuration controls the editor, and the session holds the response. Fields below come from generated JSON Schemas.
Schema version: @pie-element/charting@13.0.6. Example version: 13.0.4. Use the schema matching your content. Schema checks cover data structure; controller validation checks authoring rules.
model fields (29)
| Field | Type | Meaning | Default / values |
|---|---|---|---|
idRequired | string | Identifier to identify the Pie Element in html markup, Must be unique within a pie item config. | — |
elementRequired | string | The html Element tag name: the key in the item config's `elements` map, e.g. "multiple-choice" | — |
accessibilityCatalogs | array | QTI-aligned accessibility catalogs whose cards dock to content nodes by `data-catalog-idref` | — |
addCategoryEnabled | boolean | Indicates if user can add more categories | true |
chartType | ChartingChartType | Indicates the chart type | "lineCross" |
correctAnswer | ChartingCorrectAnswer | Indicates marks that are set as answers | — |
data | array | Indicates default categories for the answer | — |
domain | ChartingDomain | Indicates domain settings for the chart | — |
graph | ChartingGraph | Indicates the chart line model; 480 by 480 when absent | — |
prompt | string | Indicates prompt value | — |
promptEnabled | boolean | Indicates if the prompt is enabled | true |
range | ChartingRange | Indicates range settings for the chart | — |
rationale | string | Indicates rationale for the answer | — |
rationaleEnabled | boolean | Indicates if Rationale are enabled | true |
scoringType | string | Indicates scoring type. `model()` applies the default when absent; `outcome()` scores an absent value as partial scoring unless the environment turns partial scoring off. | "all or nothing"["all or nothing","partial scoring"] |
studentInstructions | string | Not read by this element: it has no student instructions | — |
studentInstructionsEnabled | boolean | Indicates if Student Instructions are enabled. Not read by this element: it has no student instructions. | true |
teacherInstructions | string | Indicates teacher instructions | — |
teacherInstructionsEnabled | boolean | Indicates if Teacher Instructions are enabled | true |
title | string | Indicates chart title | — |
placeholderMessages | ChartingPlaceholderMessages | Not read by this element: the configuration's `titlePlaceholder` and `labelsPlaceholders` set the placeholders | — |
spellCheckEnabled | boolean | Indicates if spellcheck is enabled for the author. Default value is true | — |
rubricEnabled | boolean | Indicates if Rubric is enabled. Not read by this element: the settings panel sets it when `withRubric.settings` is on. | — |
changeInteractiveEnabled | boolean | Indicates if teacher can enable/disable data[]:interactive | false |
changeEditableEnabled | boolean | Indicates if teacher can enable/disable data[]:editable | false |
changeAddCategoryEnabled | boolean | Indicates if teacher can enable/disable addCategoryEnabled | false |
studentNewCategoryDefaultLabel | string | Label for new category in correct response and player's chart | "New Category" |
language | string | Indicates the language of the component Supported options: en, es, en_US, en-US, es_ES, es-ES, es_MX, es-MX | — |
extraCSSRules | ExtraCSSRules | Host-supplied CSS scoped to the element | — |
Named object types
AccessibilityCatalog
| Field | Type | Meaning | Default / values |
|---|---|---|---|
identifierRequired | string | See the named type or the example model. | — |
cardsRequired | array | See the named type or the example model. | — |
CatalogCard
| Field | Type | Meaning | Default / values |
|---|---|---|---|
catalogRequired | string | See the named type or the example model. | — |
language | string | See the named type or the example model. | — |
content | string | See the named type or the example model. | — |
payload | CatalogCardPayload | See the named type or the example model. | — |
SignLanguageCardPayload
| Field | Type | Meaning | Default / values |
|---|---|---|---|
signLang | string | Language tag for the signed translation — BCP 47, which admits ISO 639-3 subtags for languages with no 639-1/2 code. "ase" is ASL, matching QTI 3 `xml:lang`. This is the language of the *adaptation*, not the item's base content language (AfA/PNP's `languageOfAdaptation`). The distinction is load bearing: a Spanish item's signed alternate is LSM, not ASL, so `signLang` must never be inferred from the item or assessment content language. Optional, and redundant on almost every card. The card's `language` states the same code and is the only field pie-players resolves a card on — resolution runs before anything knows the card is a signing card, so it can only key on the generic field — and the player falls back to it when this is absent. Author it only where the two differ: a card tagged with the item's content language (`language: 'en-US'`, `signLang: 'ase'`) so resolution reaches it by the default-language rung. The pie-api-aws importer emits `language` alone. | — |
mediaRequired | MediaAssetRef | See the named type or the example model. | — |
fragment | MediaFragmentRange | See the named type or the example model. | — |
MediaAssetRef
| Field | Type | Meaning | Default / values |
|---|---|---|---|
versionRequired | number | See the named type or the example model. | — |
idRequired | string | See the named type or the example model. | — |
kindRequired | MediaKind | See the named type or the example model. | — |
sourcesRequired | array | See the named type or the example model. | — |
poster | string | See the named type or the example model. | — |
thumbnail | string | See the named type or the example model. | — |
durationSeconds | number | See the named type or the example model. | — |
tracks | array | See the named type or the example model. | — |
transcript | TranscriptRef | See the named type or the example model. | — |
label | string | See the named type or the example model. | — |
description | string | See the named type or the example model. | — |
lang | string | Language of the asset itself, as authored metadata. Sign-language cards leave it unset: the card's `language` already states the adaptation language, and a second copy is a second thing to keep in agreement. | — |
MediaSource
| Field | Type | Meaning | Default / values |
|---|---|---|---|
srcRequired | string | See the named type or the example model. | — |
type | string | MIME type, e.g. "video/mp4". | — |
width | number | See the named type or the example model. | — |
height | number | See the named type or the example model. | — |
bitrate | number | See the named type or the example model. | — |
TextTrackRef
| Field | Type | Meaning | Default / values |
|---|---|---|---|
srcRequired | string | See the named type or the example model. | — |
kindRequired | string | See the named type or the example model. | —["captions","subtitles","descriptions","chapters","metadata"] |
langRequired | string | See the named type or the example model. | — |
labelRequired | string | See the named type or the example model. | — |
default | boolean | See the named type or the example model. | — |
TranscriptRef
| Field | Type | Meaning | Default / values |
|---|---|---|---|
src | string | See the named type or the example model. | — |
html | string | See the named type or the example model. | — |
plainText | string | See the named type or the example model. | — |
lang | string | See the named type or the example model. | — |
MediaFragmentRange
| Field | Type | Meaning | Default / values |
|---|---|---|---|
startSecondsRequired | number | See the named type or the example model. | — |
endSeconds | number | See the named type or the example model. | — |
SpokenAudioCardPayload
| Field | Type | Meaning | Default / values |
|---|---|---|---|
mediaRequired | MediaAssetRef | See the named type or the example model. | — |
fragment | MediaFragmentRange | See the named type or the example model. | — |
ChartingCorrectAnswer
| Field | Type | Meaning | Default / values |
|---|---|---|---|
name | string | Indicates name of answer; the author keys the correct-response chart by it | — |
data | array | Indicates marks for the answer | — |
ChartingCategory
| Field | Type | Meaning | Default / values |
|---|---|---|---|
labelRequired | string | Indicates category label | — |
valueRequired | number | Indicates category value | — |
interactive | boolean | Indicates if category value is interactive | — |
editable | boolean | Indicates if category label is editable | — |
deletable | boolean | Indicates if category is deletable | — |
index | number | Position of the category in the author's chart; scoring reports it with each correct category | — |
correctness | ChartingCategoryCorrectness | Indicates correctness for a category | — |
ChartingCategoryCorrectness
| Field | Type | Meaning | Default / values |
|---|---|---|---|
valueRequired | string | See the named type or the example model. | —["correct","incorrect"] |
labelRequired | string | See the named type or the example model. | —["correct","incorrect"] |
ChartingDomain
| Field | Type | Meaning | Default / values |
|---|---|---|---|
label | string | Axis label | — |
min | number | Not read by this element: the chart fixes the category axis to 0–1 | — |
max | number | Not read by this element: the chart fixes the category axis to 0–1 | — |
step | number | Not read by this element: the chart fixes the category axis step to 1 | — |
labelStep | number | Not read by this element: the chart fixes the category axis label step to 1 | — |
axisLabel | string | Not read by this element: `label` labels the axis | — |
ChartingGraph
| Field | Type | Meaning | Default / values |
|---|---|---|---|
widthRequired | number | Width for chart representation | — |
heightRequired | number | Height for chart representation | — |
ChartingRange
| Field | Type | Meaning | Default / values |
|---|---|---|---|
label | string | Axis label | — |
min | number | Min value | 0 |
max | number | Max value | 1 |
step | number | Step value; `labelStep` applies when absent | — |
labelStep | number | Label step value | 1 |
axisLabel | string | Not read by this element: `label` labels the axis | — |
ChartingPlaceholderMessages
| Field | Type | Meaning | Default / values |
|---|---|---|---|
title | string | Indicates placeholder message if title is not defined | — |
labels | string | Indicates placeholder message if labels for range or domain are not defined | — |
ExtraCSSRules
| Field | Type | Meaning | Default / values |
|---|---|---|---|
names | array | See the named type or the example model. | — |
rules | string | See the named type or the example model. | — |
configuration fields (29)
| Field | Type | Meaning | Default / values |
|---|---|---|---|
baseInputConfiguration | EditableHtmlConfigureProp | Base editable html input configuration regarding plugins that are enabled/disabled E.g. audio, video, image | — |
prompt | EditableHtmlPluginConfigureRequired | Prompt configuration | — |
rationale | EditableHtmlPluginConfigureRequired | Rationale configuration | — |
spellCheck | ConfigurePropWithEnabled | Configuration for the author's spellcheck | — |
titlePlaceholder | ConfigureProp | Configuration for the title's placeholder | — |
labelsPlaceholders | ChartingLabelsPlaceholders | Labels Placeholder configuration | — |
scoringType | ConfigureProp | Scoring Type configuration | — |
settingsPanelDisabled | boolean | Indicates if the settings panel is not available | — |
studentInstructions | ConfigureProp | Student Instructions configuration | — |
teacherInstructions | EditableHtmlPluginConfigureRequired | Teacher Instructions configuration | — |
title | ConfigurePropWithEnabled | Chart title configuration. Not read by this element: `titlePlaceholder` sets the title's placeholder. | — |
instruction | ConfigureProp | Author instruction to build a new chart; `label` is the text shown above the form | — |
authorNewCategoryDefaults | ChartingAuthorNewCategoryDefaults | Configuration for new category in define chart | — |
chartDimensions | ChartingDimensions | Chart dimensions the author can set | — |
studentNewCategoryDefaultLabel | ConfigureProp | Not read by this element: the model's `studentNewCategoryDefaultLabel` labels the categories students add | — |
mathMlOptions | ConfigureMathMLProp | Configuration for editable-html | — |
maxImageWidth | ConfigureMaxImageDimensionsProp | Maximum image width for input fields | — |
maxImageHeight | ConfigureMaxImageDimensionsProp | Maximum image height for input fields | — |
withRubric | ConfigureProp | Rubric configuration - only relevant in environments that use pie-player-components | — |
chartingOptions | ChartingOptions | Authoring view settings for Charting | — |
availableChartTypes | ChartingAvailableChartTypes | Indicates the chart types that are available | — |
chartTypeLabel | string | Indicates the label for the chart type | — |
language | ConfigurePropWithEnabled | Language configuration | — |
labelsCharactersLimit | number | Indicates the maximum character limit for X and Y axis labels | — |
languageChoices | ConfigureLanguageOptions | Language choices configuration Only available if language is enabled | — |
contentDimensions | ContentDimensions | Dimensions of the authoring container | — |
showPrompt | boolean | Not read by this element: the model's `promptEnabled` shows the prompt | — |
promptLabel | string | Not read by this element: `prompt.label` labels the prompt | — |
settingsPartialScoring | boolean | Not read by this element: `scoringType.settings` shows the scoring control | — |
Named object types
EditableHtmlConfigureProp
| Field | Type | Meaning | Default / values |
|---|---|---|---|
math | EditableHtmlButtonConfigure | See the named type or the example model. | — |
audio | EditableHtmlButtonConfigure | See the named type or the example model. | — |
video | EditableHtmlButtonConfigure | See the named type or the example model. | — |
image | EditableHtmlButtonConfigure | See the named type or the example model. | — |
customPlugins | array | An array of objects that determine custom plugins. A custom plugin is an object which determines how the button will look like (icon) and the event name that will be triggered when the button gets pressed (event). | — |
blockquote | EditableHtmlButtonConfigure | See the named type or the example model. | — |
h3 | EditableHtmlButtonConfigure | See the named type or the example model. | — |
characters | EditableHtmlButtonConfigure | See the named type or the example model. | — |
bold | EditableHtmlButtonConfigure | See the named type or the example model. | — |
html | EditableHtmlButtonConfigure | See the named type or the example model. | — |
italic | EditableHtmlButtonConfigure | See the named type or the example model. | — |
ol_list | EditableHtmlButtonConfigure | See the named type or the example model. | — |
redo | EditableHtmlButtonConfigure | See the named type or the example model. | — |
strikethrough | EditableHtmlButtonConfigure | See the named type or the example model. | — |
sub | EditableHtmlButtonConfigure | See the named type or the example model. | — |
sup | EditableHtmlButtonConfigure | See the named type or the example model. | — |
table | EditableHtmlButtonConfigure | See the named type or the example model. | — |
ul_list | EditableHtmlButtonConfigure | See the named type or the example model. | — |
underline | EditableHtmlButtonConfigure | See the named type or the example model. | — |
undo | EditableHtmlButtonConfigure | See the named type or the example model. | — |
textAlign | EditableHtmlButtonConfigure | See the named type or the example model. | — |
showParagraphs | EditableHtmlButtonConfigure | See the named type or the example model. | — |
separateParagraphs | EditableHtmlButtonConfigure | See the named type or the example model. | — |
pasteFormatting | EditableHtmlButtonConfigure | See the named type or the example model. | — |
superscript | EditableHtmlButtonConfigure | See the named type or the example model. | — |
subscript | EditableHtmlButtonConfigure | See the named type or the example model. | — |
languageCharacters | EditableHtmlButtonConfigure | See the named type or the example model. | — |
responseArea | EditableHtmlButtonConfigure | See the named type or the example model. | — |
EditableHtmlButtonConfigure
| Field | Type | Meaning | Default / values |
|---|---|---|---|
disabled | boolean | Indicates if the plugin is disabled or not | — |
CustomPlugin
| Field | Type | Meaning | Default / values |
|---|---|---|---|
eventRequired | string | The name of the custom event. It needs to be valid (only letters, numbers and "_" can be used). The event is emitted with the "PIE-" prefix. | — |
iconAltRequired | string | The alt for the custom button icon | — |
iconTypeRequired | string | The icon type. Currently, only "SVG" is supported. | — |
iconRequired | string | The icon string. Currently, only SVG is supported, so it needs to be a valid svg. | — |
EditableHtmlPluginConfigureRequired
| Field | Type | Meaning | Default / values |
|---|---|---|---|
settings | boolean | Indicates if the item has to be displayed in the Settings Panel | — |
label | string | Indicates the label for the item that has to be displayed in the Settings Panel | — |
inputConfiguration | EditableHtmlConfigureProp | Configuration for editable-html | — |
required | boolean | Indicates if the item is required and the value cannot be empty | — |
ConfigurePropWithEnabled
| Field | Type | Meaning | Default / values |
|---|---|---|---|
settings | boolean | Indicates if the item has to be displayed in the Settings Panel | — |
label | string | Indicates the label for the item that has to be displayed in the Settings Panel | — |
enabled | boolean | Indicates the value of the item if it affects config-ui (eg.: if item is a switch and displaying an input on the config-ui depends on the switch value: on/off) | — |
ConfigureProp
| Field | Type | Meaning | Default / values |
|---|---|---|---|
settings | boolean | Indicates if the item has to be displayed in the Settings Panel | — |
label | string | Indicates the label for the item that has to be displayed in the Settings Panel | — |
ChartingLabelsPlaceholders
| Field | Type | Meaning | Default / values |
|---|---|---|---|
settings | boolean | Not read by this element | — |
label | string | Not read by this element | — |
enabled | boolean | Not read by this element | — |
top | string | This value is empty for charting. The property exist in order to be consistent with graphing configuration. | — |
right | string | This value is empty for charting. The property exist in order to be consistent with graphing configuration. | — |
bottom | string | Indicates the placeholder for the bottom label | — |
left | string | Indicates the placeholder for the left label | — |
ChartingAuthorNewCategoryDefaults
| Field | Type | Meaning | Default / values |
|---|---|---|---|
settings | boolean | Not read by this element | — |
label | string | Indicates the label for the new category | — |
interactive | boolean | Indicates if new category is interactive | — |
editable | boolean | Indicates if new category is editable | — |
ChartingDimensions
| Field | Type | Meaning | Default / values |
|---|---|---|---|
settings | boolean | Not read by this element | — |
label | string | Not read by this element | — |
showInConfigPanel | boolean | Shows the chart width and height controls | — |
width | ChartingDimensionConstraints | Width the author can set: `min` at least 50, `max` at most 700, `step` at most 200; 50, 700 and 20 when absent | — |
height | ChartingDimensionConstraints | Height the author can set: `min` at least 400, `max` at most 700, `step` at most 200; 400, 700 and 20 when absent | — |
ChartingDimensionConstraints
| Field | Type | Meaning | Default / values |
|---|---|---|---|
min | number | Smallest value the author can set | — |
max | number | Largest value the author can set | — |
step | number | Step of the control; values under 1 count as 20 | — |
ConfigureMathMLProp
| Field | Type | Meaning | Default / values |
|---|---|---|---|
mmlOutput | boolean | Indicates if model should have mathML output instead of latex | — |
mmlEditing | boolean | Indicates if mathML that's already in model should be editable | — |
ConfigureMaxImageDimensionsProp
| Field | Type | Meaning | Default / values |
|---|---|---|---|
teacherInstructions | number | Indicates the max dimension for images in teacher instructions | — |
prompt | number | Indicates the max dimension for images in prompt - this is also the default dimension for all other input fields if it's not specified | — |
rationale | number | Indicates the max dimension for images in rationale | — |
ChartingOptions
| Field | Type | Meaning | Default / values |
|---|---|---|---|
changeInteractive | ChartingOption | Indicates if teacher can enable/disable data[]:interactive | — |
changeEditable | ChartingOption | Indicates if teacher can enable/disable data[]:editable | — |
addCategory | ChartingOption | Indicates if teacher can enable/disable addCategoryEnabled | — |
mathMlOptions | ConfigureMathMLProp | Not read by this element: the configuration's top-level `mathMlOptions` applies | — |
ChartingOption
| Field | Type | Meaning | Default / values |
|---|---|---|---|
settings | boolean | Indicates if the item has to be displayed in the Settings Panel | — |
authoringLabel | string | Indicates the label for the option | — |
settingsLabel | string | Indicates the label for the item that has to be displayed in the Settings Panel | — |
ChartingAvailableChartTypes
| Field | Type | Meaning | Default / values |
|---|---|---|---|
bar | string | Indicates if bar chart is available and the label used for it. | — |
histogram | string | Indicates if histogram is available and the label used for it. | — |
lineDot | string | Indicates if line chart with dots is available and the label used for it. | — |
lineCross | string | Indicates if line chart with crosses is available and the label used for it. | — |
dotPlot | string | Indicates if dot plot is available and the label used for it. | — |
linePlot | string | Indicates if line plot is available and the label used for it. | — |
ConfigureLanguageOptions
| Field | Type | Meaning | Default / values |
|---|---|---|---|
labelRequired | string | See the named type or the example model. | — |
optionsRequired | array | See the named type or the example model. | — |
ConfigureLanguageOptionsProp
| Field | Type | Meaning | Default / values |
|---|---|---|---|
valueRequired | string | Value of the language option | — |
labelRequired | string | Label of the language option | — |
ContentDimensions
| Field | Type | Meaning | Default / values |
|---|---|---|---|
maxHeight | string | number | See the named type or the example model. | — |
maxWidth | string | number | See the named type or the example model. | — |
minHeight | string | number | See the named type or the example model. | — |
minWidth | string | number | See the named type or the example model. | — |
session fields (3)
| Field | Type | Meaning | Default / values |
|---|---|---|---|
id | string | Identifier of the session | — |
element | string | The element the session belongs to | — |
answer | array | The student's categories; the initial chart is scored when absent | — |
Named object types
ChartingCategory
| Field | Type | Meaning | Default / values |
|---|---|---|---|
labelRequired | string | Indicates category label | — |
valueRequired | number | Indicates category value | — |
interactive | boolean | Indicates if category value is interactive | — |
editable | boolean | Indicates if category label is editable | — |
deletable | boolean | Indicates if category is deletable | — |
index | number | Position of the category in the author's chart; scoring reports it with each correct category | — |
correctness | ChartingCategoryCorrectness | Indicates correctness for a category | — |
ChartingCategoryCorrectness
| Field | Type | Meaning | Default / values |
|---|---|---|---|
valueRequired | string | See the named type or the example model. | —["correct","incorrect"] |
labelRequired | string | See the named type or the example model. | —["correct","incorrect"] |
Accessibility and content requirements
PIE targets WCAG 2.2 AA. Provide clear prompts and media alternatives, and test the question with a keyboard and assistive technology. Manual testing is still incomplete; see the coverage notes below.
Accessibility and evidence · Element evidence and manual checks(opens in new tab)
Element package source(opens in new tab) · Example source(opens in new tab) · Snapshot cb30a68f