Results 1 to 2 of 2

Thread: Loading Script Not Formatting Charts

  1. #1

    Thread Starter
    Member
    Join Date
    Apr 2010
    Location
    Frisco, Texas
    Posts
    33

    Loading Script Not Formatting Charts

    For some reason, I can get the first chart to become formatted using the code below, but the other 4 won't format properly. I had a similar problem with the DataGridView's, but I moved all of the with statements before I adjusted the Charts and they now work. I can see no reason why this would cause only one chart to be formatted and the rest to stay blank. The code was copied and renamed in the With statement for the appropriate Name of the charts.

    Code:
    Private Sub PZ_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
            Dim x As Integer
    
            Me.MdiParent = Main
    
            With PZSheet
                .RowHeadersVisible = False
                .ColumnCount = 3
                .Columns(0).Name = "Date"
                .Columns(0).Width = 65
                .Columns(1).Name = "*** Prod"
                .Columns(1).Width = 75
                .Columns(2).Name = "SITP"
                .Columns(2).Width = 75
                .ScrollBars = System.Windows.Forms.ScrollBars.Vertical
                .ColumnHeadersDefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter
            End With
    
            With ColeUnadj
                .RowHeadersVisible = False
                .ColumnCount = 5
                .RowCount = 5
                For x = 0 To 4
                    .Columns(x).Width = 46
                    .Rows(x).Height = 17
                Next
                .Columns(0).Name = "Pab"
                .Columns(1).Name = "z"
                .Columns(2).Name = "P/Za"
                .Columns(3).Name = "GUR"
                .Columns(4).Name = "RF%"
                .ScrollBars = 0
                .ColumnHeadersDefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter
            End With
    
            With RoachUnadj
                .RowHeadersVisible = False
                .ColumnCount = 5
                .RowCount = 5
                For x = 0 To 4
                    .Columns(x).Width = 46
                    .Rows(x).Height = 17
                Next
                .Columns(0).Name = "Pab"
                .Columns(1).Name = "z"
                .Columns(2).Name = "P/Za"
                .Columns(3).Name = "GUR"
                .Columns(4).Name = "RF%"
                .ScrollBars = 0
                .ColumnHeadersDefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter
            End With
    
            With RoachAdj
                .RowHeadersVisible = False
                .ColumnCount = 5
                .RowCount = 5
                For x = 0 To 4
                    .Columns(x).Width = 46
                    .Rows(x).Height = 17
                Next
                .Columns(0).Name = "Pab"
                .Columns(1).Name = "z"
                .Columns(2).Name = "P/Za"
                .Columns(3).Name = "GUR"
                .Columns(4).Name = "RF%"
                .ScrollBars = 0
                .ColumnHeadersDefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter
            End With
    
            With RamaUnadj
                .RowHeadersVisible = False
                .ColumnCount = 5
                .RowCount = 5
                For x = 0 To 4
                    .Columns(x).Width = 46
                    .Rows(x).Height = 17
                Next
                .Columns(0).Name = "Pab"
                .Columns(1).Name = "z"
                .Columns(2).Name = "P/Za"
                .Columns(3).Name = "GUR"
                .Columns(4).Name = "RF%"
                .ScrollBars = 0
                .ColumnHeadersDefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter
            End With
    
            With RamaAdj
                .RowHeadersVisible = False
                .ColumnCount = 5
                .RowCount = 5
                For x = 0 To 4
                    .Columns(x).Width = 46
                    .Rows(x).Height = 17
                Next
                .Columns(0).Name = "Pab"
                .Columns(1).Name = "z"
                .Columns(2).Name = "P/Za"
                .Columns(3).Name = "GUR"
                .Columns(4).Name = "RF%"
                .ScrollBars = 0
                .ColumnHeadersDefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter
            End With
    
            With ColeGraph1
                .BorderlineColor = Color.Black
                .BorderDashStyle = ChartDashStyle.Solid
                .Legends(0).Alignment = StringAlignment.Center
                .Legends(0).Docking = Docking.Bottom
                .Titles(0).Font = New System.Drawing.Font("Microsoft Sans Serif", 12, FontStyle.Bold)
                .Titles(0).Text = "Unadjusted Cole P/Z vs Cumulative Production Analysis"
                .ChartAreas(0).AxisX.Title = "Cumulative Production (MMcf)"
                .ChartAreas(0).AxisX.TitleFont = New System.Drawing.Font("Microsoft Sans Serif", 10, FontStyle.Bold)
                .ChartAreas(0).AxisX.Minimum = 0
                .ChartAreas(0).AxisX.Maximum = [Double].NaN
                .ChartAreas(0).AxisY.Title = "BHP/Z"
                .ChartAreas(0).AxisY.TitleFont = New System.Drawing.Font("Microsoft Sans Serif", 10, FontStyle.Bold)
                .ChartAreas(0).AxisY.Minimum = 0
                .ChartAreas(0).AxisY.Maximum = [Double].NaN
            End With
    
            With ColeGraph2
                .BorderlineColor = Color.Black
                .BorderDashStyle = ChartDashStyle.Solid
                .Legends(0).Alignment = StringAlignment.Center
                .Legends(0).Docking = Docking.Bottom
                .Titles(0).Font = New System.Drawing.Font("Microsoft Sans Serif", 12, FontStyle.Bold)
                .Titles(0).Text = "Unadjusted Cole GIP vs Cumulative Production Analysis"
                .ChartAreas(0).AxisX.Title = "Cumulative Production (MMcf)"
                .ChartAreas(0).AxisX.TitleFont = New System.Drawing.Font("Microsoft Sans Serif", 10, FontStyle.Bold)
                .ChartAreas(0).AxisX.Minimum = 0
                .ChartAreas(0).AxisX.Maximum = [Double].NaN
                .ChartAreas(0).AxisY.Title = "GIP (MMcf)"
                .ChartAreas(0).AxisY.TitleFont = New System.Drawing.Font("Microsoft Sans Serif", 10, FontStyle.Bold)
                .ChartAreas(0).AxisY.Minimum = 0
                .ChartAreas(0).AxisY.Maximum = [Double].NaN
            End With
    
            With RoachGraph1
                .BorderlineColor = Color.Black
                .BorderDashStyle = ChartDashStyle.Solid
                .Legends(0).Alignment = StringAlignment.Center
                .Legends(0).Docking = Docking.Bottom
                .Titles(0).Font = New System.Drawing.Font("Microsoft Sans Serif", 12, FontStyle.Bold)
                .Titles(0).Text = "Roach Alpha vs Beta"
                .ChartAreas(0).AxisX.Title = "Beta (MMcf/psia)"
                .ChartAreas(0).AxisX.TitleFont = New System.Drawing.Font("Microsoft Sans Serif", 10, FontStyle.Bold)
                .ChartAreas(0).AxisX.Minimum = 0
                .ChartAreas(0).AxisX.Maximum = [Double].NaN
                .ChartAreas(0).AxisY.Title = "Alpha (x 10^-6 psia^-1"
                .ChartAreas(0).AxisY.TitleFont = New System.Drawing.Font("Microsoft Sans Serif", 10, FontStyle.Bold)
                .ChartAreas(0).AxisY.Minimum = [Double].NaN
                .ChartAreas(0).AxisY.Maximum = [Double].NaN
            End With
    
            With RoachGraph2
                .BorderlineColor = Color.Black
                .BorderDashStyle = ChartDashStyle.Solid
                .Legends(0).Alignment = StringAlignment.Center
                .Legends(0).Docking = Docking.Bottom
                .Titles(0).Font = New System.Drawing.Font("Microsoft Sans Serif", 12, FontStyle.Bold)
                .Titles(0).Text = "Roach Anaylsis of GIIP"
                .ChartAreas(0).AxisX.Title = "Cumulative Production (MMcf)"
                .ChartAreas(0).AxisX.TitleFont = New System.Drawing.Font("Microsoft Sans Serif", 10, FontStyle.Bold)
                .ChartAreas(0).AxisX.Minimum = 0
                .ChartAreas(0).AxisX.Maximum = [Double].NaN
                .ChartAreas(0).AxisY.Title = "BHP/Z"
                .ChartAreas(0).AxisY.TitleFont = New System.Drawing.Font("Microsoft Sans Serif", 10, FontStyle.Bold)
                .ChartAreas(0).AxisY.Minimum = 0
                .ChartAreas(0).AxisY.Maximum = [Double].NaN
            End With
    
            With RamaGraph1
                .BorderlineColor = Color.Black
                .BorderDashStyle = ChartDashStyle.Solid
                .Legends(0).Alignment = StringAlignment.Center
                .Legends(0).Docking = Docking.Bottom
                .Titles(0).Font = New System.Drawing.Font("Microsoft Sans Serif", 12, FontStyle.Bold)
                .Titles(0).Text = "Ramagost P/Z vs Cumulative Production Anaylsis"
                .ChartAreas(0).AxisX.Title = "Cumulative Gas (MMcf)"
                .ChartAreas(0).AxisX.TitleFont = New System.Drawing.Font("Microsoft Sans Serif", 10, FontStyle.Bold)
                .ChartAreas(0).AxisX.Minimum = 0
                .ChartAreas(0).AxisX.Maximum = [Double].NaN
                .ChartAreas(0).AxisY.Title = "BHP/Z"
                .ChartAreas(0).AxisY.TitleFont = New System.Drawing.Font("Microsoft Sans Serif", 10, FontStyle.Bold)
                .ChartAreas(0).AxisY.Minimum = 0
                .ChartAreas(0).AxisY.Maximum = [Double].NaN
            End With
        End Sub


    My machine has Windows 7 Pro with Office 2010. I'm working in Visual Basic 2010 Express Edition.

  2. #2

    Thread Starter
    Member
    Join Date
    Apr 2010
    Location
    Frisco, Texas
    Posts
    33

    Re: Loading Script Not Formatting Charts

    It seems that it was the .title comments that were keeping it from going to the next graph formatting comment. I have relocated those lines of code to later in the project instead of within the loading subroutine. I'm curious though why it would cause this problem, does anyone have any idea why? It would be useful for future coding. Thank you.
    My machine has Windows 7 Pro with Office 2010. I'm working in Visual Basic 2010 Express Edition.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width