Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/survey_server.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoas Schilling <coding@schilljs.com>2016-10-18 15:17:36 +0300
committerJoas Schilling <coding@schilljs.com>2016-10-18 15:17:36 +0300
commit6314138a6da38d415315d281cad3231133c9265f (patch)
tree9c2319adece72a0dadea634f8336ddf0aeb75bd2
parentac8dc69c01e838c60b66a99ac9a7a05b6046c22d (diff)
Add a details section with all numbers to the charts
Signed-off-by: Joas Schilling <coding@schilljs.com>
-rw-r--r--js/script.js12
-rw-r--r--templates/part.content.php7
2 files changed, 14 insertions, 5 deletions
diff --git a/js/script.js b/js/script.js
index 026cc8f..2b61961 100644
--- a/js/script.js
+++ b/js/script.js
@@ -105,8 +105,13 @@
* @param array data
*/
var ocChart = function (id, data) {
- var ocChartData = new Array();
+ var ocChartData = new Array(),
+ $details = $('#' + id + 'Details');
+
for (key in data) {
+ $details.append($('<span>').text(key + ': ' + data[key]));
+ $details.append($('<br>'));
+
ocChartData.push(
{
value: data[key],
@@ -116,9 +121,8 @@
);
}
- var ctx = document.getElementById(id).getContext("2d");
+ var ctx = document.getElementById(id + 'Chart').getContext("2d");
var myPieChart = new Chart(ctx).Pie(ocChartData);
-
};
$.get(
@@ -132,7 +136,7 @@
for(key in data['categories'][category]) {
if (key !== 'stats') {
if (data['categories'][category][key]['presentation'] === 'diagram') {
- ocChart(category + key + 'Chart', data['categories'][category][key]['statistics']);
+ ocChart((category + key).replace('.', '-'), data['categories'][category][key]['statistics']);
} else if (data['categories'][category][key]['presentation'] === 'numerical evaluation') {
ocNumericStatistics(category + key + 'Numeric', data['categories'][category][key]['statistics']);
}
diff --git a/templates/part.content.php b/templates/part.content.php
index dc419b9..f4b652a 100644
--- a/templates/part.content.php
+++ b/templates/part.content.php
@@ -80,7 +80,12 @@
<?php if ($value['presentation'] === \OCA\Survey_Server\EvaluateStatistics::PRESENTATION_TYPE_DIAGRAM) {?>
<div class="chart">
<h2><?php p(($value['description']));?></h2>
- <canvas id="<?php p($category . $key . 'Chart');?>" width="400" height="300"></canvas>
+
+ <details id="<?php p(str_replace('.', '-', $category . $key) . 'Details');?>">
+ <summary>
+ <canvas id="<?php p(str_replace('.', '-', $category . $key) . 'Chart');?>" width="400" height="300"></canvas>
+ </summary>
+ </details>
</div>
<?php }
} ?>