Skip to content

Commit

Permalink
Issue #365 - Hide the chart when no question or data is available
Browse files Browse the repository at this point in the history
* This is a quick fix for the Chart Builder tab
* There are still some glitches that need to be addressed, but they
  will be done in the refactor
  • Loading branch information
iperdomo committed Oct 23, 2013
1 parent d0d9cde commit 7dffb22
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
8 changes: 6 additions & 2 deletions Dashboard/app/js/lib/views/reports/report-views.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,11 @@ FLOW.chartView = FLOW.View.extend({
this.chartType = FLOW.chartTypeControl.content[0];
},

hideChart: function () {
return this.get('noChoiceBool') || this.get('noDataBool');
}.property('noChoiceBool', 'noDataBool'),

getChartData: function () {
// createBarChart();
this.set('noChoiceBool', false);
if (FLOW.selectedControl.get('selectedQuestion') !== null) {
FLOW.surveyQuestionSummaryControl.doSurveyQuestionSummaryQuery(FLOW.selectedControl.selectedQuestion.get('keyId'));
Expand All @@ -41,10 +44,11 @@ FLOW.chartView = FLOW.View.extend({
maxPer, i, tot, totPerc;

deleteChart();

if (FLOW.surveyQuestionSummaryControl.content.get('isLoaded') === true) {
FLOW.chartDataControl.set('total', FLOW.surveyQuestionSummaryControl.content.get('length'));
if (FLOW.chartDataControl.get('total') == 0) {
this.set('noDataBool',true);
this.set('noDataBool', true);
return;
} else {
this.set('noDataBool', false);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,11 @@
<p class="errorMsg">There is no data available for this question. Please select another one.</p>
{{/if}}
<h3 class="chartTitle">{{FLOW.selectedControl.selectedQuestion.text}}</h3>
{{#unless view.hideChart}}
<div id="piechart">
<p>Choose a Question from above selectors.</p>
</div>
{{/unless}}
{{/view}}

<script type="text/javascript">
Expand Down

0 comments on commit 7dffb22

Please sign in to comment.