当代码创建图表时,它只占用y值(最终流量)。
x值是1,2,3,4,5,而不是我的数组流的值
If ActiveSheet.ChartObjects.Count > 0 Then
ActiveSheet.ChartObjects.Delete
End If
ActiveSheet.Shapes.AddChart2(240, xlXYScatter, Left:=20, Width:=360, Height:=300, Top:=252).Select
With ActiveChart
.ChartType = xlXYScatter
.HasTitle = True
.ChartTitle.Characters.Text = "Tubing Performance Curve"
.ChartTitle.Font.Color = vbBlack
.Axes(xlCategory, xlPrimary).HasTitle = True
.Axes(xlCategory, xlPrimary).AxisTitle.Characters.Text = "FlowRate(MCF/Day)"
.Axes(xlValue, xlPrimary).HasTitle = True
.Axes(xlValue, xlPrimary).AxisTitle.Characters.Text = "Welbore Flowing Pressure (psia)"
.HasLegend = False
End With
ActiveChart.SeriesCollection.NewSeries
With ActiveChart.SeriesCollection(1)
.XValues = flows
.Values = finalflow
.Format.Line.Visible = msoTrue
.Format.Line.ForeColor.RGB = RGB(0, 0, 225)
.Format.Line.Weight = 2
.HasDataLabels = True
End With