← Element library

Graphs and images

Charting

Set bar heights to complete a chart.

Delivery

Respond, review and evaluate

Authoring

Visual editor available

Print

No print view in this package

The prompt "Data Analysis: 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. You can also add additional students if needed." above a bar chart titled "Class Test Score Distribution" with bars for Students A to E.
Charting example

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
    }
  ]
}

Embed an item · Embed authoring · Print integration

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.

Scoring, partial credit and rubrics →

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)
FieldTypeMeaningDefault / values
idRequiredstringIdentifier to identify the Pie Element in html markup, Must be unique within a pie item config.—
elementRequiredstringThe html Element tag name: the key in the item config's `elements` map, e.g. "multiple-choice"—
accessibilityCatalogsarrayQTI-aligned accessibility catalogs whose cards dock to content nodes by `data-catalog-idref`—
addCategoryEnabledbooleanIndicates if user can add more categoriestrue
chartTypeChartingChartTypeIndicates the chart type"lineCross"
correctAnswerChartingCorrectAnswerIndicates marks that are set as answers—
dataarrayIndicates default categories for the answer—
domainChartingDomainIndicates domain settings for the chart—
graphChartingGraphIndicates the chart line model; 480 by 480 when absent—
promptstringIndicates prompt value—
promptEnabledbooleanIndicates if the prompt is enabledtrue
rangeChartingRangeIndicates range settings for the chart—
rationalestringIndicates rationale for the answer—
rationaleEnabledbooleanIndicates if Rationale are enabledtrue
scoringTypestringIndicates 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"]
studentInstructionsstringNot read by this element: it has no student instructions—
studentInstructionsEnabledbooleanIndicates if Student Instructions are enabled. Not read by this element: it has no student instructions.true
teacherInstructionsstringIndicates teacher instructions—
teacherInstructionsEnabledbooleanIndicates if Teacher Instructions are enabledtrue
titlestringIndicates chart title—
placeholderMessagesChartingPlaceholderMessagesNot read by this element: the configuration's `titlePlaceholder` and `labelsPlaceholders` set the placeholders—
spellCheckEnabledbooleanIndicates if spellcheck is enabled for the author. Default value is true—
rubricEnabledbooleanIndicates if Rubric is enabled. Not read by this element: the settings panel sets it when `withRubric.settings` is on.—
changeInteractiveEnabledbooleanIndicates if teacher can enable/disable data[]:interactivefalse
changeEditableEnabledbooleanIndicates if teacher can enable/disable data[]:editablefalse
changeAddCategoryEnabledbooleanIndicates if teacher can enable/disable addCategoryEnabledfalse
studentNewCategoryDefaultLabelstringLabel for new category in correct response and player's chart"New Category"
languagestringIndicates the language of the component Supported options: en, es, en_US, en-US, es_ES, es-ES, es_MX, es-MX—
extraCSSRulesExtraCSSRulesHost-supplied CSS scoped to the element—

Named object types

AccessibilityCatalog
FieldTypeMeaningDefault / values
identifierRequiredstringSee the named type or the example model.—
cardsRequiredarraySee the named type or the example model.—
CatalogCard
FieldTypeMeaningDefault / values
catalogRequiredstringSee the named type or the example model.—
languagestringSee the named type or the example model.—
contentstringSee the named type or the example model.—
payloadCatalogCardPayloadSee the named type or the example model.—
SignLanguageCardPayload
FieldTypeMeaningDefault / values
signLangstringLanguage 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.—
mediaRequiredMediaAssetRefSee the named type or the example model.—
fragmentMediaFragmentRangeSee the named type or the example model.—
MediaAssetRef
FieldTypeMeaningDefault / values
versionRequirednumberSee the named type or the example model.—
idRequiredstringSee the named type or the example model.—
kindRequiredMediaKindSee the named type or the example model.—
sourcesRequiredarraySee the named type or the example model.—
posterstringSee the named type or the example model.—
thumbnailstringSee the named type or the example model.—
durationSecondsnumberSee the named type or the example model.—
tracksarraySee the named type or the example model.—
transcriptTranscriptRefSee the named type or the example model.—
labelstringSee the named type or the example model.—
descriptionstringSee the named type or the example model.—
langstringLanguage 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
FieldTypeMeaningDefault / values
srcRequiredstringSee the named type or the example model.—
typestringMIME type, e.g. "video/mp4".—
widthnumberSee the named type or the example model.—
heightnumberSee the named type or the example model.—
bitratenumberSee the named type or the example model.—
TextTrackRef
FieldTypeMeaningDefault / values
srcRequiredstringSee the named type or the example model.—
kindRequiredstringSee the named type or the example model.—["captions","subtitles","descriptions","chapters","metadata"]
langRequiredstringSee the named type or the example model.—
labelRequiredstringSee the named type or the example model.—
defaultbooleanSee the named type or the example model.—
TranscriptRef
FieldTypeMeaningDefault / values
srcstringSee the named type or the example model.—
htmlstringSee the named type or the example model.—
plainTextstringSee the named type or the example model.—
langstringSee the named type or the example model.—
MediaFragmentRange
FieldTypeMeaningDefault / values
startSecondsRequirednumberSee the named type or the example model.—
endSecondsnumberSee the named type or the example model.—
SpokenAudioCardPayload
FieldTypeMeaningDefault / values
mediaRequiredMediaAssetRefSee the named type or the example model.—
fragmentMediaFragmentRangeSee the named type or the example model.—
ChartingCorrectAnswer
FieldTypeMeaningDefault / values
namestringIndicates name of answer; the author keys the correct-response chart by it—
dataarrayIndicates marks for the answer—
ChartingCategory
FieldTypeMeaningDefault / values
labelRequiredstringIndicates category label—
valueRequirednumberIndicates category value—
interactivebooleanIndicates if category value is interactive—
editablebooleanIndicates if category label is editable—
deletablebooleanIndicates if category is deletable—
indexnumberPosition of the category in the author's chart; scoring reports it with each correct category—
correctnessChartingCategoryCorrectnessIndicates correctness for a category—
ChartingCategoryCorrectness
FieldTypeMeaningDefault / values
valueRequiredstringSee the named type or the example model.—["correct","incorrect"]
labelRequiredstringSee the named type or the example model.—["correct","incorrect"]
ChartingDomain
FieldTypeMeaningDefault / values
labelstringAxis label—
minnumberNot read by this element: the chart fixes the category axis to 0–1—
maxnumberNot read by this element: the chart fixes the category axis to 0–1—
stepnumberNot read by this element: the chart fixes the category axis step to 1—
labelStepnumberNot read by this element: the chart fixes the category axis label step to 1—
axisLabelstringNot read by this element: `label` labels the axis—
ChartingGraph
FieldTypeMeaningDefault / values
widthRequirednumberWidth for chart representation—
heightRequirednumberHeight for chart representation—
ChartingRange
FieldTypeMeaningDefault / values
labelstringAxis label—
minnumberMin value0
maxnumberMax value1
stepnumberStep value; `labelStep` applies when absent—
labelStepnumberLabel step value1
axisLabelstringNot read by this element: `label` labels the axis—
ChartingPlaceholderMessages
FieldTypeMeaningDefault / values
titlestringIndicates placeholder message if title is not defined—
labelsstringIndicates placeholder message if labels for range or domain are not defined—
ExtraCSSRules
FieldTypeMeaningDefault / values
namesarraySee the named type or the example model.—
rulesstringSee the named type or the example model.—
Open the complete JSON Schema
configuration fields (29)
FieldTypeMeaningDefault / values
baseInputConfigurationEditableHtmlConfigurePropBase editable html input configuration regarding plugins that are enabled/disabled E.g. audio, video, image—
promptEditableHtmlPluginConfigureRequiredPrompt configuration—
rationaleEditableHtmlPluginConfigureRequiredRationale configuration—
spellCheckConfigurePropWithEnabledConfiguration for the author's spellcheck—
titlePlaceholderConfigurePropConfiguration for the title's placeholder—
labelsPlaceholdersChartingLabelsPlaceholdersLabels Placeholder configuration—
scoringTypeConfigurePropScoring Type configuration—
settingsPanelDisabledbooleanIndicates if the settings panel is not available—
studentInstructionsConfigurePropStudent Instructions configuration—
teacherInstructionsEditableHtmlPluginConfigureRequiredTeacher Instructions configuration—
titleConfigurePropWithEnabledChart title configuration. Not read by this element: `titlePlaceholder` sets the title's placeholder.—
instructionConfigurePropAuthor instruction to build a new chart; `label` is the text shown above the form—
authorNewCategoryDefaultsChartingAuthorNewCategoryDefaultsConfiguration for new category in define chart—
chartDimensionsChartingDimensionsChart dimensions the author can set—
studentNewCategoryDefaultLabelConfigurePropNot read by this element: the model's `studentNewCategoryDefaultLabel` labels the categories students add—
mathMlOptionsConfigureMathMLPropConfiguration for editable-html—
maxImageWidthConfigureMaxImageDimensionsPropMaximum image width for input fields—
maxImageHeightConfigureMaxImageDimensionsPropMaximum image height for input fields—
withRubricConfigurePropRubric configuration - only relevant in environments that use pie-player-components—
chartingOptionsChartingOptionsAuthoring view settings for Charting—
availableChartTypesChartingAvailableChartTypesIndicates the chart types that are available—
chartTypeLabelstringIndicates the label for the chart type—
languageConfigurePropWithEnabledLanguage configuration—
labelsCharactersLimitnumberIndicates the maximum character limit for X and Y axis labels—
languageChoicesConfigureLanguageOptionsLanguage choices configuration Only available if language is enabled—
contentDimensionsContentDimensionsDimensions of the authoring container—
showPromptbooleanNot read by this element: the model's `promptEnabled` shows the prompt—
promptLabelstringNot read by this element: `prompt.label` labels the prompt—
settingsPartialScoringbooleanNot read by this element: `scoringType.settings` shows the scoring control—

Named object types

EditableHtmlConfigureProp
FieldTypeMeaningDefault / values
mathEditableHtmlButtonConfigureSee the named type or the example model.—
audioEditableHtmlButtonConfigureSee the named type or the example model.—
videoEditableHtmlButtonConfigureSee the named type or the example model.—
imageEditableHtmlButtonConfigureSee the named type or the example model.—
customPluginsarrayAn 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).—
blockquoteEditableHtmlButtonConfigureSee the named type or the example model.—
h3EditableHtmlButtonConfigureSee the named type or the example model.—
charactersEditableHtmlButtonConfigureSee the named type or the example model.—
boldEditableHtmlButtonConfigureSee the named type or the example model.—
htmlEditableHtmlButtonConfigureSee the named type or the example model.—
italicEditableHtmlButtonConfigureSee the named type or the example model.—
ol_listEditableHtmlButtonConfigureSee the named type or the example model.—
redoEditableHtmlButtonConfigureSee the named type or the example model.—
strikethroughEditableHtmlButtonConfigureSee the named type or the example model.—
subEditableHtmlButtonConfigureSee the named type or the example model.—
supEditableHtmlButtonConfigureSee the named type or the example model.—
tableEditableHtmlButtonConfigureSee the named type or the example model.—
ul_listEditableHtmlButtonConfigureSee the named type or the example model.—
underlineEditableHtmlButtonConfigureSee the named type or the example model.—
undoEditableHtmlButtonConfigureSee the named type or the example model.—
textAlignEditableHtmlButtonConfigureSee the named type or the example model.—
showParagraphsEditableHtmlButtonConfigureSee the named type or the example model.—
separateParagraphsEditableHtmlButtonConfigureSee the named type or the example model.—
pasteFormattingEditableHtmlButtonConfigureSee the named type or the example model.—
superscriptEditableHtmlButtonConfigureSee the named type or the example model.—
subscriptEditableHtmlButtonConfigureSee the named type or the example model.—
languageCharactersEditableHtmlButtonConfigureSee the named type or the example model.—
responseAreaEditableHtmlButtonConfigureSee the named type or the example model.—
EditableHtmlButtonConfigure
FieldTypeMeaningDefault / values
disabledbooleanIndicates if the plugin is disabled or not—
CustomPlugin
FieldTypeMeaningDefault / values
eventRequiredstringThe 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.—
iconAltRequiredstringThe alt for the custom button icon—
iconTypeRequiredstringThe icon type. Currently, only "SVG" is supported.—
iconRequiredstringThe icon string. Currently, only SVG is supported, so it needs to be a valid svg.—
EditableHtmlPluginConfigureRequired
FieldTypeMeaningDefault / values
settingsbooleanIndicates if the item has to be displayed in the Settings Panel—
labelstringIndicates the label for the item that has to be displayed in the Settings Panel—
inputConfigurationEditableHtmlConfigurePropConfiguration for editable-html—
requiredbooleanIndicates if the item is required and the value cannot be empty—
ConfigurePropWithEnabled
FieldTypeMeaningDefault / values
settingsbooleanIndicates if the item has to be displayed in the Settings Panel—
labelstringIndicates the label for the item that has to be displayed in the Settings Panel—
enabledbooleanIndicates 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
FieldTypeMeaningDefault / values
settingsbooleanIndicates if the item has to be displayed in the Settings Panel—
labelstringIndicates the label for the item that has to be displayed in the Settings Panel—
ChartingLabelsPlaceholders
FieldTypeMeaningDefault / values
settingsbooleanNot read by this element—
labelstringNot read by this element—
enabledbooleanNot read by this element—
topstringThis value is empty for charting. The property exist in order to be consistent with graphing configuration.—
rightstringThis value is empty for charting. The property exist in order to be consistent with graphing configuration.—
bottomstringIndicates the placeholder for the bottom label—
leftstringIndicates the placeholder for the left label—
ChartingAuthorNewCategoryDefaults
FieldTypeMeaningDefault / values
settingsbooleanNot read by this element—
labelstringIndicates the label for the new category—
interactivebooleanIndicates if new category is interactive—
editablebooleanIndicates if new category is editable—
ChartingDimensions
FieldTypeMeaningDefault / values
settingsbooleanNot read by this element—
labelstringNot read by this element—
showInConfigPanelbooleanShows the chart width and height controls—
widthChartingDimensionConstraintsWidth the author can set: `min` at least 50, `max` at most 700, `step` at most 200; 50, 700 and 20 when absent—
heightChartingDimensionConstraintsHeight the author can set: `min` at least 400, `max` at most 700, `step` at most 200; 400, 700 and 20 when absent—
ChartingDimensionConstraints
FieldTypeMeaningDefault / values
minnumberSmallest value the author can set—
maxnumberLargest value the author can set—
stepnumberStep of the control; values under 1 count as 20—
ConfigureMathMLProp
FieldTypeMeaningDefault / values
mmlOutputbooleanIndicates if model should have mathML output instead of latex—
mmlEditingbooleanIndicates if mathML that's already in model should be editable—
ConfigureMaxImageDimensionsProp
FieldTypeMeaningDefault / values
teacherInstructionsnumberIndicates the max dimension for images in teacher instructions—
promptnumberIndicates the max dimension for images in prompt - this is also the default dimension for all other input fields if it's not specified—
rationalenumberIndicates the max dimension for images in rationale—
ChartingOptions
FieldTypeMeaningDefault / values
changeInteractiveChartingOptionIndicates if teacher can enable/disable data[]:interactive—
changeEditableChartingOptionIndicates if teacher can enable/disable data[]:editable—
addCategoryChartingOptionIndicates if teacher can enable/disable addCategoryEnabled—
mathMlOptionsConfigureMathMLPropNot read by this element: the configuration's top-level `mathMlOptions` applies—
ChartingOption
FieldTypeMeaningDefault / values
settingsbooleanIndicates if the item has to be displayed in the Settings Panel—
authoringLabelstringIndicates the label for the option—
settingsLabelstringIndicates the label for the item that has to be displayed in the Settings Panel—
ChartingAvailableChartTypes
FieldTypeMeaningDefault / values
barstringIndicates if bar chart is available and the label used for it.—
histogramstringIndicates if histogram is available and the label used for it.—
lineDotstringIndicates if line chart with dots is available and the label used for it.—
lineCrossstringIndicates if line chart with crosses is available and the label used for it.—
dotPlotstringIndicates if dot plot is available and the label used for it.—
linePlotstringIndicates if line plot is available and the label used for it.—
ConfigureLanguageOptions
FieldTypeMeaningDefault / values
labelRequiredstringSee the named type or the example model.—
optionsRequiredarraySee the named type or the example model.—
ConfigureLanguageOptionsProp
FieldTypeMeaningDefault / values
valueRequiredstringValue of the language option—
labelRequiredstringLabel of the language option—
ContentDimensions
FieldTypeMeaningDefault / values
maxHeightstring | numberSee the named type or the example model.—
maxWidthstring | numberSee the named type or the example model.—
minHeightstring | numberSee the named type or the example model.—
minWidthstring | numberSee the named type or the example model.—
Open the complete JSON Schema
session fields (3)
FieldTypeMeaningDefault / values
idstringIdentifier of the session—
elementstringThe element the session belongs to—
answerarrayThe student's categories; the initial chart is scored when absent—

Named object types

ChartingCategory
FieldTypeMeaningDefault / values
labelRequiredstringIndicates category label—
valueRequirednumberIndicates category value—
interactivebooleanIndicates if category value is interactive—
editablebooleanIndicates if category label is editable—
deletablebooleanIndicates if category is deletable—
indexnumberPosition of the category in the author's chart; scoring reports it with each correct category—
correctnessChartingCategoryCorrectnessIndicates correctness for a category—
ChartingCategoryCorrectness
FieldTypeMeaningDefault / values
valueRequiredstringSee the named type or the example model.—["correct","incorrect"]
labelRequiredstringSee the named type or the example model.—["correct","incorrect"]
Open the complete JSON Schema

How to use the schemas →

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