Chart simplechart

Chart (simplechart)

Allows the learner to create or modify charts, including bar charts, line charts, histograms, dot plots, and line plots.

The charting Question types are referenced by the type in the code, which is "simplechart".

Examples

{
    "response_id": "60029",
    "type": "simplechart",
    "stimulus": "Chart the cost of a box of apples when the price increases by $10 per box.",
    "chart_data": {
        "name": "Apple prices",
        "data": [
            { "x": "Jan", "y": 10 },
            { "x": "Feb", "y": 20 },
            { "x": "Mar", "y": 30 },
            { "x": "Apr", "y": 40 }
        ]
    },
    "validation": {
        "scoring_type": "exactMatch",
        "valid_response": {
            "value": [
                { "x": "Jan", "y": 20 },
                { "x": "Feb", "y": 30 },
                { "x": "Mar", "y": 40 },
                { "x": "Apr", "y": 50 }
            ],
            "score": 1
        }
    },
    "instant_feedback": true
}

Attributes

  • type string

    Defines the Question type to be rendered.

    Must be set to "simplechart" in this case.

  • is_math boolean

    Set to true to have LaTeX or MathML contents to be rendered with mathjax.

    Default: false

  • metadata object

    Object containing additional information about the question.

  • metadata.distractor_rationale string

    Used to display individual response feedback/rationale to the student.

  • metadata.rubric_reference string

    A unique identifier for the rubric to be used with the question - defaults to course rubric if assigned in activity

  • metadata.sample_answer string

    A sample answer to be displayed on the Learnosity Reports API. HTML is supported.

  • metadata.acknowledgements string

    References for any text passages, documents, images etc. used in the question.

  • stimulus string

    The question stimulus. This can include text, tables, images, resources and LaTeX entered via the Math Editor.

  • stimulus_review string

    HTML/Text content displayed only in review state rendered above the response area. Supports embedded Feature <span> tags. Will override stimulus in review state.

  • instructor_stimulus string

    HTML/Text content displayed when showInstructorStimulus is set to true on the activity. Supports embedded Feature <span> tags.

  • ui_style object

    Object used to control different aspects of the UI

  • ui_style.fontsize string

    Controls the size of base font for this question. Options are among 'small', 'normal', 'large', 'xlarge' and 'xxlarge'.

    Default: "normal"

  • ui_style.validation_stem_numeration string

    Numeration character to be displayed to the left of the validation label.

    Default: "number"

  • ui_style.chart_type string

    Select the chart type to show.

    Default: "bar"

    Possible values

    • "bar"
    • "line"
    • "histogram"
    • "dot-plot"
    • "line-plot"
  • ui_style.point_style string

    Select the indicator icon to use for points.

    Note Only available when ui_style.chart_type is set to "line".

    Default: "dot"

    Possible values

    • "dot"
    • "cross"
  • feedback_attempts number

    If instant_feedback is true, this field determines how many times the user can click on the 'Check Answer' button. 0 means unlimited.

    Default: 0

  • instant_feedback boolean

    Flag to determine whether to display a 'Check Answer' button to provide instant feedback to the user.

    Default: false

  • validation object

    In this section, configure the correct answer(s) for the question.

  • validation.allow_negative_scores boolean

    Negative scores will be normalised to zero by default. Allowing negative scores, on the other hand, means that the score can drop below zero when penalties are applied.

    Default: false

  • validation.penalty number

    Value indicating the marks deducted for an incorrect response.

    Default: 0

  • validation.min_score_if_attempted number

    Positive value indicating the minimum score if a student attempted the question.

    Default: 0

  • validation.scoring_type string

    The way in which marks are distributed for the question.

    • Exact Match - All parts of the question must be answered correctly to receive a mark.
    • Partial Match Per Response - Each correct response element will be awarded an individual score.
    • Partial Match - Each correct response element will be scored individually, and the overall question score will be divided between responses.

    Default: "exactMatch"

  • validation.unscored boolean

    When enabled, this option will remove all scoring from the question. This is useful for creating practice questions.

    Default: false

  • validation.valid_response object

    An object containing the valid response score and value.

  • validation.valid_response.score number

    Score awarded for the correct response(s).

    Default: 1

  • validation.valid_response.value array

    See the Response format section below for more information.

    Default: []

  • validation.valid_response.value[ ].x string

    The label for the horizontal axis.

    Example: January

  • validation.valid_response.value[ ].y number

    The data value for the vertical axis.

    Example: 10

  • validation.automarkable boolean

    Defines whether the question will be marked automatically, or must be marked manually.

    Default: true

  • validation.threshold number

    Set a range for all responses that will be accepted as a correct answer. For example, if the correct answer is 20, setting the threshold to 10 will accept any value between 10-30 as a correct answer.

    Note The threshold value must be positive.

    Default: 0

  • validation.ignore_order boolean

    Controls whether the horizontal order of the columns should be taken into account when scoring the answer.

    When set to false, it will allow learners to re-order the columns in the user interface.

    Default: true

  • max_y_value number

    Sets the maximum value for the vertical axis.

    Default: 100

  • chart_data object

    The configuration data for the chart presentation.

    See below for configurable attributes.

  • chart_data.name string

    The title of the chart.

    Default: "Series title"

  • chart_data.data array

    The configuration for the data points in the chart.

    See below for configurable attributes.

    Default: []

  • chart_data.data[ ].x string

    The label for the data point for the horizontal axis.

  • chart_data.data[ ].y number

    The initial value for the data point.

    Default: 0

  • chart_data.data[ ].interactive boolean

    Controls whether the point can be changed by the learner.

    You would set this to false to prevent the learner from changing the value of this data point. For example, having the first three points in the chart showing a trend line and setting these to non-interactive, so that learners can see the initial trend before changing the final data point in the chart to answer the question.

    Default: true

  • add_point boolean

    Controls whether the learner can add points to the chart.

    Default: false

  • resize_point boolean

    Controls whether the learner can interact with points on the chart.

    You would want to use this to create a read only chart.

    Default: true

  • edit_label boolean

    Controls whether the learner can edit the point labels on the chart.

    Default: false

  • delete_point boolean

    Controls whether the learner can delete points on the chart.

    Default: false

  • x_axis_label string

    Sets the horizontal axis label name.

  • y_axis_label string

    Sets the vertical axis label name.

  • snap_to_grid number

    Specifies the increments for snapping points to the grid when the learner interacts with the chart. By default, the points will automatically snap to the chart gridlines.

    Note To disable snapping, set this value to 0.

  • stacked_fraction boolean

    Controls whether to visually convert fractions (numbers separated with a forward slash) on the horizontal axis labels with improved styling. For example, entering 2/3 will be shown as a stacked fraction with a horizontal bar (vinculum).

    Note Non-numeric text will be stripped from the label.

    Default: false

  • multicolour boolean

    Controls whether the bars for the histogram chart use different colors.

    Note The order_point option must be set to false for this to take effect.

    Default: true

  • order_point boolean

    Controls whether the learner can order the data points on the horizontal axis.

    Default: false

  • show_gridlines string

    Controls whether the gridlines are shown for histogram charts.

    Default: "y_only"

    Possible values

    • "both" - display X and Y axes gridlines.
    • "x_only" - display X axis gridlines only (vertical).
    • "y_only" - display Y axis gridlines only (horizontal).
    • "none" - hide gridlines.
  • new_point_name string

    Set the default name for all new data points added by the learner.

Response format

The data returned in the response format for this Question is the information for the chart data, which are the data points that the learner added to the chart or moved on the chart display.

Note The different types of chart will return the same data format.

Response format examples

// Bar chart example
{
    "value": {
        "data": [
            { "x": "A", "y": 10 },
            { "x": "B", "y": 20 },
            { "x": "C", "y": 40, "interactive": true },
            { "x": "D", "y": 40 }
        ],
        "name": "Bar chart"
    },
    "type": "object",
    "apiVersion": "v2.173.0",
    "revision": 1,
    "feedbackAttemptsCount": 1
}

// Line chart example
{
    "value": {
        "data": [
            { "x": "A", "y": 10 },
            { "x": "B", "y": 15 },
            { "x": "C", "y": 30 }
        ],
        "name": "Line chart"
    },
    "type": "object",
    "apiVersion": "v2.173.0",
    "revision": 1,
    "feedbackAttemptsCount": 1
}

Response attributes

  • value object

    The information in the chart entered or changed by learners.

  • value.data array[object]

    The data points within the chart.

    An array of objects containing the valid responses for each point in the chart_data in corresponding order.

  • value.name string

    The type of chart being shown.

    Possible values

    • "Bar chart"
    • "Line chart"
    • "Histogram"
    • "Dot plot"
    • "Line plot"
  • type string

    Informs the scoring engine about what kind of data to expect in the values entered by the student. For this Question type, you must always supply a string for this attribute with the value "object".

  • apiVersion string

    The version of the Questions API that returned this response.

  • revision numeric

    Keeps track of the number of Question attempt submissions, i.e. how many times the student answered the Question and submitted it.

  • feedbackAttemptsCount numeric

    Keeps track of the number of feedback attempts.

Was this article helpful?

Did you arrive here by accident? If so, learn more about Learnosity.