Optimized create_plot and removed test commemts

This commit is contained in:
Mokaddem 2016-07-12 11:47:51 +02:00
parent 30ae561426
commit 7e5ce0f17f
5 changed files with 9 additions and 13 deletions

View file

@ -133,19 +133,20 @@ if __name__ == '__main__':
today = datetime.date.today() today = datetime.date.today()
year = today.year year = today.year
month = today.month month = today.month
print 'b1'
lib_words.create_curve_with_word_file(r_serv1, csv_path_proto, lib_words.create_curve_with_word_file(r_serv1, csv_path_proto,
protocolsfile_path, year, protocolsfile_path, year,
month) month)
print 'b2'
lib_words.create_curve_with_word_file(r_serv1, csv_path_tld, lib_words.create_curve_with_word_file(r_serv1, csv_path_tld,
tldsfile_path, year, tldsfile_path, year,
month) month)
print 'b3'
lib_words.create_curve_with_list(r_serv2, csv_path_domain, lib_words.create_curve_with_list(r_serv2, csv_path_domain,
to_plot, year, to_plot, year,
month) month)
print 'end building' print 'end building'
publisher.debug("{} queue is empty, waiting".format(config_section)) publisher.debug("{} queue is empty, waiting".format(config_section))
print 'sleeping' print 'sleeping'
time.sleep(5) time.sleep(5)
@ -161,5 +162,3 @@ if __name__ == '__main__':
analyse(r_serv1, 'scheme') #Scheme analysis analyse(r_serv1, 'scheme') #Scheme analysis
analyse(r_serv1, 'tld') #Tld analysis analyse(r_serv1, 'tld') #Tld analysis
analyse_and_progression(r_serv2, 'domain') #Domain analysis analyse_and_progression(r_serv2, 'domain') #Domain analysis
print "to_plot:"
print to_plot

View file

@ -120,11 +120,11 @@ function Graph(id_pannel, path, header_size){
the_heading = headings[i]; the_heading = headings[i];
//console.log('heading='+the_heading+' tab['+(today-1)+']['+(parseInt(i)+1)+']='+g.getValue(today-1, parseInt(i)+1)); //console.log('heading='+the_heading+' tab['+(today-1)+']['+(parseInt(i)+1)+']='+g.getValue(today-1, parseInt(i)+1));
sorted_list.push({dom: the_heading, val: this.graph.getValue(today-1, parseInt(i)+1), index: parseInt(i)}); sorted_list.push({dom: the_heading, val: this.graph.getValue(today-1, parseInt(i)+1), index: parseInt(i)});
}
sorted_list.sort(function(a,b) { sorted_list.sort(function(a,b) {
return b.val - a.val; return b.val - a.val;
}); });
}
var display_list = sorted_list.slice(0, max_display); var display_list = sorted_list.slice(0, max_display);
for( i=0; i<display_list.length; i++){ for( i=0; i<display_list.length; i++){
this.graph.setVisibility(display_list[i].index, true); this.graph.setVisibility(display_list[i].index, true);

View file

@ -90,7 +90,6 @@
<button type="button" class="btn btn-primary" onclick="take_top(5);">5</button> <button type="button" class="btn btn-primary" onclick="take_top(5);">5</button>
<button type="button" class="btn btn-primary" onclick="take_top(10);">10</button> <button type="button" class="btn btn-primary" onclick="take_top(10);">10</button>
<button type="button" class="btn btn-primary" onclick="take_top(15);">15</button> <button type="button" class="btn btn-primary" onclick="take_top(15);">15</button>
<button type="button" class="btn btn-primary" onclick="take_top(0);">...</button>
</div> </div>
</div> </div>

View file

@ -99,7 +99,6 @@
<button type="button" class="btn btn-primary" onclick="take_top(5);">5</button> <button type="button" class="btn btn-primary" onclick="take_top(5);">5</button>
<button type="button" class="btn btn-primary" onclick="take_top(10);">10</button> <button type="button" class="btn btn-primary" onclick="take_top(10);">10</button>
<button type="button" class="btn btn-primary" onclick="take_top(15);">15</button> <button type="button" class="btn btn-primary" onclick="take_top(15);">15</button>
<button type="button" class="btn btn-primary" onclick="take_top(0);">...</button>
</div> </div>
</div> </div>
@ -139,7 +138,6 @@
<button type="button" class="btn btn-primary" onclick="take_top(5);">5</button> <button type="button" class="btn btn-primary" onclick="take_top(5);">5</button>
<button type="button" class="btn btn-primary" onclick="take_top(10);">10</button> <button type="button" class="btn btn-primary" onclick="take_top(10);">10</button>
<button type="button" class="btn btn-primary" onclick="take_top(15);">15</button> <button type="button" class="btn btn-primary" onclick="take_top(15);">15</button>
<button type="button" class="btn btn-primary" onclick="take_top(0);">...</button>
</div> </div>
</div> </div>
@ -185,6 +183,7 @@
create_and_plot("TldsTrending", '../static//csv/tldstrendingdata.csv') create_and_plot("TldsTrending", '../static//csv/tldstrendingdata.csv')
}); });
// Used when we modify the number of displayed curves
function take_top(new_display){ function take_top(new_display){
current_displayed_graph.set_Visibility_andHide(new_display, default_display); current_displayed_graph.set_Visibility_andHide(new_display, default_display);
default_display = new_display; default_display = new_display;

View file

@ -90,7 +90,6 @@
<button type="button" class="btn btn-primary" onclick="take_top(5);">5</button> <button type="button" class="btn btn-primary" onclick="take_top(5);">5</button>
<button type="button" class="btn btn-primary" onclick="take_top(10);">10</button> <button type="button" class="btn btn-primary" onclick="take_top(10);">10</button>
<button type="button" class="btn btn-primary" onclick="take_top(15);">15</button> <button type="button" class="btn btn-primary" onclick="take_top(15);">15</button>
<button type="button" class="btn btn-primary" onclick="take_top(0);">...</button>
</div> </div>
</div> </div>