auto chart update causes performance problem

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • wwwpete

    auto chart update causes performance problem

    Hi guys,

    I have a problem when generating a chart from the objGraph.Applic ation.
    DataSheet using MSChart8(s. code):
    The graph ist updated and therefore drawn everytime I update the DataSheet.
    Since there isa lot of data
    inserted into the DataSheet, this causes performance issues.

    Any ideas ?


    thx and best regards,

    wwwpete



    Dim RS As DAO.Recordset

    Dim DateString, StartDate, SQL, UserName As String
    Dim Feld() As Double 'enthält die Quantilsdaten
    Dim UQuantile, EQuantile As Double
    Dim i, j, tmp, NumberOfData As Long

    Dim myGraph As Object


    Dim objDS As Object

    'Greife auf Datenblatt
    Set objDS = ObjGraph.Applic ation.DataSheet

    objDS.Cells.Cle ar

    'Spaltentitel setzen
    objDS.Cells(1, 1) = "Quantile"
    objDS.Cells(1, 2) = "Q2"
    objDS.Cells(1, 3) = "UQuantile"


    SQL = "SELECT * FROM ...;"
    Set RS = CurrentDb().Ope nRecordset(SQL, dbOpenSnapshot)

    i = 0

    Do While Not RS.EOF
    ReDim Preserve Feld(i)
    Feld(i) = RS("Quantile")
    RS.MoveNext
    i = i + 1
    Loop
    'Bestimme die Stichprobengrö sse
    NumberOfData = i
    tmp = 0

    For i = 0 To NumberOfData - 1
    'Wahrscheinlich keit bei U(0,1) ZV
    UQuantile = (i + 1) / NumberOfData
    'Bestimme die Anzahl der Quantile in der Stichprobe, die kleiner
    als UQuantile sind.
    If tmp -1 Then
    j = tmp
    Else
    j = 0
    End If
    Do While (j < NumberOfData)
    If Feld(j) UQuantile Then
    Exit Do
    End If
    j = j + 1
    Loop
    tmp = j - 1
    'empiriche Wahrscheinlichk eit aus Stichprobe
    EQuantile = j / NumberOfData

    'Schreibe Datensatz in Tabelle
    objDS.Cells(i + 2, 1) = Feld(i)
    objDS.Cells(i + 2, 2) = UQuantile
    objDS.Cells(i + 2, 3) = Feld(i)
    Next i
    End If
    'Schreibe Punkte (0,0) und (1,1) in Tabelle (für besser Darstellung).
    objDS.Cells(Num berOfData + 2, 1) = 1
    objDS.Cells(Num berOfData + 2, 3) = 1
    objDS.Cells(Num berOfData + 3, 1) = 0
    objDS.Cells(Num berOfData + 3, 3) = 0
    Set objDS = Nothing
    DoEvents
    ObjGraph.Applic ation.PlotBy = xlRows
    ObjGraph.Applic ation.PlotBy = xlColumns
    ObjGraph.Refres h
    Set ObjGraph = Nothing

Working...