SpaceChart - can't see the chart

T

tuli

I have this macro in VBA excel. I can see the traces. Please advise. I
am using ChartSpace from Microsoft Office 11. Xp pro.

Thanks

Tuli

Dim oChart, oSeries1, oSeries2
Dim oAxis1, oAxis2, oConst
Dim S1(43), S2(43), S3(43) As Variant

For i = 1 To 43
S1(i) = Cells(i + 1, 2)
S2(i) = Cells(i + 1, 3)
S3(i) = Cells(i + 1, 4)
Next


Ak = Cells(i - 1, 4)

ChartSpace1.Clear
Set oConst = ChartSpace1.Constants

Set oChart = ChartSpace1.Charts.Add

Set oSeries1 = oChart.SeriesCollection.Add
oSeries1.Caption = "Current"
oSeries1.Type = oConst.chChartTypeScatterSmoothLine
oSeries1.SetData oConst.chDimXValues, oConst.chDataLiteral, S1()
oSeries1.SetData oConst.chDimYValues, oConst.chDataLiteral, S2()

Set oSeries2 = oChart.SeriesCollection.Add
oSeries2.Caption = "estimate"
oSeries2.Type = oConst.chChartTypeScatterSmoothLine
oSeries2.SetData oConst.chDimXValues, oConst.chDataLiteral, S1()
oSeries2.SetData oConst.chDimYValues, oConst.chDataLiteral, S3()


Set oAxis1 = oChart.Axes(oConst.chAxisPositionLeft)
oAxis1.Scaling.Maximum = 0.05
oAxis1.Scaling.Minimum = 0.025
oAxis1.NumberFormat = "0.0%"
oAxis1.HasMajorGridlines = True
Set oAxis2 = oChart.Axes(oConst.chAxisPositionBottom)
oAxis2.Scaling.Maximum = 30
oAxis2.Scaling.Minimum = 0
oAxis2.NumberFormat = "0"
oAxis2.HasMajorGridlines = True

oChart.HasLegend = True
oChart.Legend.Position = oConst.chLegendPositionBottom

oChart.PlotArea.Interior.Color = "white"
 
P

Peter T

It seems to work fine for me, what is the problem and what do you mean by
"traces".

In passing better to declare your arrays like this
Dim S1(1 to 43) as Variant, S2(1 to 43) as Variant

Regards,
Peter
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top