Weather Data Plotter

The weather plotter takes weather parameters like temperature, dew point, sea level pressure and cloud base and plots them on a chronological scale.
Follow This Link for a Live Demo
<%@ Page Title="METAR Trend Viewer" Language="vb" AutoEventWireup="false" MasterPageFile="~/samples/sample.master" CodeBehind="weatherplotter.aspx.vb" Inherits="www.aviationwebdesign.co.uk.weatherplot" %>
<%@ Register Src="~/web_user_controls/weatherdata.ascx" TagPrefix="awduc" TagName="weatherdata" %>
<%@ MasterType TypeName="www.aviationwebdesign.co.uk.sample1" %>
<%@ Register  TagPrefix="awduc" TagName="Weatherplotter" Src="~/web_user_controls/weatherplotter.ascx"%>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
<h1>Metar Trend Viewer</h1>
   ICAO Code:<asp:TextBox ID="txtICAO" runat="server" Columns="4"></asp:TextBox>
    <asp:Button ID="Button1" runat="server" Text="Submit" /><br />
<awduc:Weatherplotter runat="server" ID="wx" width="500" /><br />
    <asp:Panel ID="pnlForTheKeys" runat="server">
    </asp:Panel>
    <asp:HyperLink ID="HyperLink1" runat="server">View Data Only</asp:HyperLink>
    
    <awduc:weatherdata runat="server" id="weatherdata" />
    
    <asp:Repeater ID="Repeater1" runat="server">
    <HeaderTemplate><table></HeaderTemplate>
    <FooterTemplate></table></FooterTemplate>
    <ItemTemplate><tr><td colspan="2"><%#Eval("Text")%></td></tr><!--
    <tr><td><%#Eval("Temperature")%>&nbsp;/&nbsp; <%#Eval("Dewpoint") %></td><td><%#Eval("QNH")%></td></tr>
    --></ItemTemplate>
    </asp:Repeater>
</asp:Content>
Partial Public Class weatherplot
    Inherits System.Web.UI.Page

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load

        wx.ICAO = Master.ICAO
        wx.OnDate = Master.OnDate
        wx.Mode = Master.Mode
        wx.backdays = Master.BackDays

        'Get Parameters
        
        Dim libackdays As Integer = wx.backdays
        Dim liDays As Integer
        Dim loMetars As New AvBrowserBusObj.CMetars

        'Go Back As Many Days As Necessary, Populate without Clearing
        For liDays = liBackDays To 0 Step -1
            loMetars.Populate(wx.ICAO, wx.OnDate.AddDays(-liDays))
        Next

        Master.Header = "Weather Trend For " & wx.ICAO & "&nbsp;" & wx.OnDate.ToShortDateString

        AddAKey()

        HyperLink1.NavigateUrl = "/samples/metars.aspx?ICAO=" & wx.ICAO & IIf(Request.QueryString("OnDate") = "", "", "&OnDate=" & Request.QueryString("OnDate"))

        Repeater1.DataSource = loMetars
        Repeater1.DataBind()

    End Sub

    Private Sub AddAKey()
        Dim lox As Label

        lox = New Label
        lox.ForeColor = System.Drawing.ColorTranslator.FromHtml(wx.DewPointColor)
        lox.Text = "DewPoint"

        Panel1.Controls.Add(lox)

        lox = New Label
        lox.ForeColor = System.Drawing.ColorTranslator.FromHtml(wx.PressureColor)
        lox.Text = "Pressure"

        Panel1.Controls.Add(lox)

        lox = New Label
        lox.ForeColor = System.Drawing.ColorTranslator.FromHtml(wx.TemperatureColor)
        lox.Text = "Temperature"

        Panel1.Controls.Add(lox)

    End Sub

End Class