Results 1 to 3 of 3

Thread: Charting series

  1. #1

    Thread Starter
    Junior Member
    Join Date
    May 2013
    Posts
    17

    Charting series

    Hello,
    I am trying to plot two graphs based off data I have. The problem I am encountering is that the first graph is plotting more than the four series I added. There are 14 series on the graph and I don't know why. The second graph came out as I wished. Any ideas? Thank you!

    Code:
       Dim xaxis As Range
       Dim xaxisControl As Range
       Dim yaxis As Range
       Dim yaxisControl As Range
       Dim yaxistwo As Range
       Dim yaxisControltwo As Range
       Dim yaxisthree As Range
       Dim yaxisControlthree As Range
    
     
              
    'freeze cycle
        'Condensor temp
        Set yaxis = Sheets("FreezeData").Range("I:I")
        Set yaxisControl = Sheets("FreezeControl").Range("I:I")
        
        'shelf temp
        Set yaxistwo = Sheets("FreezeData").Range("H:H")
        Set yaxisControltwo = Sheets("FreezeControl").Range("H:H")
    
        'Pressure
        Set yaxisthree = Sheets("FreezeData").Range("L:L")
        Set yaxisControlthree = Sheets("FreezeControl").Range("L:L")
    
    Charts.Add
    ActiveChart.Name = "Freeze temps"
    With ActiveChart
            .ChartArea.AutoScaleFont = False
            .ChartType = xlLine
            .HasTitle = False
            .SeriesCollection.Add _
                Source:=yaxis
            .SeriesCollection.Add _
                Source:=yaxisControl
            .SeriesCollection.Add _
                Source:=yaxistwo
            .SeriesCollection.Add _
                Source:=yaxisControltwo
            .Axes(xlValue).CrossesAt = -100
            .Axes(xlValue).HasTitle = True
            .Axes(xlCategory).HasTitle = True
            .Axes(xlValue).AxisTitle.Characters.Text = "Degrees C"
            .Axes(xlCategory).AxisTitle.Characters.Text = "Time"
            .HasTitle = True
            .ChartTitle.Characters.Text = "Freeze Cycle"
            .Axes(xlValue).MaximumScale = 100
            .Axes(xlValue).MinimumScale = -100
            .SeriesCollection(1).Name = "Condensor Temp"
            .SeriesCollection(2).Name = "Condensor Temp Control"
            .SeriesCollection(3).Name = "Shelf Temp"
            .SeriesCollection(4).Name = "Shelf Temp Control"
            .SeriesCollection(1).Format.Line.Weight = 2
            .SeriesCollection(2).Format.Line.Weight = 2
            .SeriesCollection(3).Format.Line.Weight = 2
            .SeriesCollection(4).Format.Line.Weight = 2
       End With
         
      'customizes the second chart
        
    Charts.Add
    ActiveChart.Name = "Freeze pressure"
    With ActiveChart
            .ChartArea.AutoScaleFont = True
            .ChartType = xlLine
            .HasTitle = False
            .SeriesCollection.Add _
                Source:=yaxisthree
            .SeriesCollection.Add _
                Source:=yaxisControlthree
            .Axes(xlValue).CrossesAt = 400000
            .Axes(xlValue).HasTitle = True
            .Axes(xlCategory).HasTitle = True
            .Axes(xlValue).AxisTitle.Characters.Text = "MTORR"
            .Axes(xlCategory).AxisTitle.Characters.Text = "Time"
            .HasTitle = True
            .ChartTitle.Characters.Text = "Freeze Cycle"
            .Axes(xlValue).MinimumScale = 400000
            .SeriesCollection(1).Name = "Pressure"
            .SeriesCollection(2).Name = "Pressure Control"
            .SeriesCollection(1).Format.Line.Weight = 2
            .SeriesCollection(2).Format.Line.Weight = 2
         
    End With

  2. #2
    Super Moderator si_the_geek's Avatar
    Join Date
    Jul 2002
    Location
    Bristol, UK
    Posts
    41,974

    Re: Charting series

    Thread moved to the 'Office Development/VBA' forum... note that while it certainly isn't made clear, the "VB Editor" in Office programs is actually VBA rather than VB, so the 'VB6' forum is not really apt

  3. #3
    PowerPoster
    Join Date
    Oct 2008
    Location
    Midwest Region, United States
    Posts
    3,574

    Re: Charting series

    Don't see anything obvious. Can you zip and attach the actual workbook?

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