Translations of this page:

SVG as selection

This question type allows the use of any vector graphic in SVG format as a selection question. Each element within the graphic (e.g. a rectangle or a circle) can be used as a selection option and marked accordingly by the participant.

Warning: Older browsers cannot display SVG graphics correctly or not at all.

Preparing the graphic

The elements in the graphic that are later to be used as selection buttons require an ID. This ID is usually assigned automatically by the drawing software (e.g. the free Inkscape). Save the vector graphic in the Internet-compatible file format SVG.

Tip: PDF files can be opened in Inkscape to convert them into SVG files. With the online service SVGOMG you can remove invisible artifacts from the file, which can reduce the file size massively.

Tip: PowerPoint files can be printed as PDF files and then used as described above.

If you use text in the SVG file, you may want to prevent it from being clicked directly and/or from being marked as text. To do this, open the SVG file in a text editor and enter a <style> tag directly after the open <svg> tag or add an existing <style> tag as follows:

  /* <![CDATA[ */
  text {
   pointer-events: none;
   user-select: none;
   -webkit-user-select: none;
   -moz-user-select: none;
  /* ]]> */

Settings in the question

First upload the SVG file under Images and media files to your project directory.

Then create a new question of the type “SVG as selection”. For Graphic file (SVG), select the file you just uploaded. After saving (Save question) SoSci Survey automatically determines the image size in pixels as stored in the SVG.

After saving the question SoSci Survey also shows a preview of the SVG file. When you hover the mouse over the preview, the ID of the currently active SVG element and the parent elements are displayed below.

Click an item to automatically enter its ID in the Item Quick Entry (below). Add a description for the selection option (this will be displayed as a tooltip when the participant passes the option) and click the next item to continue.

Tip: Use only area elements (rectangle, circle, polygon, …) as selection elements. In principle, groups and texts can also be used, but you won't see the selection because they don't have frames or background colors.

Adjusting the colors

If the mouse moves over a selectable element or the participant selects an element by clicking on it, the element changes color. Which colors SoSci Survey uses as frame and background color can be set in the Questionnaire Layout tab Questionnaire ElementsSelection Button.

If you don't want to change this setting in the layout universally (e.g. it also affects selection questions that are displayed as cards), you can define definitions for SelBox.svg, SelBox.svg.hover and SelBox.svg.selected in the tab HTML template of the layout in the <style> area. For formatting the selection, the border color (border-color) and the background color (background-color) are used. If necessary, change the border width directly in the SVG graphic.

en/create/questions/svg-select.txt · Last modified: 02.11.2020 14:36 by sophia.schauer
Except where otherwise noted, content on this wiki is licensed under the following license: CC Attribution-Share Alike 4.0 International
Driven by DokuWiki