VBA:Chart_Data点在图形中不可见 [英] VBA: Chart_Data points not visible in graph
本文介绍了VBA:Chart_Data点在图形中不可见的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我没有得到下面给出的数据的线曲线,但是我看到了正在绘制的数据,但看不到它是一条平滑的线.请帮忙.
I dont get the line curve for the data given below however I see the data being plotted but not visible as a smooth line. Please help.
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
这篇关于VBA:Chart_Data点在图形中不可见的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文