Knowledgebase
Easy marking of the grid cells depending on the measure values or hierarchy members
Posted by Vladimir Lyutetsky on 31 August 2012 01:09 PM

In TOLAPGrid you can make the cell parameters dependable on measure vales or hierarchy members. The Grid now has two new panels: "Background Color" and "Foreground Color". They contain all the setting elements for modification.

Defining background color by a measure value

To define the color, drag a measure value to the Background Color panel.

Dragging a measure value to the Background Color panel

Dragging a measure value to the Background Color panel

You'll see the selected measure value and a set of gradient colors in the Background Color panel.

Selecting gradient for cells' background

Selecting gradient for cells' background

Select a gradient from the drop-down list - it will define cells' background in your OLAP-slice. The left hand color will be used for the slice cells with minimal values, the right hand color - for the cells with maximal values. The cells in between will be colored appropriately.

To assign the gradient programmatically, use the Grid.VM_GridAxisLayout.SelectedBackColor property:

var lgb = new LinearGradientBrush();
lgb.GradientStops.Add(new GradientStop { Color = Colors.Yellow, Offset = 1.0 });
lgb.GradientStops.Add(new GradientStop { Color = Colors.LawnGreen, Offset = 0.5 });
lgb.GradientStops.Add(new GradientStop { Color = Colors.Red, Offset = 0.0 });

Grid.VM_GridAxisLayout.SelectedBackColor = new VM_ColorGradient(lgb);

When you assign a new gradient, it will be added to the drop-down list and you'll be able to use it. To edit a gradient, press Value Dependency Gradient Editor Button. Make the necessary changes in the Gradient Editor and press Ок:

Gradient Editor

Gradient Editor

Defining background color by a hierarchy member

When you place a hierarchy to the Background Color panel, it's first-level members will be colored differently. The panel will display all the first-level members of the hierarchy with the color markings.

Defining the color by a hierarchy member

Defining the color by a hierarchy member

To change a marking, click it and select another color:

Color Editor

Color Editor

To assign the color programmatically, use the Grid.VM_GridAxisLayout.MembersWithColoredBackground property:

VM_ColoredMember member = Grid.VM_GridAxisLayout.MembersWithColoredBackground
                .FirstOrDefault(x => x.DisplayName == "Food");                       
member.Color = new SolidColorBrush(Colors.Purple);

The set of colors for hierarchy members is defined by the palette. To select a palette, click a hierarchy in the modification area: either Background or Foreground Color Panel. The context menu will appear, select "Palette" and choose the one you want:

Palette selecting

Palette selecting

By default, the Background is set to ColoredLight, Foreground - to Colored.

Modifying the text color

If you do the same things on the Forecolor panel, you'll be able to change the color of the text in cell.

(0 vote(s))
This article was helpful
This article was not helpful

Help Desk Software by Kayako Resolve