Browse Source

render_astronomy: fix sun ephem for daylight savings time

master
Nathan Bergey 6 years ago
parent
commit
9da9e5a01a
  1. 12
      src/render.js

12
src/render.js

@ -221,10 +221,6 @@ export function render_astronomy(canvas, width, height, offset, data) {
.attr('width', box_width) .attr('width', box_width)
.attr('height', margin.bottom) .attr('height', margin.bottom)
chart.set_yAxisTic( 0, '0°')
chart.set_yAxisTic(26.6 * (Math.PI/180), '27°')
chart.set_yAxisTic(75 * (Math.PI/180), '75°')
let sunData = [] let sunData = []
const year = data.beginTime.getFullYear() const year = data.beginTime.getFullYear()
const month = data.beginTime.getMonth() const month = data.beginTime.getMonth()
@ -235,7 +231,7 @@ export function render_astronomy(canvas, width, height, offset, data) {
// Solar Ephemeris // Solar Ephemeris
let todaysSun = [] let todaysSun = []
const sunEphem = SunCalc.getTimes(new Date(year, month, day, 1, 0, 0), lat, lon)
const sunEphem = SunCalc.getTimes(new Date(year, month, day, 2, 0, 0), lat, lon)
todaysSun.push({ todaysSun.push({
'date': sunEphem.sunrise, 'date': sunEphem.sunrise,
'alt': 0 'alt': 0
@ -279,8 +275,10 @@ export function render_astronomy(canvas, width, height, offset, data) {
.attr('class', 'sun') .attr('class', 'sun')
.attr('d', line) .attr('d', line)
// chart.draw_yAxisLine()
// chart.draw_xAxisLineTop()
chart.set_yAxisTic( 0, '0°')
chart.set_yAxisTic(26.6 * (Math.PI/180), '27°')
chart.draw_xGrid( 26.6 * (Math.PI/180), 'guide')
chart.set_yAxisTic(75 * (Math.PI/180), '75°')
chart.draw_xAxisLineBottom() chart.draw_xAxisLineBottom()
} }

Loading…
Cancel
Save