We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy.
Unfortunately, activation email could not send to your email. Please try again.

Fast updating performance

Thread ID:

Created:

Updated:

Platform:

Replies:

35358 Sep 28,2005 10:35 AM Nov 9,2005 10:18 AM Windows Forms 4
loading
Tags: GridControl
Mitch Todd
Asked On September 28, 2005 10:35 AM

I have an unusual use case for the grid that I don''t see used very often within these forums. We are using it to measure data up to speeds of 10Hz, and performance is of utmost importance. We receive an array of float values to display (newValues[] in this case) and display them in a column, with the other columns simply containing other static data. The current implementation is shown below. for(int row = 0; row < gridControl.Model.RowCount; row++) { gridControl.Model[row + 1, 2].CellValue = newValues[row]; } gridControl.InvalidateRange(GridRangeInfo.Cols(2,2)); gridControl.Update(); Is there a different implementation that you suggest that might be more performant?

Administrator [Syncfusion]
Replied On September 28, 2005 04:29 PM

Hi Mitch, yes - definitely. Setting the CellValue and calling Invalidate/Update will not give you the speed you need. Check out the Performance/TraderGridTest example. - It uses the DrawClippedGrid method and caches the graphics context across drawing operations. - It uses GDI for faster rendering of the text - It turns off the dotted lines and instead draws solid grey lines. - Optionally you can also disable the PrepareViewStyleInfo event. With those changes in place the grid should give you the speed you need. Instead of gridControl.Model[row + 1, 2].CellValue = newValues[row]; which will itsself cause an Invalidate / Update in order to refresh the cell you should instead modify the gridControl.Data object directly by calling SetCellInfo, e.g. Graphics cachedGraphis; // make this a member of class GridStyleInfo style = new GridStyleInfo(); for(int row = 0; row < gridControl.Model.RowCount; row++) { gridControl.SetCellInfo(row + 1, 2, style, StyleModifyType.Override, true, false); } if (cachedGraphics == null) cachedGraphics = gridControl.CreateGridGraphics(); gridControl.DrawClippedGrid(cachedGraphics, gridControl.RangeInfoToRectangle(GridRangeInfo.Cols(2,2)); Stefan >I have an unusual use case for the grid that I don''t see used very often within these forums. We are using it to measure data up to speeds of 10Hz, and performance is of utmost importance. We receive an array of float values to display (newValues[] in this case) and display them in a column, with the other columns simply containing other static data. The current implementation is shown below. > >for(int row = 0; row < gridControl.Model.RowCount; row++) > { > gridControl.Model[row + 1, 2].CellValue = newValues[row]; > } > gridControl.InvalidateRange(GridRangeInfo.Cols(2,2)); > gridControl.Update(); > >Is there a different implementation that you suggest that might be more performant?

Mitch Todd
Replied On September 30, 2005 09:05 AM

Hey Stefan, Exactly what I was looking for (though I was not able to put it into action)!! We are still behind the times with our version of Syncfusion. Can you tell me in what version DrawClippedGrid is available?? Thanks, Mitch

Administrator [Syncfusion]
Replied On September 30, 2005 11:09 PM

It is in 3.2.1.0 and later.

Mitch Todd
Replied On November 9, 2005 10:18 AM

All right, so I finally implemented the new drawing solution into my quickly updating grid, and the results were not quite what I expected. We have a requirement to update a maximum of 320 values on the screen at 10 Hz with a reasonable CPU load. Updating 240 values with the following code yielded about 75% or so of the CPU. Am I still missing the performance possibilites of the Syncfusion grid?? Thanks in advance, Mitch private void OnNewValues(float[] newValues) { try { this.gridControl.PopulateValues(GridRangeInfo.Cells(1,_valueColumn,this.gridControl.RowCount,_valueColumn), newValues); gridBmp = new Bitmap(this.gridControl.Width, this.gridControl.Height); gridGraphics = Graphics.FromImage(gridBmp); if(g == null) { g = this.gridControl.CreateGridGraphics(); } this.gridControl.DrawClippedGrid(gridGraphics, this.gridControl.RangeInfoToRectangle(GridRangeInfo.Cols(_valueColumn,_valueColumn))); g.DrawImage(gridBmp, 0, 0); } catch(Exception ex) { Logger.LogException(ex); } } >It is in 3.2.1.0 and later.

CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.

;