2 charts instead of 1 for OWC11

K

Kizzy

I'm trying to run this vbscript from command line:

Can u tell me why each of my .png files show 2 charts instead of 1?

objRS is an ADO Client Side, non forward only recordset with distinct values
for fields(1).
strConn is a SQL server Connection String

***CODE***
Set objChartSpace = CreateObject("OWC11.ChartSpace")
Set c = objChartSpace.Constants

While not objRS.EOF

strSql = "SELECT Time,throughput from hourView where remote='" &
objRS.Fields(1).Value & "' ORDER BY Time"
With objChartSpace
..Clear
..Connectionstring=strConn
..CommandText=strSql
..PlotAllAggregates = c.chPlotAggregatesCategories
..DisplayFieldButtons = False
..Charts.Add(0)

With .Charts(0)
..SeriesCollection.Add(0)
..SetData c.chDimCategories, c.chDataBound, "Time"
..SetData c.chDimValues, c.chDataBound, "throughput"
..Type = c.chChartTypeColumnClustered
..Border.Color = &HFFFFFF
..Axes.Item(1).Scaling.Minimum = 90
..Axes.Item(1).Scaling.Maximum = 100
..Axes.Item(1).MajorGridlines.Line.DashStyle = c.chLineDash
..Axes.Item(1).MajorTickMarks = c.chTickMarkOutside
..Axes.Item(1).MajorUnit = 1
..Axes.Item(1).HasTitle = True
..Axes.Item(1).Title.Caption = "throughput (%)"
..Border.Color = 0
..GapWidth = 0
..PlotArea.Interior.Color = &HC0
..SeriesCollection(0).Border.Color = 32768
..SeriesCollection(0).Interior.Color = 32768
End With

..ExportPicture "C:\graphs\" & objRS.Fields(1).Value & ".png", "png", 600,
400

End With

objRS.MoveNext
Wend
***END CODE***

THANKS!
 
J

John Smith

Because you are adding a chartspace everytime you read a record from your
ado recordset
 

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

Top