| 
						
						
							
								
							
						
						
					 | 
					 | 
					@ -41,19 +41,12 @@ show_histogram_svg(const vector<double>& bins) {
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    const auto BLOCK_WIDTH = 10;
 | 
					 | 
					 | 
					 | 
					    const auto BLOCK_WIDTH = 10;
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    double average = 0, sum =0, scale=1;
 | 
					 | 
					 | 
					 | 
					    double average = 0, sum =0, scale=1;
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    const auto MAX_WIDTH = (IMAGE_WIDTH - TEXT_WIDTH);
 | 
					 | 
					 | 
					 | 
					    const auto MAX_WIDTH = (IMAGE_WIDTH - TEXT_WIDTH);
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    double sum = 0;
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    double max_count = (bins[0] * BLOCK_WIDTH);
 | 
					 | 
					 | 
					 | 
					    double max_count = (bins[0] * BLOCK_WIDTH);
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    for (double bin: bins){
 | 
					 | 
					 | 
					 | 
					    for (double bin: bins){
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        if ((bin * BLOCK_WIDTH) > max_count) {
 | 
					 | 
					 | 
					 | 
					        if ((bin * BLOCK_WIDTH) > max_count) {
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            max_count = (bin * BLOCK_WIDTH);
 | 
					 | 
					 | 
					 | 
					            max_count = (bin * BLOCK_WIDTH);
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        }
 | 
					 | 
					 | 
					 | 
					        }
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    }
 | 
					 | 
					 | 
					 | 
					    }
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    for (double bin: bins){
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            sum = sum + (MAX_WIDTH * ((BLOCK_WIDTH * bin) / max_count));
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    }
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    double avg_width = sum/bins.size();
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    svg_begin(400, 300);
 | 
					 | 
					 | 
					 | 
					    svg_begin(400, 300);
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    double top = 0;
 | 
					 | 
					 | 
					 | 
					    double top = 0;
 | 
				
			
			
		
	
	
		
		
			
				
					| 
						
						
						
							
								
							
						
					 | 
					 | 
					@ -63,12 +56,7 @@ show_histogram_svg(const vector<double>& bins) {
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    average = sum / bins.size();
 | 
					 | 
					 | 
					 | 
					    average = sum / bins.size();
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    for (double bin : bins) {
 | 
					 | 
					 | 
					 | 
					    for (double bin : bins) {
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        const double bin_width = MAX_WIDTH * ((BLOCK_WIDTH * bin) / max_count);
 | 
					 | 
					 | 
					 | 
					        const double bin_width = MAX_WIDTH * ((BLOCK_WIDTH * bin) / max_count);
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        if (bin_width > avg_width){
 | 
					 | 
					 | 
					 | 
					        svg_text(TEXT_LEFT, top + TEXT_BASELINE, to_string(bin));
 | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            svg_rect(TEXT_WIDTH, top, bin_width, BIN_HEIGHT, "black", "#e71320");
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        }
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        else {
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            svg_rect(TEXT_WIDTH, top, bin_width, BIN_HEIGHT, "black", "#2fe713");
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        }
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        if (bin > average) {
 | 
					 | 
					 | 
					 | 
					        if (bin > average) {
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            svg_rect(TEXT_WIDTH, top, bin_width / scale, BIN_HEIGHT, "yellow", "red");
 | 
					 | 
					 | 
					 | 
					            svg_rect(TEXT_WIDTH, top, bin_width / scale, BIN_HEIGHT, "yellow", "red");
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        }
 | 
					 | 
					 | 
					 | 
					        }
 | 
				
			
			
		
	
	
		
		
			
				
					| 
						
							
								
							
						
						
						
					 | 
					 | 
					
 
 |