Perseus
    Preparing search index...

    Type Alias PerseusGrapherWidgetOptions

    Options for the Grapher widget. Defines the available function types, the correct answer, and the visual graph configuration.

    type PerseusGrapherWidgetOptions = {
        availableTypes: (
            | "absolute_value"
            | "exponential"
            | "linear"
            | "logarithm"
            | "quadratic"
            | "sinusoid"
            | "tangent"
        )[];
        correct: GrapherAnswerTypes;
        graph: {
            backgroundImage: {
                bottom?: number;
                height?: number;
                left?: number;
                scale?: number;
                url?: string
                | null;
                width?: number;
            };
            box?: [number, number];
            editableSettings?: ("graph" | "snap" | "image" | "measure")[];
            gridStep?: [number, number];
            labels: [string, string];
            markings: MarkingsType;
            range: GraphRange;
            rulerLabel: "";
            rulerTicks: number;
            showProtractor?: boolean;
            showRuler?: boolean;
            showTooltips?: boolean;
            snapStep?: [number, number];
            step: [number, number];
            valid?: boolean | string;
        };
    }
    Index

    Properties

    availableTypes: (
        | "absolute_value"
        | "exponential"
        | "linear"
        | "logarithm"
        | "quadratic"
        | "sinusoid"
        | "tangent"
    )[]

    The set of function types the learner can choose from when plotting.

    The correct answer; used to score the learner's plotted function.

    graph: {
        backgroundImage: {
            bottom?: number;
            height?: number;
            left?: number;
            scale?: number;
            url?: string | null;
            width?: number;
        };
        box?: [number, number];
        editableSettings?: ("graph" | "snap" | "image" | "measure")[];
        gridStep?: [number, number];
        labels: [string, string];
        markings: MarkingsType;
        range: GraphRange;
        rulerLabel: "";
        rulerTicks: number;
        showProtractor?: boolean;
        showRuler?: boolean;
        showTooltips?: boolean;
        snapStep?: [number, number];
        step: [number, number];
        valid?: boolean | string;
    }

    Visual configuration for the coordinate plane.

    Type Declaration

    • backgroundImage: {
          bottom?: number;
          height?: number;
          left?: number;
          scale?: number;
          url?: string | null;
          width?: number;
      }

      An optional background image displayed behind the graph.

      • Optionalbottom?: number

        Vertical offset from the bottom of the graph in pixels.

      • Optionalheight?: number

        Height of the image in pixels.

      • Optionalleft?: number

        Horizontal offset from the left edge of the graph in pixels.

      • Optionalscale?: number

        Scale factor applied to the image.

      • Optionalurl?: string | null

        URL of the background image, or null/undefined if none.

      • Optionalwidth?: number

        Width of the image in pixels.

    • Optionalbox?: [number, number]

      The [width, height] of the graph canvas in pixels.

    • OptionaleditableSettings?: ("graph" | "snap" | "image" | "measure")[]

      Which graph settings are editable in the editor UI.

    • OptionalgridStep?: [number, number]

      The [x, y] spacing between grid lines.

    • labels: [string, string]

      The [x-axis, y-axis] labels.

    • markings: MarkingsType

      Which markings to show on the graph (axes, grid, graph, or none).

    • range: GraphRange

      The visible [x-range, y-range] of the coordinate plane.

    • rulerLabel: ""

      The label for the ruler overlay (currently always empty string).

    • rulerTicks: number

      The number of tick marks on the ruler overlay.

    • OptionalshowProtractor?: boolean

      When true, a protractor overlay is shown on the graph.

    • OptionalshowRuler?: boolean

      When true, a ruler overlay is shown on the graph.

    • OptionalshowTooltips?: boolean

      When true, coordinate tooltips are shown on hover.

    • OptionalsnapStep?: [number, number]

      The [x, y] snap increment for interactive elements.

    • step: [number, number]

      The [x, y] distance between labeled tick marks.

    • Optionalvalid?: boolean | string

      Whether the graph configuration is valid. Can be false or an error message string.