Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make survey-slider plugin for multiple analog (slider) scales #94

Closed
DominiqueMakowski opened this issue Jan 15, 2024 · 7 comments
Closed

Comments

@DominiqueMakowski
Copy link

Given that jspsych has already several useful plugins for creating questionnaires (survey-likert), it would benefit a lot for being able to use analog scales (i.e., sliders) instead of discrete choices (PS: note that this option is not available either in SurveyJS/survey-plugin afaik).

We've been using this plugin code in the past to get:

image

with:

var questionnaire = {
            type: jsPsychSurveySlider,
            questions: [
                {
                    prompt: "<b>Question 1</b>",
                    name: "question1",
                    ticks: ["Strongly disagree", "Strongly agree"],
                    required: true,
                    min: 0,
                    max: 1,
                    step: 0.01,
                    slider_start: 0.5,
                },
                {
                    prompt: "<b>Question 2</b>",
                    name: "question2",
                    ticks: ["No", "Yes"],
                    required: true,
                    min: 0,
                    max: 1,
                    step: 0.01,
                    slider_start: 0.5,
                },
            ],
            randomize_question_order: false,
            preamble: "Some instructions.",
            require_movement: false,
            slider_width: 600,
            data: {
                screen: "questionnaire",
            },
        }

        timeline.push(questionnaire)

I believe such plugin would benefit from being added here (or even as part of the official distribution IMO) but for this it would need to be updated (to typescript if I understand?) and cleaned up (and add a data simulation option). Although it's probably not a lot of work, it's still slightly beyond my javascript skill level. And I was wondering if I could get some guidance and help with that?

@jodeleeuw
Copy link
Member

Hi @DominiqueMakowski,

It would be great to have this added here. The conversion from your plugin code to a TypeScript version is mainly just copy/pasting the code into the right spots in our templates. I recently added a CLI tool that helps with setting up the new plugin files. If you fork this repository, run npm install and then npm run new you should get a series of prompts to walk through creating the template code. Then you can work on copy/pasting code into the corresponding spots, which I think will be fairly clear once the templates are created. I'm happy to answer questions about the process as they come up!

@DominiqueMakowski
Copy link
Author

Tagging @Max-Lovell as a reminder to myself to get his help

@DominiqueMakowski
Copy link
Author

As a side comment, apparently SurveyJS will be adding analog scales within the year, so combined with jspsych/jsPsych#3204 it likely will supersede this plugin

@Max-Lovell
Copy link
Contributor

Hi, I've made a pull request to include the code above into JSPsych contrib, see: #105

@DominiqueMakowski
Copy link
Author

Thanks Max!

@jodeleeuw
Copy link
Member

This is now implemented with @jspsych-contrib/plugin-survey-slider

@DominiqueMakowski
Copy link
Author

Amazing thanks a lot @Max-Lovell and @jodeleeuw

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants