← Element library

Graphs and images

Graphing

Plot points and lines on a coordinate grid.

Delivery

Respond, review and evaluate

Authoring

Visual editor available

Print

No print view in this package

The prompt "Plot the line for the equation y = 2x + 1. Use points to mark where the line crosses each axis." above an empty coordinate grid titled "Graphing Linear Functions" from −5 to 5, with Point, Line and Segment tools and Undo, Redo and Reset buttons.
Graphing example

Try the interaction

Live example: @pie-element/graphing@11.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": {
    "graphing": "@pie-element/graphing@11.0.4"
  },
  "markup": "<graphing id=\"example\"></graphing>",
  "models": [
    {
      "id": "example",
      "element": "graphing",
      "prompt": "<p>Plot the line for the equation <math><mi>y</mi><mo>=</mo><mn>2</mn><mi>x</mi><mo>+</mo><mn>1</mn></math></p><p>Use points to mark where the line crosses each axis.</p>",
      "promptEnabled": true,
      "title": "Graphing Linear Functions",
      "titleEnabled": true,
      "toolbarTools": [
        "point",
        "line",
        "segment"
      ],
      "defaultTool": "point",
      "domain": {
        "min": -5,
        "max": 5,
        "step": 1,
        "labelStep": 1,
        "axisLabel": "x"
      },
      "range": {
        "min": -5,
        "max": 5,
        "step": 1,
        "labelStep": 1,
        "axisLabel": "y"
      },
      "graph": {
        "width": 480,
        "height": 480
      },
      "arrows": {
        "left": true,
        "right": true,
        "up": true,
        "down": true
      },
      "coordinatesOnHover": true,
      "answers": {
        "correctAnswer": {
          "name": "Correct Answer",
          "marks": [
            {
              "type": "point",
              "x": 0,
              "y": 1,
              "label": "y-intercept",
              "showLabel": true
            },
            {
              "type": "point",
              "x": 2,
              "y": 5
            },
            {
              "type": "line",
              "from": {
                "x": -2,
                "y": -3
              },
              "to": {
                "x": 2,
                "y": 5
              }
            }
          ]
        }
      },
      "backgroundMarks": [],
      "rationale": "<p>The line y = 2x + 1 has a slope of 2 and y-intercept of 1. It crosses the y-axis at (0, 1) and passes through points like (2, 5).</p>",
      "rationaleEnabled": true,
      "scoringType": "partial scoring"
    }
  ]
}

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/graphing@11.0.6. Example version: 11.0.4. Use the schema matching your content. Schema checks cover data structure; controller validation checks authoring rules.

model fields (35)
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`—
answersRequiredGraphingAnswersIndicates marks that are set as answers; alternates are keyed `alternate<N>`—
arrowsunionIndicates if arrows are enabled; a boolean sets all four arrows (older models)—
backgroundMarksarrayIndicates marks that have to be displayed in background—
coordinatesOnHoverbooleanIndicates if coordinates of a point are displayed on hoverfalse
defaultGridConfigurationnumberIndicates the default grid configuration: an index into the configuration's `gridConfigurations`0
defaultToolunionIndicates the default selected tool for the graph; empty means the first toolbar tool—
dimensionsEnabledbooleanIndicates if the graph dimensions are displayed—
domainGraphSettingsIndicates domain settings for the graph—
extraCSSRulesExtraCSSRulesHost-supplied CSS scoped to the element—
graphGraphIndicates the graph line model—
includeAxesbooleanIndicates if the graph axes and labels are enabledtrue
labelstringNot read: the author copies it from the selected grid configuration.—
labelsLabelsIndicates labels—
labelsEnabledbooleanIndicates if the graph labels are displayedtrue
languagestringIndicates the language of the component Supported options: en, es, en_US, en-US, es_ES, es-ES, es_MX, es-MX—
paddingbooleanNot read by this element; the author's padding toggle writes it.—
promptstringIndicates prompt value—
promptEnabledbooleanIndicates if the prompt is enabledtrue
rangeGraphSettingsIndicates range settings for the graph—
rationalestringIndicates rationale for the answer—
rationaleEnabledbooleanIndicates if Rationale are enabledtrue
rubricEnabledbooleanIndicates if Rubric is enabled—
scoringTypestringIndicates scoring type—["dichotomous","partial scoring"]
spellCheckEnabledbooleanIndicates if spellcheck is enabled for the author. Default value is true—
standardGridbooleanIndicates if some domain values will be synched to the range valuesfalse
studentInstructionsstringNot read by this element.—
studentInstructionsEnabledbooleanIndicates if Student Instructions are enabledtrue
teacherInstructionsstringIndicates teacher instructions—
teacherInstructionsEnabledbooleanIndicates if Teacher Instructions are enabledtrue
titlestringIndicates graph title—
titleEnabledbooleanIndicates if the graph title is displayedtrue
toolbarToolsarrayIndicates the tools that have to be displayed in toolbar—

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.—
GraphingAnswers
FieldTypeMeaningDefault / values
correctAnswerRequiredAnswerThe correct answer—
Answer
FieldTypeMeaningDefault / values
nameRequiredstringIndicates name of answer—
marksRequiredarrayIndicates marks for the answer—
Mark
FieldTypeMeaningDefault / values
typeRequiredMarkTypeIndicates type of mark—
buildingbooleanIndicates if mark is in build process—
xnumberIndicates x coordinate if type is point—
ynumberIndicates y coordinate if type is point—
labelstringIndicates label value for mark—
showLabelbooleanNot read by this element or `@pie-lib/graphing`.—
fromMarkPointIndicates where starts the mark if type is line, segment, ray, vector—
toMarkPointIndicates where ends the mark if type is line, segment, ray, vector—
middleMarkPointLabelled midpoint of a line, ray, segment, vector, circle or polygon mark—
rootMarkPointIndicated the root of mark if type is sine, parabola, absolute, exponential or circle—
edgeMarkPointIndicated the edge of mark if type is sine, parabola, absolute, exponential or circle—
closedbooleanIndicates if mark is closed if type is polygon, sine—
pointsarrayIndicates all mark's points if type is polygon—
MarkPoint
FieldTypeMeaningDefault / values
xRequirednumberIndicates x coordinate—
yRequirednumberIndicates y coordinate—
labelstringLabel shown next to the point—
Arrows
FieldTypeMeaningDefault / values
leftRequiredbooleanIndicates if left arrow is enabled—
rightRequiredbooleanIndicates if right arrow is enabled—
upRequiredbooleanIndicates if up arrow is enabled—
downRequiredbooleanIndicates if down arrow is enabled—
GraphSettings
FieldTypeMeaningDefault / values
minRequirednumberMin value—
maxRequirednumberMax value—
paddingnumberPadding value—
stepRequirednumberStep value—
labelStepRequirednumberLabel step value—
axisLabelRequiredstringAxis Label—
ExtraCSSRules
FieldTypeMeaningDefault / values
namesarraySee the named type or the example model.—
rulesstringSee the named type or the example model.—
Graph
FieldTypeMeaningDefault / values
widthRequirednumberWidth for graph representation—
heightRequirednumberHeight for graph representation—
Labels
FieldTypeMeaningDefault / values
topstringLabel for top side of the graph—
bottomstringLabel for bottom side of the graph—
leftstringLabel for left side of the graph—
rightstringLabel for right side of the graph—
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—
authoringAuthoringConfigPropGrid Setup Panel configuration—
arrowsArrowsConfigPropArrows configuration—
availableToolsarrayGraph toolbar tools configuration—
coordinatesOnHoverConfigurePropCoordinates configuration—
contentDimensionsContentDimensionsMinimum and maximum dimensions of the authoring view—
graphDimensionsDimensionsConfigPropGraph dimensions configuration—
gridConfigurationsarrayGrid default configurations—
instructionConfigurePropInstructions shown at the top of the authoring view—
paddingConfigurePropPadding configuration—
labelsLabelsConfigPropLabels configuration—
languageConfigurePropWithEnabledLanguage configuration—
languageChoicesConfigureLanguageOptionsLanguage choices configuration Only available if language is enabled—
promptEditableHtmlPluginConfigureRequiredConfiguration for the prompt—
rationaleEditableHtmlPluginConfigureRequiredConfiguration for the rationale—
settingsPanelDisabledbooleanIndicates if the settings panel is not available—
spellCheckConfigurePropWithEnabledConfiguration for the author's spellcheck—
scoringTypeConfigurePropScoring Type configuration—
studentInstructionsConfigurePropStudent Instructions configuration—
teacherInstructionsEditableHtmlPluginConfigureRequiredTeacher Instructions configuration—
titleTitleConfigPropGraph title configuration—
maxImageWidthConfigureMaxImageDimensionsPropMaximum image width for input fields—
maxImageHeightConfigureMaxImageDimensionsPropMaximum image height for input fields—
withRubricConfigurePropRubric configuration - only relevant in environments that use pie-player-components—
mathMlOptionsConfigureMathMLPropConfiguration for editable-html—
removeIncompleteToolbooleanAbility to remove incomplete tool added after switching current tool.false
showPromptbooleanNot read by this element.—
promptLabelstringNot read by this element.—
settingsPartialScoringbooleanNot read by this element.—

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.—
AuthoringConfigProp
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)—
includeAxesEnabledbooleanIndicates if the "Include axes and labels?" toggle is displayed in the Grid Setup Panel—
standardGridEnabledbooleanIndicates if the "Constrain to standard coordinate grid?" toggle is displayed in the Grid Setup Panel—
minGridPanelConfigPropMin value configuration—
maxGridPanelConfigPropMax value configuration—
axisLabelGridPanelConfigPropAxis label configuration—
stepGridPanelConfigPropStep value configuration—
labelStepGridPanelConfigPropLabel step value configuration—
GridPanelConfigProp
FieldTypeMeaningDefault / values
labelstringLabel for the field in the Grid Setup Panel—
enabledbooleanIndicates if the field is displayed in the Grid Setup Panel—
ArrowsConfigProp
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—
leftConfigurePropConfiguration for the left arrow checkbox—
rightConfigurePropConfiguration for the right arrow checkbox—
upConfigurePropConfiguration for the up arrow checkbox—
downConfigurePropConfiguration for the down arrow checkbox—
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—
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.—
DimensionsConfigProp
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)—
minnumberMinimum graph dimension, in pixels—
maxnumberMaximum graph dimension, in pixels—
stepnumberStep between graph dimensions, in pixels—
GridConfiguration
FieldTypeMeaningDefault / values
labelstringName shown in the grid configuration picker—
arrowsArrowsArrows for the grid—
domainGraphSettingsDomain settings for the grid—
graphGraphGraph dimensions for the grid—
includeAxesbooleanIndicates if the graph axes and labels are enabled—
labelsLabelsLabels for the grid—
paddingbooleanIndicates if padding is enabled—
rangeGraphSettingsRange settings for the grid—
standardGridbooleanIndicates if domain values are synched to the range values—
titlestringGraph title—
Arrows
FieldTypeMeaningDefault / values
leftRequiredbooleanIndicates if left arrow is enabled—
rightRequiredbooleanIndicates if right arrow is enabled—
upRequiredbooleanIndicates if up arrow is enabled—
downRequiredbooleanIndicates if down arrow is enabled—
GraphSettings
FieldTypeMeaningDefault / values
minRequirednumberMin value—
maxRequirednumberMax value—
paddingnumberPadding value—
stepRequirednumberStep value—
labelStepRequirednumberLabel step value—
axisLabelRequiredstringAxis Label—
Graph
FieldTypeMeaningDefault / values
widthRequirednumberWidth for graph representation—
heightRequirednumberHeight for graph representation—
Labels
FieldTypeMeaningDefault / values
topstringLabel for top side of the graph—
bottomstringLabel for bottom side of the graph—
leftstringLabel for left side of the graph—
rightstringLabel for right side of the graph—
LabelsConfigProp
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)—
topstringPlaceholder for the top label—
rightstringPlaceholder for the right label—
bottomstringPlaceholder for the bottom label—
leftstringPlaceholder for the left label—
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)—
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—
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—
TitleConfigProp
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)—
placeholderstringPlaceholder for the graph title—
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—
ConfigureMathMLProp
FieldTypeMeaningDefault / values
mmlOutputbooleanIndicates if model should have mathML output instead of latex—
mmlEditingbooleanIndicates if mathML that's already in model should be editable—
Open the complete JSON Schema
session fields (3)
FieldTypeMeaningDefault / values
idstringIdentifier of the session—
elementstringThe element the session belongs to—
answerarrayThe marks the student drew—

Named object types

Mark
FieldTypeMeaningDefault / values
typeRequiredMarkTypeIndicates type of mark—
buildingbooleanIndicates if mark is in build process—
xnumberIndicates x coordinate if type is point—
ynumberIndicates y coordinate if type is point—
labelstringIndicates label value for mark—
showLabelbooleanNot read by this element or `@pie-lib/graphing`.—
fromMarkPointIndicates where starts the mark if type is line, segment, ray, vector—
toMarkPointIndicates where ends the mark if type is line, segment, ray, vector—
middleMarkPointLabelled midpoint of a line, ray, segment, vector, circle or polygon mark—
rootMarkPointIndicated the root of mark if type is sine, parabola, absolute, exponential or circle—
edgeMarkPointIndicated the edge of mark if type is sine, parabola, absolute, exponential or circle—
closedbooleanIndicates if mark is closed if type is polygon, sine—
pointsarrayIndicates all mark's points if type is polygon—
MarkPoint
FieldTypeMeaningDefault / values
xRequirednumberIndicates x coordinate—
yRequirednumberIndicates y coordinate—
labelstringLabel shown next to the point—
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