MDL-55352 core: Label values series should override tooltip
authorSimey Lameze <simey@moodle.com>
Fri, 29 Jul 2016 04:42:24 +0000 (12:42 +0800)
committerSimey Lameze <simey@moodle.com>
Fri, 29 Jul 2016 05:22:59 +0000 (13:22 +0800)
lib/amd/build/chart_output_chartjs.min.js
lib/amd/build/chart_output_htmltable.min.js
lib/amd/src/chart_output_chartjs.js
lib/amd/src/chart_output_htmltable.js
mod/choice/renderer.php
mod/feedback/item/multichoice/lib.php

index fdc8e84..c035888 100644 (file)
Binary files a/lib/amd/build/chart_output_chartjs.min.js and b/lib/amd/build/chart_output_chartjs.min.js differ
index cea5152..a2e9030 100644 (file)
Binary files a/lib/amd/build/chart_output_htmltable.min.js and b/lib/amd/build/chart_output_htmltable.min.js differ
index b0075f2..d738479 100644 (file)
@@ -274,7 +274,7 @@ define([
 
         // Add serie labels to the tooltip if any.
         if (serieLabels !== null) {
-            tooltip += ' ' + serieLabels[tooltipItem.index];
+            tooltip = serieLabels[tooltipItem.index];
         }
 
         return tooltip;
index ab55bbd..2ab02a1 100644 (file)
@@ -102,7 +102,7 @@ define([
                 value = series[serieId].getValues()[rowId];
                 seriesLabels = series[serieId].getLabels();
                 if (seriesLabels !== null) {
-                    value += ' ' + series[serieId].getLabels()[rowId];
+                    value = series[serieId].getLabels()[rowId];
                 }
                 node.append($('<td>').text(value));
             }
index 7bd4a9c..f40f331 100644 (file)
@@ -327,7 +327,7 @@ class mod_choice_renderer extends plugin_renderer_base {
             }
             $data['labels'][$count] = $option->text;
             $data['series'][$count] = $numberofuser;
-            $data['series_labels'][$count] = '(' . format_float($percentageamount, 1) . '%)';
+            $data['series_labels'][$count] = $numberofuser . ' (' . format_float($percentageamount, 1) . '%)';
             $count++;
             $numberofuser = 0;
         }
index 63c515b..98b9a35 100644 (file)
@@ -223,14 +223,14 @@ class feedback_item_multichoice extends feedback_item_base {
                 $quotient = format_float($val->quotient * 100, 2);
                 $strquotient = '';
                 if ($val->quotient > 0) {
-                    $strquotient = '('. $quotient . ' %)';
+                    $strquotient = ' ('. $quotient . ' %)';
                 }
                 $answertext = format_text(trim($val->answertext), FORMAT_HTML,
                         array('noclean' => true, 'para' => false));
 
                 $data['labels'][$count] = $answertext;
                 $data['series'][$count] = $val->answercount;
-                $data['series_labels'][$count] = $strquotient;
+                $data['series_labels'][$count] = $val->answercount . $strquotient;
                 $count++;
             }
             $chart = new \core\chart_bar();