Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

formatacao inicial do report

  • Loading branch information...
commit 9742cf53de4998832a0964a603d314c3eed9ac06 1 parent 694217c
setuid setuid authored
BIN  previsao/previsao.db
View
Binary file not shown
39 previsao/report/templates/report/chart.html
View
@@ -18,19 +18,44 @@
title: { text: 'Previsão de Ondas' },
tooltips: { type: 'shared' },
animation: { duration: 1 },
- series: [
- {
- type: 'spline',
- title: 'Waves',
- {{ data_waves }}
- }
- ]
+ axes: [
+ {
+ type: 'linear',
+ location: 'left',
+ title: 'altura (m)'
+ },
+ {
+ type: 'dateTime',
+ location: 'bottom',
+ interval: 1,
+ intervalType: 'days'
+ }
+ ],
+ series: [
+ {
+ type: 'spline',
+ title: 'Waves',
+ {{ data_waves }}
+ }
+ ]
});
$('#winds').jqChart({
title: { text: 'Previsão de Ventos' },
tooltips: { type: 'shared' },
animation: { duration: 1 },
+ axes: [
+ {
+ type: 'linear',
+ location: 'left',
+ title: 'velocidade (nós)'
+ },
+ {
+ type: 'dateTime',
+ location: 'bottom',
+ interval: 1,
+ intervalType: 'days'
+ }],
series: [
{
type: 'spline',
51 previsao/report/views.py
View
@@ -4,14 +4,51 @@
from models import ReportDay
def home(request):
- rd = ReportDay.objects.all()[0]
- waves = make_wave_report_string( rd )
- winds = make_wind_report_string( rd )
+ waves = make_wave_report_string()
+ winds = make_wind_report_string()
return render(request, 'report/chart.html', {"data_waves" : waves, "data_winds" : winds } )
-def make_wave_report_string( rd ):
- return "data : [[ new Date(%s, %s, %s, %s, 0, 0), %s], [ new Date(%s, %s, %s, %s, 0, 0), %s], [ new Date(%s, %s, %s, %s, 0, 0), %s], [ new Date(%s, %s, %s, %s, 0, 0), %s], [ new Date(%s, %s, %s, %s, 0, 0), %s]]" % (rd.date.year, rd.date.month, rd.date.day, '5', rd.fiveAM.waveReport.height, rd.date.year, rd.date.month, rd.date.day, '8', rd.eightAM.waveReport.height, rd.date.year, rd.date.month, rd.date.day, '11', rd.elevenAM.waveReport.height, rd.date.year, rd.date.month, rd.date.day, '14', rd.twoPM.waveReport.height, rd.date.year, rd.date.month, rd.date.day, '17', rd.fivePM.waveReport.height)
+def make_wave_report_string( ):
+ str = "data : [ "
+ for rd in ReportDay.objects.all():
+ for x in range(0, 5):
+ if x == 0:
+ str = str + "%s," % make_wave_report( rd.date, '05', rd.fiveAM.waveReport)
+ elif x == 1:
+ str = str + "%s," % make_wave_report( rd.date, '08', rd.eightAM.waveReport)
+ elif x == 2:
+ str = str + "%s," % make_wave_report( rd.date, '11', rd.elevenAM.waveReport)
+ elif x == 3:
+ str = str + "%s," % make_wave_report( rd.date, '14', rd.twoPM.waveReport)
+ elif x == 4:
+ str = str + "%s," % make_wave_report( rd.date, '17', rd.fivePM.waveReport)
+ elif x == 5:
+ str = str + "%s," % make_wave_report( rd.date, '20', rd.eightPM.waveReport)
-def make_wind_report_string( rd ):
- return "data : [[ new Date(%s, %s, %s, %s, 0, 0), %s], [ new Date(%s, %s, %s, %s, 0, 0), %s], [ new Date(%s, %s, %s, %s, 0, 0), %s], [ new Date(%s, %s, %s, %s, 0, 0), %s], [ new Date(%s, %s, %s, %s, 0, 0), %s]]" % (rd.date.year, rd.date.month, rd.date.day, '5', rd.fiveAM.windReport.intensity, rd.date.year, rd.date.month, rd.date.day, '8', rd.eightAM.windReport.intensity, rd.date.year, rd.date.month, rd.date.day, '11', rd.elevenAM.windReport.intensity, rd.date.year, rd.date.month, rd.date.day, '14', rd.twoPM.windReport.intensity, rd.date.year, rd.date.month, rd.date.day, '17', rd.fivePM.windReport.intensity)
+ return str + " ]"
+
+def make_wind_report_string( ):
+ str = "data : [ "
+ for rd in ReportDay.objects.all():
+ for x in range(0, 5):
+ if x == 0:
+ str = str + "%s," % make_wind_report( rd.date, '05', rd.fiveAM.windReport)
+ elif x == 1:
+ str = str + "%s," % make_wind_report( rd.date, '08', rd.eightAM.windReport)
+ elif x == 2:
+ str = str + "%s," % make_wind_report( rd.date, '11', rd.elevenAM.windReport)
+ elif x == 3:
+ str = str + "%s," % make_wind_report( rd.date, '14', rd.twoPM.windReport)
+ elif x == 4:
+ str = str + "%s," % make_wind_report( rd.date, '17', rd.fivePM.windReport)
+ elif x == 5:
+ str = str + "%s," % make_wind_report( rd.date, '20', rd.eightPM.windReport)
+
+ return str + " ]"
+
+def make_wave_report( report_date, report_hour, waveReport ):
+ return "[ new Date(%s, %s, %s, %s, 0, 0), %s]" % (report_date.year, report_date.month, report_date.day, report_hour, waveReport.height)
+
+def make_wind_report( report_date, report_hour, windReport ):
+ return "[ new Date(%s, %s, %s, %s, 0, 0), %s]" % (report_date.year, report_date.month, report_date.day, report_hour, windReport.intensity)
Please sign in to comment.
Something went wrong with that request. Please try again.