Chart memory usage

A

Alfio

Hello,
I am using the OWC Chart version 9 (Office 2000), embedded
inside an Excel document. The control displays frequently
changing data coming from an ADO recordset.
I am using the Excel "Application.OnTime" method to
schedule updates to run every 5 seconds.

The problem is that every time the refresh routine is
called, the Excel memory usage (from Task manager) grows
by about 600K.

For simplicity I have created a simple Refresh routine
which populates the chart with a recordset of random-
generated values (see below):

Public Sub Refresh()
Dim i As Long
Dim s1 As WCSeries
Dim cds As WCDataSource
Dim oXYChart As WCChart

On Error Resume Next

m_chartCtrl.ScreenUpdating = False

'cleanup previous contents
m_chartCtrl.Clear
m_chartCtrl.ChartLayout = chChartLayoutHorizontal

'add a data source
Set cds = m_chartCtrl.ChartDataSources.Add
cds.DataSourceType = chDataSourceTypeRecordset
Set cds.DataSource = m_rsValues

'add the chart to the ChartSpace
Set oXYChart = m_chartCtrl.Charts.Add
oXYChart.Type = chChartTypeScatterLine
Set s1 = oXYChart.SeriesCollection.Add
s1.SetData chDimXValues, i, 0 'Categories are first
field
s1.SetData chDimYValues, i, 1 'Values are second
field

'refresh the chart
m_chartCtrl.Refresh
m_chartCtrl.ScreenUpdating = True
End Sub

The chart object is encapsulated within a class and
m_chartCtrl is declared as follow:
Private WithEvents m_chartCtrl As ChartSpace


Please, can anybody tell me if there are mistakes in the
previous code?

Any suggestions will be appreciated.

Thanks in advance,
Alfio
 

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