of the new features of Infragistics’ XamPivotGrid is the XamPivotDataSlicer.
This is a convenient tool that provides the end user with an easy way to apply
additional filters to the hierarchies selected in the columns, rows and filters
areas and use them in conjunction with the measures in the measures area. The
slicers are interactive and allow the user to filter the data in the grid in a
much more straightforward and more visibly organized way. Just select the items
that you want to be included in the filter for a given context and the data in the
grid will update itself based on that filter. The slicers are separate from XamPivotGrid’s
UI and allow flexible UI arrangements. Here is an example of a slicer:
There are many reasons why you
might want to use slicers in your application. One is the sheer simplicity with
which you can manipulate data. You will be able to filter with a single click –
just select the item(s) from the predefined context of the slicer and the data
in the associated data source will automatically be filtered accordingly. Also
and all UI components that are using that data source (like the XamPivotGrid
for example) will be automatically updated. The number of clicks to do the same
action without the slicers will be much bigger.
Slicers also provide a clearer
picture of what’s being displayed on the screen. With one glance you can see
all the selected values for your filters and understand the real meaning of the
data that is shown. Not only you can see the filters themselves, but you can
also see how they affect each other. The selected items in the slicer have
different color coding to reflect these relations. If all data represented by
the item is not affected by any other filter the color is fully tinted. If some
data is missing because it was affected by another filter, the item’s color is
lighter. The following two graphs demonstrate this. The data for this example
consists of sales in a certain store. In the first picture we see that there
are no sales in the Touring product line for calendar year 2001 and 2002.
When you look at the slicers to the
right all items are fully tinted as there are no filters. However if we
deselect 2003 and 2004 from the top slicer, we effectively eliminate all
Touring sales. The line with the Touring product line is automatically removed
from the view of the XamPivotGrid control and this change is also reflected in
the slicer that represents the product lines.
The slicer item is not fully
tinted. The same would happen with CY 2001 if we deselect the Accessory,
Mountain and Road product lines. It will disappear from the grid as there are
no sales that are relevant to the selected filters in the slicers and the item
in the first slicer will not be fully tinted.
Slicers add more to your
applications than just another tool to select filters. They also make your data
more easy to comprehend and also allow you create even more beautiful and
functional reports, dashboards and analysis applications. The slicers are fully
customizable and can be easily styled to fit your existing designs.
Last but not least, slicers are
very easy to use. Here is what you need to do to add them to your app.
the IG namespace:
a slicer using this code:
be any supported data source that you might be using with your PivotGrid. Here
is a snippet that defines the data source used in the above screenshots which
connects to a analysis server with adventure works sample data.
Database="Adventure Works DW Standard Edition"
Measures="Reseller Sales Amount" />
commonly used parameters
- IsHeaderAreaExpanded – controls whether the UI
for selection of the hierarchy being filtered should be expanded or not
- SlicerItemsColorScheme – a color motif that can
be used for the slicer items
- SlicerProvider – defines which data source to
- TargetHierarchyName – which hierarchy to use by
default for filtering. Commonly used with the IsHeaderAreaExpanded = false, the
syntax is the same as the columns, rows, measures filter in the data source.
- TargetLevelIndex – the number of the level that
the hierarchy should be expanded to by default
I hope this has been interesting
to you. In the next few weeks I will be posting further XamPivotGrid improvements
and maybe some more in-depth reviews of the slicers.
Have a great day.