VBA:Chart_Data 个点在图表中不可见
VBA: Chart_Data points not visible in graph
我没有得到下面给出的数据的直线曲线,但是我看到正在绘制数据但看不到一条平滑的线。请帮忙。
Column B Column C
x y
0.00 0.00
-0.10 0.29
-0.35 0.48
-0.65 0.48
-0.90 0.29
-1.00 0.00
Set ch = ActiveSheet.ChartObjects("Chart 1")
ActiveChart.ChartType = xlXYScatterSmoothNoMarkers
ch.Activate
p=1
For i = 1 To 6
ser_count = ActiveChart.SeriesCollection.Count
p = ser_count + 1
ActiveChart.SeriesCollection.NewSeries
ActiveChart.SeriesCollection(p).XValues = ActiveSheet.Range("b" & i)
ActiveChart.SeriesCollection(p).Values = ActiveSheet.Range("c" & i)
ActiveChart.SeriesCollection(p).Format.Line.Visible = msoTrue
ActiveChart.SeriesCollection(p).Format.Line.ForeColor.RGB = RGB(255, 0, 0)
ActiveChart.SeriesCollection(p).Format.Line.Weight = 1
ActiveChart.SeriesCollection(p).Format.Line.DashStyle = msoLineSolid
Next i
试试,
Dim objCh As ChartObject
Dim ch As Chart
Dim Srs As Series
Set objCh = ActiveSheet.ChartObjects("Chart 1")
'Set objCh = ActiveSheet.ChartObjects(1)
Set ch = objCh.Chart
With ch
.ChartType = xlXYScatterSmoothNoMarkers
Set Srs = .SeriesCollection.NewSeries
With Srs
.XValues = ActiveSheet.Range("b1").Resize(6)
.Values = ActiveSheet.Range("c1").Resize(6)
.Format.Line.Visible = msoTrue
.Format.Line.ForeColor.RGB = RGB(255, 0, 0)
.Format.Line.Weight = 1
.Format.Line.DashStyle = msoLineSolid
End With
End With
我没有得到下面给出的数据的直线曲线,但是我看到正在绘制数据但看不到一条平滑的线。请帮忙。
Column B Column C
x y
0.00 0.00
-0.10 0.29
-0.35 0.48
-0.65 0.48
-0.90 0.29
-1.00 0.00
Set ch = ActiveSheet.ChartObjects("Chart 1")
ActiveChart.ChartType = xlXYScatterSmoothNoMarkers
ch.Activate
p=1
For i = 1 To 6
ser_count = ActiveChart.SeriesCollection.Count
p = ser_count + 1
ActiveChart.SeriesCollection.NewSeries
ActiveChart.SeriesCollection(p).XValues = ActiveSheet.Range("b" & i)
ActiveChart.SeriesCollection(p).Values = ActiveSheet.Range("c" & i)
ActiveChart.SeriesCollection(p).Format.Line.Visible = msoTrue
ActiveChart.SeriesCollection(p).Format.Line.ForeColor.RGB = RGB(255, 0, 0)
ActiveChart.SeriesCollection(p).Format.Line.Weight = 1
ActiveChart.SeriesCollection(p).Format.Line.DashStyle = msoLineSolid
Next i
试试,
Dim objCh As ChartObject
Dim ch As Chart
Dim Srs As Series
Set objCh = ActiveSheet.ChartObjects("Chart 1")
'Set objCh = ActiveSheet.ChartObjects(1)
Set ch = objCh.Chart
With ch
.ChartType = xlXYScatterSmoothNoMarkers
Set Srs = .SeriesCollection.NewSeries
With Srs
.XValues = ActiveSheet.Range("b1").Resize(6)
.Values = ActiveSheet.Range("c1").Resize(6)
.Format.Line.Visible = msoTrue
.Format.Line.ForeColor.RGB = RGB(255, 0, 0)
.Format.Line.Weight = 1
.Format.Line.DashStyle = msoLineSolid
End With
End With