Commit 511764a364b73022e1234b71678244f19210c7fa

Authored by Felipe Bormann
1 parent 9bf422c3

fixed error when charts were redrawn

analytics/static/analytics/js/charts.js
@@ -440,10 +440,10 @@ var charts = { @@ -440,10 +440,10 @@ var charts = {
440 440
441 441
442 442
443 -  
444 - if($(div_target).lenght != 0 ){  
445 - $(div_target).fadeOut();  
446 - $(div_target).remove(); 443 +
  444 + if($('#'+div_target).lenght != 0 ){
  445 + $('#'+div_target).fadeOut();
  446 + $('#'+div_target).remove();
447 } 447 }
448 var svg = d3.select(target).append('svg') 448 var svg = d3.select(target).append('svg')
449 .attr('width', 300) 449 .attr('width', 300)
dashboards/static/dashboards/js/behavior.js
@@ -8,7 +8,7 @@ $(document).ready(function(){ @@ -8,7 +8,7 @@ $(document).ready(function(){
8 8
9 $('#month_selector').change(function(){ 9 $('#month_selector').change(function(){
10 $.get('/analytics/amount_active_users_per_day', {month: $(this).val() }).done(function(data){ 10 $.get('/analytics/amount_active_users_per_day', {month: $(this).val() }).done(function(data){
11 - charts.month_heatmap(data, '#right-chart-body', '#month-chart'); 11 + charts.month_heatmap(data, '#right-chart-body', 'month-chart');
12 12
13 }); 13 });
14 }); 14 });
@@ -18,7 +18,7 @@ $(document).ready(function(){ @@ -18,7 +18,7 @@ $(document).ready(function(){
18 defaultDate: new Date(), 18 defaultDate: new Date(),
19 }).on('dp.change', function(ev){ 19 }).on('dp.change', function(ev){
20 $.get('/analytics/get_days_of_the_week_log', {date: ev.date._i}).done(function(data){ 20 $.get('/analytics/get_days_of_the_week_log', {date: ev.date._i}).done(function(data){
21 - charts.month_heatmap(data, '#bottom-right-chart-body', '#weekly-chart'); 21 + charts.month_heatmap(data, '#bottom-right-chart-body', 'weekly-chart');
22 }); 22 });
23 23
24 }); 24 });
@@ -27,14 +27,14 @@ $(document).ready(function(){ @@ -27,14 +27,14 @@ $(document).ready(function(){
27 //first call to month selector 27 //first call to month selector
28 $.get('/analytics/amount_active_users_per_day', {month: $('#month_selector option')[(new Date()).getMonth()].text }).done(function(data){ 28 $.get('/analytics/amount_active_users_per_day', {month: $('#month_selector option')[(new Date()).getMonth()].text }).done(function(data){
29 $('#month_selector').val($('#month_selector option')[(new Date()).getMonth()].text); //update value to actual month 29 $('#month_selector').val($('#month_selector option')[(new Date()).getMonth()].text); //update value to actual month
30 - charts.month_heatmap(data, '#right-chart-body'); 30 + charts.month_heatmap(data, '#right-chart-body', 'month-chart');
31 }); 31 });
32 32
33 //first call to weekly chart 33 //first call to weekly chart
34 var today_date = new Date(); 34 var today_date = new Date();
35 var date = (today_date.getMonth() + 1) + '/' + today_date.getDate() + '/' + today_date.getFullYear(); 35 var date = (today_date.getMonth() + 1) + '/' + today_date.getDate() + '/' + today_date.getFullYear();
36 $.get('/analytics/get_days_of_the_week_log', {date: date}).done(function(data){ 36 $.get('/analytics/get_days_of_the_week_log', {date: date}).done(function(data){
37 - charts.month_heatmap(data, '#bottom-right-chart-body', '#weekly-chart'); 37 + charts.month_heatmap(data, '#bottom-right-chart-body', 'weekly-chart');
38 }); 38 });
39 39
40 40