| 
						
						
							
								
							
						
						
					 | 
				
				 | 
				
					@ -82,6 +82,15 @@ class Chart { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        .attr('x1', this.margin.left).attr('y1', this.yRange(value)) | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        .attr('x2',  this.width).attr('y2', this.yRange(value)) | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    draw_box(x1, x2, style) { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        const x = this.xRange(x1) | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        const width = this.xRange(x2) - x | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        this.canvas.append('rect').attr('class', style) | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        .attr('x', x).attr('y', this.offset) | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        .attr('width', width) | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        .attr('height', this.height - this.offset - this.margin.bottom) | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					} | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
	
		
			
				
					| 
						
						
						
							
								
							
						
					 | 
				
				 | 
				
					@ -99,7 +108,7 @@ export function render_astronomy(canvas, height, offset, data) { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    chart.draw_yAxisTitle('Altitude') | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    chart.set_yAxisTic( 0,  '0°') | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    chart.set_yAxisTic(45 * (Math.PI/180), '45°') | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    chart.set_yAxisTic(26.6 * (Math.PI/180), '27°') | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    chart.set_yAxisTic(75 * (Math.PI/180), '75°') | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    const year = chart.beginTime.getFullYear() | 
				
			
			
		
	
	
		
			
				
					| 
						
						
						
							
								
							
						
					 | 
				
				 | 
				
					@ -110,18 +119,24 @@ export function render_astronomy(canvas, height, offset, data) { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    const lon = -75.1696126 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    for (var day = chart.beginTime.getDate(); day <= chart.endTime.getDate(); day++) { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        const noon = new Date(year, month, day, 12, 0, 0) | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        const midnight = new Date(year, month, day, 0, 0, 0) | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        chart.set_xAxisTic(noon, noon.toLocaleDateString('en-US', {weekday: 'long'})) | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        chart.draw_yGrid(noon, 'noon') | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        // Don't draw the first midnight line because that's also our yAxis line
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        if (day != chart.beginTime.getDate()) { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            const midnight = new Date(year, month, day, 0, 0, 0) | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            chart.draw_yGrid(midnight, 'midnight') | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        // Solar Ephemeris
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        let todaysSun = [] | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        const sunEphem = SunCalc.getTimes(new Date(year, month, day, 1, 0, 0), lat, lon) | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        chart.draw_box(midnight, sunEphem.nauticalDawn, 'night') | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        chart.draw_box(sunEphem.nauticalDawn, sunEphem.sunrise, 'twilight') | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        chart.draw_box(sunEphem.sunset, sunEphem.nauticalDusk, 'twilight') | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        chart.draw_box(sunEphem.nauticalDusk, new Date(year, month, day, 24, 0, 0), 'night') | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        todaysSun.push({ | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            'date': sunEphem.sunrise, | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            'alt': 0 | 
				
			
			
		
	
	
		
			
				
					| 
						
							
								
							
						
						
						
					 | 
				
				 | 
				
					
  |