Commit d6c65ab856974f650721cbb5209dc0987fe420f7
1 parent
2b6d281f
Exists in
master
and in
2 other branches
added more parameters for heatmap chart
Showing
2 changed files
with
9 additions
and
18 deletions
Show diff stats
analytics/static/analytics/js/charts.js
@@ -436,30 +436,21 @@ var charts = { | @@ -436,30 +436,21 @@ var charts = { | ||
436 | 436 | ||
437 | }); | 437 | }); |
438 | }, | 438 | }, |
439 | - month_heatmap: function(data, target){ | 439 | + month_heatmap: function(data, target, div_target){ |
440 | 440 | ||
441 | 441 | ||
442 | - if(target == '#right-chart-body' && $('#month-chart').length != 0){ | ||
443 | - $('#month-chart').fadeOut(); | ||
444 | - $('#month-chart').remove(); | ||
445 | - } | 442 | + |
446 | 443 | ||
447 | - if(target == "#bottom-right-chart-body" && $('#weekly-chart').length != 0){ | ||
448 | - $('#weekly-chart').fadeOut(); | ||
449 | - $('#weekly-chart').remove(); | 444 | + if($(div_target).lenght != 0 ){ |
445 | + $(div_target).fadeOut(); | ||
446 | + $(div_target).remove(); | ||
450 | } | 447 | } |
451 | - | ||
452 | var svg = d3.select(target).append('svg') | 448 | var svg = d3.select(target).append('svg') |
453 | .attr('width', 300) | 449 | .attr('width', 300) |
454 | .attr('height', 200); | 450 | .attr('height', 200); |
455 | 451 | ||
456 | - if (target == "#right-chart-body"){ | ||
457 | - svg.attr('id', 'month-chart'); | ||
458 | - } | ||
459 | - | ||
460 | - if (target == "#bottom-right-chart-body"){ | ||
461 | - svg.attr('id', 'weekly-chart'); | ||
462 | - } | 452 | + svg.attr('id', div_target); |
453 | + | ||
463 | 454 | ||
464 | //color range | 455 | //color range |
465 | var color = d3.scaleLinear().range(["#29c8b8", '#149e91']).domain([0, d3.max(data, function(d){ return d.count; })]); | 456 | var color = d3.scaleLinear().range(["#29c8b8", '#149e91']).domain([0, d3.max(data, function(d){ return d.count; })]); |
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'); | 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'); | 21 | + charts.month_heatmap(data, '#bottom-right-chart-body', '#weekly-chart'); |
22 | }); | 22 | }); |
23 | 23 | ||
24 | }); | 24 | }); |