Skip to main content Skip to footer

OLAP for Silverlight 2011 v1 Preview

The first release of ComponentOne OLAP for Silverlight is right around the corner! You can download the latest Beta bits and get a full look at everything the official release will include. This blog post details some of the new(er) features added since the original Beta launch.

Multiple Value Fields

In previous versions, each view could contain only one value field. Starting with this version, you can now add as many value fields to the view as you want. To enable multiple value fields, set the OlapEngine.ValueFields.MaxItems to the maximum number of fields allowed. A value of -1 allows unlimited fields per view. A sub-collection of columns is added to the C1OlapGrid when there is more than one value field.

C1OlapField Style Property

This new property allows you to assign style properties to a specific field, customizing the way the field values appear in a C1OlapGrid. For example, customizing the appearance of a field can be useful in views that contain multiple value fields.

// build an initial view  
var olap = _olapPage.OlapEngine;  
olap.BeginUpdate();  
...  
// create a static style for the "Price" field  
var fs = olap.Fields["Price"].Style;  
fs.BackColor = Color.FromArgb(0xff, 240, 255, 240);  
...

Styles can also be added and configured at runtime. A C1OlapField Style consists of a Background, Foreground and Bold setting. Just right-click or double-click the field in the OlapPanel to bring up the Field Settings window.

Conditional Formatting Properties

Each field has a couple new properties that allow you to apply conditional formatting, making certain values stand out. Conditional formats compare actual field values with specified thresholds, which may be specified as absolute values or as percentages. And each field has two conditional format styles: StyleHigh and StyleLow, allowing two different styles to be set per field.

Absolute Threshold

To specify absolute thresholds, set the Style's ConditionType property to Absolute and the Value property to the absolute value.

Percentage Threshold

To specify percentage thresholds, set the Style's ConditionType property to Percentage and the Value property to a value between 0 and 1.

// create style for "Weight" values in top 10%  
var fsh = olap.Fields["Weight"].StyleHigh;  
fsh.ConditionType = C1.Olap.ConditionType.Percentage;  
fsh.Value = 0.9;  
fsh.BackColor = Color.FromArgb(0xff, 0, 125, 0);  
fsh.ForeColor = Colors.White;  
// create style for "Weight" values in bottom 10%  
var fsl = olap.Fields["Weight"].StyleLow;  
fsl.ConditionType = C1.Olap.ConditionType.Percentage;  
fsl.Value = 0.1;  
fsl.BackColor = Color.FromArgb(0xff, 125, 0, 0);  
fsl.ForeColor = Colors.White;

Reporting

The addition of reporting makes the first release more in-sync with the WinForms version (All minus the print-preview and export to PDF). The C1OlapPage has a new Report menu item allowing users to print or open the Document Options window. Directly print the C1OlapGrid and/or C1OlapChart in a single report. Users can customize scaling, page pargins, headers and footers, and insert time stamps, page counts and a title for the report. Of course, the printing can be done in code too:

PrintManager pm = new PrintManager();  
pm.Print(C1OlapPage, ReportOptions);

Chart Totals

The new Boolean ChartTotals property allows you to create charts that only show the totals, as opposed to creating one separate series for each column in the OlapTable. Setting ChartTotals to true can be useful in situations where the views contain too many series to visualize in a single chart.

// show just totals in chart  
c1OlapPage.OlapChart.ChartTotals = true;

ChartTotals = True: ChartTotals = False:

Defer Updates Option

You'll notice a new addition to the bottom of the C1OlapPanel control. The Defer Updates checkbox has the same functionality as the one in MIcrosoft Excel's pivot tables. It suspends the automatic updates that occur while the user modifies the view definition. This allows users to make extensive changes for efficiently. For example, check the box and drag fields between the Row Fields and Column Fields lists. Normally, C1OlapPanel re-calculates the new data for each field view change. If you're dealing with a very large data set each change may take time to load. By deferring updates, users can reconfigure the view to the final step before allowing C1OlapPanel to begin its work. If you are using relatively smaller data sets, then there is no noticeable benefit. Download the Beta

ComponentOne Product Manager Greg Lutz

Greg Lutz

comments powered by Disqus