Imports System.Drawing
Imports System.Windows.Forms
Imports System.ComponentModel

Public Class LinePlot
  Inherits BarPlot

  Public Sub New()
    MyBase.New()
    LinePlot = Me
    InitializeComponent()
    bpen = New Pen(Color.Black)
  End Sub

  'Form overrides dispose to clean up the component list.
  Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
    If disposing Then
      If Not (components Is Nothing) Then
        components.Dispose()
      End If
    End If
    MyBase.Dispose(disposing)
  End Sub

#Region " Windows Form Designer generated code "

  'Required by the Windows Form Designer
  Private components As System.ComponentModel.Container

  Dim WithEvents LinePlot As System.Windows.Forms.Form

  'NOTE: The following procedure is required by the Windows Form Designer
  'It can be modified using the Windows Form Designer.  
  'Do not modify it using the code editor.
  Private Sub InitializeComponent()
    Me.SuspendLayout()
    '
    'Pic
    '
    Me.Pic.Visible = True
    '
    'BarPlot
    '
    Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13)
    Me.ClientSize = New System.Drawing.Size(292, 269)
    Me.Controls.AddRange(New System.Windows.Forms.Control() {Me.Pic})
    Me.Name = "BarPlot"
    Me.Text = "LinePlot"
    Me.ResumeLayout(False)

  End Sub

#End Region

  Public Overrides Sub Pic_Paint(ByVal sender As System.Object, ByVal e As System.Windows.Forms.PaintEventArgs)
    Dim g As Graphics = e.Graphics
    Dim i, ix, iy, ix1, iy1 As Integer
    Dim br As Brush
    Dim h As Integer
    h = pic.Height
    If hasData Then
      For i = 1 To x.Length - 1
        ix = calcx(x(i - 1))
        iy = calcy(y(i - 1))
        ix1 = calcx(x(i))
        iy1 = calcy(y(i))
        g.DrawLine(bpen, ix, h - iy, ix1, h - iy1)
      Next
    End If
  End Sub

End Class
