diff options
Diffstat (limited to 'addons/survey/static')
| -rw-r--r-- | addons/survey/static/src/js/survey_session_chart.js | 12 | ||||
| -rw-r--r-- | addons/survey/static/src/js/survey_session_manage.js | 3 |
2 files changed, 4 insertions, 11 deletions
diff --git a/addons/survey/static/src/js/survey_session_chart.js b/addons/survey/static/src/js/survey_session_chart.js index 2247b569ab9..2198afcceee 100644 --- a/addons/survey/static/src/js/survey_session_chart.js +++ b/addons/survey/static/src/js/survey_session_chart.js @@ -11,7 +11,6 @@ publicWidget.registry.SurveySessionChart = publicWidget.Widget.extend({ this.questionType = options.questionType; this.answersValidity = options.answersValidity; this.hasCorrectAnswers = options.hasCorrectAnswers; - this.attendeesCount = options.attendeesCount || 0; this.questionStatistics = this._processQuestionStatistics(options.questionStatistics); this.showInputs = options.showInputs; this.showAnswers = false; @@ -35,6 +34,7 @@ publicWidget.registry.SurveySessionChart = publicWidget.Widget.extend({ * that will automatically add animations to show the new number. * * @param {Object} questionStatistics object containing chart data (counts / labels / ...) + * @param {Integer} newAttendeesCount: max height of chart, not used anymore (deprecated) */ updateChart: function (questionStatistics, newAttendeesCount) { if (questionStatistics) { @@ -52,10 +52,6 @@ publicWidget.registry.SurveySessionChart = publicWidget.Widget.extend({ this.chart.data.datasets[0].data[i] = value; } - if (newAttendeesCount) { - this.chart.config.options.scales.yAxes[0].ticks.max = newAttendeesCount + 1; - } - this.chart.update(); } }, @@ -102,7 +98,7 @@ publicWidget.registry.SurveySessionChart = publicWidget.Widget.extend({ * (see _getBackgroundColor for details) * - The ticks are bigger and bolded to be able to see them better on a big screen (projector) * - We don't use tooltips to keep it as simple as possible - * - We use a "suggestedMax" being the attendeesCount +1 + * - We don't set a suggestedMin or Max so that Chart will adapt automatically himself based on the given data * The '+1' part is a small trick to avoid the datalabels to be clipped in height * - We use a custom 'datalabels' plugin to be able to display the number value on top of the * associated bar of the chart. @@ -140,8 +136,6 @@ publicWidget.registry.SurveySessionChart = publicWidget.Widget.extend({ yAxes: [{ ticks: { display: false, - suggestedMin: 0, - suggestedMax: this.attendeesCount + 1, }, gridLines: { display: false @@ -167,7 +161,7 @@ publicWidget.registry.SurveySessionChart = publicWidget.Widget.extend({ padding: { left: 0, right: 0, - top: 50, + top: 70, bottom: 0 } } diff --git a/addons/survey/static/src/js/survey_session_manage.js b/addons/survey/static/src/js/survey_session_manage.js index 44a90c195fa..9af7e15d84d 100644 --- a/addons/survey/static/src/js/survey_session_manage.js +++ b/addons/survey/static/src/js/survey_session_manage.js @@ -385,7 +385,7 @@ publicWidget.registry.SurveySessionManage = publicWidget.Widget.extend({ self.attendeesCount = questionResults.attendees_count; if (self.resultsChart && questionResults.question_statistics_graph) { - self.resultsChart.updateChart(JSON.parse(questionResults.question_statistics_graph), self.attendeesCount); + self.resultsChart.updateChart(JSON.parse(questionResults.question_statistics_graph)); } else if (self.textAnswers) { self.textAnswers.updateTextAnswers(questionResults.input_line_values); } @@ -452,7 +452,6 @@ publicWidget.registry.SurveySessionManage = publicWidget.Widget.extend({ if (!this.isStartScreen && this.showBarChart) { this.resultsChart = new SurveySessionChart(this, { - attendeesCount: this.attendeesCount, questionType: this.$el.data('questionType'), answersValidity: this.$el.data('answersValidity'), hasCorrectAnswers: this.hasCorrectAnswers, |
