VegaComponentPath
Defined in: parser/types.ts:772
The VegaComponentPath interface is used to define the properties of a Vega Component. This component is used to render a Vega/Vega-Lite Component with path pointing to your Vega/Vega-Lite specs file.
For example, to render a vega based stimuli with a path of <study-name>/assets/vega.spec.json
, you would use the following snippet:
{
"type": "vega",
"path": "<study-name>/assets/vega.spec.json",
}
If you are using Vega, you can use signals with revisitAnswer
to send the user's responses back to the reVISit. For example, you can use the following snippet in your Vega spec file's signals section:
{
"signals": [
{
"name": "revisitAnswer",
"value": {},
"on": [
{
"events": "rect:click",
"update": "{responseId: 'vegaDemoResponse1', response: datum.category}"
}
]
}
]
}
In this example, when a user clicks on a rectangle in the Vega chart, the `revisitAnswer` signal is updated with the responseId and response. This signal is then passed to reVISit as the participant's response.
Extends
Properties
Property | Type | Description | Inherited from | Defined in |
---|---|---|---|---|
allowFailedTraining? | boolean | Controls whether the component should allow failed training. If not provided, the default is true. | BaseIndividualComponent .allowFailedTraining | parser/types.ts:548 |
correctAnswer? | Answer [] | The correct answer to the component. This is used for training trials where the user is shown the correct answer after a guess. | BaseIndividualComponent .correctAnswer | parser/types.ts:542 |
description? | string | The description of the component. This is used to identify and provide additional information for the component in the admin panel. | BaseIndividualComponent .description | parser/types.ts:552 |
instruction? | string | The instruction of the component. This is used to identify and provide additional information for the component in the admin panel. | BaseIndividualComponent .instruction | parser/types.ts:554 |
instructionLocation? | "sidebar" | "aboveStimulus" | "belowStimulus" | The location of the instructions. | BaseIndividualComponent .instructionLocation | parser/types.ts:540 |
meta? | Record <string , unknown > | The meta data for the component. This is used to identify and provide additional information for the component in the admin panel. | BaseIndividualComponent .meta | parser/types.ts:550 |
nextButtonDisableTime? | number | A timeout (in ms) after which the next button will be disabled. | BaseIndividualComponent .nextButtonDisableTime | parser/types.ts:558 |
nextButtonEnableTime? | number | A timer (in ms) after which the next button will be enabled. | BaseIndividualComponent .nextButtonEnableTime | parser/types.ts:560 |
nextButtonLocation? | "sidebar" | "aboveStimulus" | "belowStimulus" | The location of the next button. | BaseIndividualComponent .nextButtonLocation | parser/types.ts:538 |
nextButtonText? | string | The text that is displayed on the next button. | BaseIndividualComponent .nextButtonText | parser/types.ts:536 |
path | string | The path to the vega file. This should be a relative path from the public folder. | - | parser/types.ts:775 |
provideFeedback? | boolean | Controls whether the component should provide feedback to the participant, such as in a training trial. If not provided, the default is false. | BaseIndividualComponent .provideFeedback | parser/types.ts:544 |
recordAudio? | boolean | Whether or not to record audio for a component. Only relevant if recordStudyAudio in the uiConfig is true. Defaults to false. | BaseIndividualComponent .recordAudio | parser/types.ts:556 |
response | Response [] | The responses to the component | BaseIndividualComponent .response | parser/types.ts:532 |
responseDividers? | boolean | Whether to show the response dividers. Defaults to false. | BaseIndividualComponent .responseDividers | parser/types.ts:562 |
trainingAttempts? | number | The number of training attempts allowed for the component. The next button will be disabled until either the correct answer is given or the number of attempts is reached. When the number of attempts is reached, if the answer is incorrect still, the correct value will be shown to the participant. The default value is 2. Providing a value of -1 will allow infinite attempts and the participant must enter the correct answer to continue, and reVISit will not show the correct answer to the user. | BaseIndividualComponent .trainingAttempts | parser/types.ts:546 |
type | "vega" | - | - | parser/types.ts:773 |