Use of Objective Grid as a Pseudo-3D Color Chart
When a dataset displayed in a grid is large enough, it is difficult to analyze it using numbers in cells. As part of the GridEx functionality, Objective Grid can be set to represent a large dataset as a color picture.
Each cell in the grid displays a specific color instead of a number. The colors that appear in the grid are the result of value encoding: the whole range of values is divided into subranges, with a different color corresponding to each subrange.
An override of the function GetStyleRowCol() implements color coding, with the following code:
if (val<m_pDlg->m_nRange[0]) ind=0;
else if (val>=m_pDlg->m_nRange[0] && val<m_pDlg->m_nRange[1]) ind=1;
else if (val>=m_pDlg->m_nRange[1] && val<m_pDlg->m_nRange[2]) ind=2;
else if (val>=m_pDlg->m_nRange[2] && val<m_pDlg->m_nRange[3]) ind=3;
else if (val>=m_pDlg->m_nRange[3] && val<m_pDlg->m_nRange[4]) ind=4;
else if (val>=m_pDlg->m_nRange[4] && val<m_pDlg->m_nRange[5]) ind=5;
else if (val>=m_pDlg->m_nRange[5]) ind=6;
Use of Objective Grid as a Pseudo-3D Color Chart is demonstrated in a sample VisualDataSet in which two grids are placed on a dialog.
In this sample, the upper grid displays a dataset in 150 x 365 cells (for example, sales of 150 products during a year), and each cell represents a color value. For instance, you can see a number for each cell in a Tool Tip using class CGXToolTipCtrl.
For navigation, you can call vertical and horizontal cursors. The cursors' position is set by double-clicking on an active part of a grid or by using the DateTime and SpinEdit controls in the right part of the upper grid. To remove the cursors, just click on the grid. In the sample, data is simulated and stored in a CGXData object, and its contents are displayed with a grid. In real applications, the data source (a database, for instance) can be bound to a CGXData object.
A second grid features CGXColorButton and CGXSpinEdit controls used for encoding settings. You can specify which color will represent values in a particular subrange and can determine the value limits for each subrange. Clicking the button Apply redraws the upper grid with the new settings.