The requested page is not available for the requested platform. You are viewing the content for Default platform.

How to: Bind a WPF Dashboard to an OLAP Cube using DashboardOlapDataSource

  • 3 min to read

The following example demonstrates how to bind a dashboard to an OLAP cube using DashboardOlapDataSource.

DashboardOlapDataSource allows you to establish a connection to the OLAP cube by specifying a connection string.


The complete sample project How to bind WPF dashboard to an OLAP cube using DashboardOlapDataSource is available in the DevExpress Examples repository.

using DevExpress.DashboardCommon;
using DevExpress.DataAccess.ConnectionParameters;
using System.Windows;

namespace WpfDashboard_OlapDataProvider
    /// <summary>
    /// Interaction logic for MainWindow.xaml
    /// </summary>
    public partial class MainWindow : Window
        public MainWindow()

        private void Window_Loaded(object sender, RoutedEventArgs e)
            dashboardControl1.Dashboard = CreateDashboard(); ;            

        private Dashboard CreateDashboard()
            Dashboard dBoard = new Dashboard();

            OlapConnectionParameters olapParams = new OlapConnectionParameters();
            olapParams.ConnectionString = @"provider=MSOLAP;
                                  data source=;
                                  initial catalog=Adventure Works DW Standard Edition;
                                  cube name=Adventure Works;";

            DashboardOlapDataSource olapDataSource = new DashboardOlapDataSource(olapParams);

            CardDashboardItem cardItem = new CardDashboardItem();
            cardItem.DataSource = olapDataSource;
            cardItem.SeriesDimensions.Add(new Dimension("[Sales Territory].[Sales Territory Country].[Sales Territory Country]"));
            cardItem.SparklineArgument = new Dimension("[Date].[Month of Year].[Month of Year]", DateTimeGroupInterval.MonthYear);
            Card card = new Card();
            card.LayoutTemplate = new CardStretchedLayoutTemplate();
            card.ActualValue = new Measure("[Measures].[Internet Sales Amount]");
            card.TargetValue = new Measure("[Measures].[Sales Amount]");

            ChartDashboardItem chartItem = new ChartDashboardItem();
            chartItem.DataSource = olapDataSource;
            chartItem.Arguments.Add(new Dimension("[Sales Territory].[Sales Territory].[Country]"));
            chartItem.Panes.Add(new ChartPane());
            SimpleSeries salesAmountSeries = new SimpleSeries(SimpleSeriesType.Bar);
            salesAmountSeries.Value = new Measure("[Measures].[Sales Amount]");
            SimpleSeries salesInernetAmountSeries = new SimpleSeries(SimpleSeriesType.Bar);
            salesInernetAmountSeries.Value = new Measure("[Measures].[Internet Sales Amount]");
            dBoard.Items.AddRange(cardItem, chartItem);

            DashboardLayoutItem cardLayoutItem = new DashboardLayoutItem(cardItem);
            DashboardLayoutItem chartLayoutItem = new DashboardLayoutItem(chartItem);
            DashboardLayoutGroup rootGroup = new DashboardLayoutGroup(DashboardLayoutGroupOrientation.Vertical, 
                50D, cardLayoutItem, chartLayoutItem);
            dBoard.LayoutRoot = rootGroup;

            return dBoard;