Skip to content

Commit

Permalink
Fixed issue #14238: statistics chart tooltip shows incorrect data
Browse files Browse the repository at this point in the history
  • Loading branch information
dominikvitt committed Nov 12, 2018
1 parent 8c944b4 commit b72ab3b
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion assets/scripts/admin/statistics.js
Expand Up @@ -130,15 +130,20 @@ function init_chart_js_graph_with_datas($type, $qid) {
var $labels = $statistics.labels
var $grawdata = $statistics.grawdata
var $chartDef = new Array();
var $max = 0;

$('#legend-no-percent-' + $qid).hide();
$('#legend-percent-' + $qid).show();
$('#stat-no-answer-' + $qid).show();

$.each($labels, function($i, $label) {
$max = $max + parseInt($grawdata[$i]);
});

$.each($labels, function ($i, $label) {
$colori = (parseInt($i) + $color);
$chartDef[$i] = {
value: $grawdata[$i],
value: Math.round($grawdata[$i]/$max * 100 * 100) / 100,
color: "rgba(" + COLORS_FOR_SURVEY[$colori] + ",0.6)",
highlight: "rgba(" + COLORS_FOR_SURVEY[$colori] + ",0.9)",
label: $label,
Expand Down

0 comments on commit b72ab3b

Please sign in to comment.