Skip to content
Snippets Groups Projects
Commit d5722861 authored by srosse's avatar srosse
Browse files

OO-716: fix the bar height on the overview of tests

parent b01b1d89
No related branches found
No related tags found
No related merge requests found
<div id="$r.getId('d3div')"><div id="$r.getId('d3holder')" class='d3chart' style='width:600px;height:155px'></div>
<div id="$r.getId('d3div')"><div id="$r.getId('d3holder')" class='d3chart' style='width:600px;'></div>
<script type='text/javascript'>
/* <![CDATA[ */
jQuery(function () {
jQuery('#$r.getId("d3holder")').qtiStatistics('averageScorePerItem', {
values: [$datas.data],
barHeight: 25,
xBottomLegend: ' $r.translate("chart.answer.averageScoreQuestions.y")',
yLeftLegend: '$r.translate("chart.item")'
});
......
<div id="$r.getId('d3div')"><div id="$r.getId('d3holder')" class='d3chart' style='width:600px;height:155px'></div>
<div id="$r.getId('d3div')"><div id="$r.getId('d3holder')" class='d3chart' style='width:600px;'></div>
<script type='text/javascript'>
/* <![CDATA[ */
jQuery(function () {
jQuery('#$r.getId("d3holder")').qtiStatistics('rightAnswerPerItem', {
values: [$datas.data],
barHeight: 25,
xBottomLegend: '$r.translate("chart.percent.participants.num")',
xTopLegend: '$r.translate("chart.percent.participants")',
yLeftLegend: '$r.translate("chart.item")'
......
......@@ -35,14 +35,16 @@
};
averageScorePerItem = function($obj, settings) {
var placeholderheight = $obj.height();
var placeholderwidth = $obj.width();
var data = settings.values;
var placeholderheight = $obj.height();
var margin = {top: 10, right: 60, bottom: 40, left: 60},
width = placeholderwidth - margin.left - margin.right,
height = placeholderheight - margin.top - margin.bottom;
width = placeholderwidth - margin.left - margin.right;
var height = data.length * settings.barHeight;
$obj.height(height + margin.top + margin.bottom + 'px');
var x = d3.scale.linear()
.domain([0, d3.max(data, function(d) { return d[1]; })])
.range([0, width]);
......@@ -103,8 +105,10 @@
var data = settings.values;
var margin = {top: 40, right: 60, bottom: 40, left: 60},
width = placeholderwidth - margin.left - margin.right,
height = placeholderheight - margin.top - margin.bottom;
width = placeholderwidth - margin.left - margin.right;
var height = data.length * settings.barHeight;
$obj.height(height + margin.top + margin.bottom + 'px');
var sum = d3.sum(data, function(d) { return d[1]; });
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment