Both sides previous revisionPrevious revisionNext revision | Previous revisionNext revisionBoth sides next revision |
en:create:feedback-visual [07.02.2017 13:58] – [Mehrere Werte (I)] m.andrejevic | en:create:feedback-visual [04.04.2019 23:14] – admin |
---|
} | } |
</code> | </code> |
| |
| |
==== Multiple Values ==== | ==== Multiple Values ==== |
<div style="position: absolute; top: -2px; left: 50%; width: 65px; height: 27px"> | <div style="position: absolute; top: -2px; left: 50%; width: 65px; height: 27px"> |
<!-- The actual Marking is going to be inserted at the above defined right place --> | <!-- The actual Marking is going to be inserted at the above defined right place --> |
<img src="ofb://slider.button.rhomb" alt="" style="position: absolute; left: %z-value*100%%; margin-left: -8px" /> | <img src="ofb://slider.button.rhomb" alt="" style="position: absolute; left: %zValue100%%; margin-left: -8px" /> |
</div> | </div> |
</div> | </div> |
</code> | </code> |
| |
In the HTML code there are two placeholders: ''%title%'' and ''%z-value*100%''. The second placeholder is actually called ''%z-value%''. Using ''*100'', it's value is going to be multiplied by 100 before it is inserted in the HTML code. This HTML code is therefore designed to show a z-value between -3 and +3. | The HTML code contains two placeholders: ''%title%'' and ''%zValue100%''. It is designed to show a z-value between -3 and +3 and can be used as follows: |
This can be used accordingly: | |
| |
<code php> | <code php> |
// Use textblocks (only if $value delivered a valid value) | // Use textblocks (only if $value delivered a valid value) |
if ($value > 0) { | if ($value > 0) { |
text('responseSD', array( | show('responseSD', array( |
'%title%' => 'Extraversion', | '%title%' => 'Extraversion', |
'%z-value%' => $zValue | '%zValue100%' => round($zValue * 100) |
)); | )); |
} | } |
| |
Using the function ''[[:en:create:functions:diagram2]]'', one can place desired Diagrams into the Questionnaire. To learn how to use it please refer to the documentation of the function. An optimized function ''chart()'' is going to be available in future versions of SoSci Survey. | Using the function ''[[:en:create:functions:diagram2]]'', one can place desired Diagrams into the Questionnaire. To learn how to use it please refer to the documentation of the function. An optimized function ''chart()'' is going to be available in future versions of SoSci Survey. |
==== Mehrere Werte (II) ==== | ==== Multiple Values (II) ==== |
| |
Sofern auf dem Befragungsserver das Plug-In //Highcharts// zur Verfügung steht, können mit der Highcharts-Bibliothek sehr schicke Diagramme im Fragebogen angezeigt werden. Wenn die Kategorie-Beschriftungen in im Array ''$labels'' gespeichert sind, die Ergebnisse im Array ''$ownData'' und Referenzdaten im Array ''$refData'', kann man mit folgendem Textbaustein "chart" (//Darstellung// "HTML_Code") und dem zugehörigen PHP-Code ein Balken-Diagramm anzeigen. Erklärungen und Details sind der [[http://www.highcharts.com/docs|Highcharts Dokumentation]] zu entnehmen. | As long as the //Highcharts// plug-in is available on the questionnaire server, you can use the Highcharts library to display nifty diagrams in your questionnaire. As long as the category labels are saved in the array ''$labels'', the results are saved in the array ''$ownData'', and reference data in the array ''$refData'', you can use the following text block "chart" (//Darstellung// "HTML_Code") and the associated PHP code to display a bar chart. You can find clarifications and details at [[http://www.highcharts.com/docs|Highcharts Dokumentation]]. |
| |
<code html> | <code html> |
<!-- Container für das Diagramm --> | <!-- Container for the diagram --> |
<div id="chart" style="height: 600px"></div> | <div id="chart" style="height: 600px"></div> |
| |
}, | }, |
series: [{ | series: [{ |
name: 'Durchschnitt', | name: 'Average', |
data: %refData%, | data: %refData%, |
color: '#BBBBBB', | color: '#BBBBBB', |
} | } |
}, { | }, { |
name: 'Ihr Wert', | name: 'Your Value', |
data: %ownData%, | data: %ownData%, |
color: '#009900', | color: '#009900', |
| |
<code php> | <code php> |
// Bibliothek jQuery verfügbar machen | // Make jQuery library available |
option('script', 'jQuery 1.x'); | option('script', 'jQuery 1.x'); |
// Textbaustein mit dem HTML-Code für das Chart einbinden | // Bind the textblock with the HTML code for the chart |
text('chart', array( | text('chart', array( |
'%labels%' => json_encode($labels), | '%labels%' => json_encode($labels), |