416.467.9100 | Dundas Data Visualization | Login
Welcome Guest
This is the support page for the legacy Dundas Dashboard application. For assistance with the current Dundas BI application please click here.
Dashboard v5.0

This site makes extensive use of JavaScript.

Please enable JavaScript in your web browser and reload the page before proceeding.

Color Analytical Grid Cells

Hide navigation
RSS
Modified on Tue, 16 Apr 2013 02:58 PM Categorized as OLAP, Script Library, Scripting
Click to return to: Documentation | Dundas Dashboard Script Library


Overview

This article shows how to color the cells or rows of an analytical grid using scripting.

Setup

  1. Create a virtual cube and define a report.
  2. Check in your virtual cube.
  3. Create a new analytical dashboard.
  4. Drag an Analytical Grid control from the toolbox to the canvas.
  5. Drag the virtual cube report from the toolbox and drop it over the analytical grid control.
  6. Save and preview the dashboard.

Script - AnalyticalGrid.RowLoaded

Add the following script for the AnalyticalGrid1.RowLoaded interaction:

// AnalyticalGrid1.RowLoaded(sender, e) // sender is type DashboardOlapGrid // e is AnalyticalOlapCellEventArgs DashboardOlapGrid olapGrid = (DashboardOlapGrid)sender;

// Color the Totals row if (e.HeaderInfo != null && e.HeaderInfo.IsTotal) { DashboardDataGridRow totalsRow = e.VisualElementArgs; totalsRow.Background = new DashboardSolidColorBrush(Colors.Cyan); }

// Color cells foreach (object cell in e.VisualElementArgs.Cells) { AnalyticalOlapCellEventArgs cellArgs = olapGrid.GetCellOlapData(cell); if (cellArgs.TargetCell == null) { // This is part of the header cell.Background = new DashboardSolidColorBrush(Colors.Orange); } else { // This is a data cell - check if its value is below 10 million if (cellArgs.TargetCell.Value < 10000000) { cell.Background = new DashboardSolidColorBrush(Colors.Yellow); } } }


To test the example, view the dashboard.

Coloring cells and rows in an analytical grid.

Coloring cells and rows in an analytical grid.


See also:


Related topics


Click to return to: Documentation | Dundas Dashboard Script Library

About Dundas | Contact Us Follow us on Twitter! | Privacy Statement | Report Site Issues

Copyright © 2009-2014 Dundas Data Visualization, Inc.