A simple OLAP application

To create the simplest OLAP for Silverlight application, start by creating a new Silverlight application (3 or 4) and dragging a C1OlapPage control onto the page. Allow the C1OlapPage control to fill the entire page by removing all margin and alignment settings.

 

 

Now, let us set a data source for the application.

For this sample, we load Northwind product data from an XML data schema file. We use ComponentOne Data for Silverlight, which provides us the familiar DataSet and DataTable objects to read the data in. We also use ComponentOne Zip for Silverlight to unpackage the zipped XML file on the client.

// load data from embedded zip resource

var ds = new DataSet();

var asm = Assembly.GetExecutingAssembly();

using (var s = asm.GetManifestResourceStream("OlapQuickStart.nwind.zip"))

{

     var zip = new C1ZipFile(s);

     using (var zr = zip.Entries[0].OpenReader())

     {

           // load data

           ds.ReadXml(zr);

     }

}

Then we simply set the DataSource property on the C1OlapPage control. We could use any data binding method with this control.

// bind olap page to data

_c1OlapPage.DataSource = ds.Tables[0].DefaultView;

The application is now ready. The following sections describe the functionality provided by default, without writing any code aside from configuring our data source.


Send us comments about this topic.
Copyright © GrapeCity, inc. All rights reserved.