Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
145
Memory problems when using UltraChart in UltragridCells
posted

Hi,

I try to use ultraChart-controls in rows (about 5.000) of an ultragrid. The charts are computed in the InitializeRow-event of the grid, which calls the following method:

Private Sub SetChartControl(ByRef pRow As UltraGridRow, pValueList As List(Of Decimal))

Dim ucce As New Infragistics.Win.UltraWinEditors.UltraControlContainerEditor()

Dim dt As New DataTable
dt.Columns.Add("1", GetType(Decimal))
dt.Columns.Add("2", GetType(Decimal))
dt.Columns.Add("3", GetType(Decimal))

dt.Rows.Add(pValueList.Item(0), pValueList.Item(1), pValueList.Item(3))

Dim uc As New Infragistics.Win.UltraWinChart.UltraChart()
uc.ChartType = ChartType.LineChart
uc.DataSource = dt
uc.DataBind()

ucce.RenderingControl = uc
pRow.Cells("Orders").EditorComponent = ucce

End Sub

This leads to memory problems (SystemOutOfMemoryExceptions).
What's the best way to get the desired result without the memory leaks?

Thank you very much.
Regards, Marco

Parents
  • 469350
    Verified Answer
    Offline posted

    Hi,

    Well... it's no surprise that this leads to memory issues. You are creating a new chart for every cell in the column and more than that, because you will end up creating and recreating a chart for the same cell every time a value in any row changes.

    What you should do is store the DataTable in the grid cell as the cell's Value. then you can use a single UltraControlContainer editor and a single chart control for the entire column. This is what the UltraControlContainerEditor sample included with NetAdvantage does.

Reply Children