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'> <script type='text/javascript'>
/* <![CDATA[ */ /* <![CDATA[ */
jQuery(function () { jQuery(function () {
jQuery('#$r.getId("d3holder")').qtiStatistics('averageScorePerItem', { jQuery('#$r.getId("d3holder")').qtiStatistics('averageScorePerItem', {
values: [$datas.data], values: [$datas.data],
barHeight: 25,
xBottomLegend: ' $r.translate("chart.answer.averageScoreQuestions.y")', xBottomLegend: ' $r.translate("chart.answer.averageScoreQuestions.y")',
yLeftLegend: '$r.translate("chart.item")' 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'> <script type='text/javascript'>
/* <![CDATA[ */ /* <![CDATA[ */
jQuery(function () { jQuery(function () {
jQuery('#$r.getId("d3holder")').qtiStatistics('rightAnswerPerItem', { jQuery('#$r.getId("d3holder")').qtiStatistics('rightAnswerPerItem', {
values: [$datas.data], values: [$datas.data],
barHeight: 25,
xBottomLegend: '$r.translate("chart.percent.participants.num")', xBottomLegend: '$r.translate("chart.percent.participants.num")',
xTopLegend: '$r.translate("chart.percent.participants")', xTopLegend: '$r.translate("chart.percent.participants")',
yLeftLegend: '$r.translate("chart.item")' yLeftLegend: '$r.translate("chart.item")'
......
...@@ -35,14 +35,16 @@ ...@@ -35,14 +35,16 @@
}; };
averageScorePerItem = function($obj, settings) { averageScorePerItem = function($obj, settings) {
var placeholderheight = $obj.height();
var placeholderwidth = $obj.width(); var placeholderwidth = $obj.width();
var data = settings.values; var data = settings.values;
var placeholderheight = $obj.height();
var margin = {top: 10, right: 60, bottom: 40, left: 60}, var margin = {top: 10, right: 60, bottom: 40, left: 60},
width = placeholderwidth - margin.left - margin.right, width = placeholderwidth - margin.left - margin.right;
height = placeholderheight - margin.top - margin.bottom;
var height = data.length * settings.barHeight;
$obj.height(height + margin.top + margin.bottom + 'px');
var x = d3.scale.linear() var x = d3.scale.linear()
.domain([0, d3.max(data, function(d) { return d[1]; })]) .domain([0, d3.max(data, function(d) { return d[1]; })])
.range([0, width]); .range([0, width]);
...@@ -103,8 +105,10 @@ ...@@ -103,8 +105,10 @@
var data = settings.values; var data = settings.values;
var margin = {top: 40, right: 60, bottom: 40, left: 60}, var margin = {top: 40, right: 60, bottom: 40, left: 60},
width = placeholderwidth - margin.left - margin.right, width = placeholderwidth - margin.left - margin.right;
height = placeholderheight - margin.top - margin.bottom;
var height = data.length * settings.barHeight;
$obj.height(height + margin.top + margin.bottom + 'px');
var sum = d3.sum(data, function(d) { return d[1]; }); 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