FlexPivot for WPF
OLAPでのKPIの表示
FlexPivot キューブ > OLAPでのKPIの表示

An OLAP (On-line Analytical Processing) Cube is a multi-dimensional database that performs instantaneous analysis and display of large chunks of data. The cube contains metrics of data such as KPI (Key Performance Indicator) information, which can be used to measure the progress of a business in meeting its goals. Being an excellent data processing tool, the FlexPivot control can automatically recognize the information in the OLAP Cube and display it in an appropriate format in its page.

The GIF below displays a report on the FlexPivotPage for the Internet Revenue/Sales KPI from the Adventure Works sample cube. Note how the KPI data is shown in the FlexPivotPage using the Value Fields.

For each KPI in the OLAP cube, there is a corresponding measure for its status and trend. The associated graphics of each KPI can be specified using the KpiGraphics enumeration. In the code below, a Combo Box is used to display the KpiGraphics enumeration values to alter the KPI graphics at runtime. The selected graphics can be applied to the KPI fields using the C1KpiField class of C1.FlexPivot.Internal namespace.

The code below illustrates how to add KPI Field data from OLAP Cube in the FlexPivotPage.

コードのコピー
<Grid>
        <Label Content="Select the appropriate KPI Graphics to display the same in C1FlexPivotage" FontWeight="Bold" FontSize="14" Grid.Row="0" Margin="10,0,182,5" Height="35"/>
        <StackPanel Orientation="Horizontal" Grid.Row="1" Margin="10">
            <Label Content="Select KPI Graphics"  FontSize="16" />
            <ComboBox x:Name="KpiGraphicsCombo" SelectionChanged="KpiGraphicsCombo_SelectionChanged" Margin="20,3" Width="307"/>
        </StackPanel>
        <c1:FlexPivotPage x:Name="flexPivotPage" Grid.Row="2"/>
</Grid
コードのコピー
  void Scan(IEnumerable<C1FlexPivotField> list)
        {
            foreach (var field in list)
            {
                if (field is C1KpiField)
                    (field as C1KpiField).KpiGraphics = (KpiGraphics)Enum.Parse(typeof(KpiGraphics), KpiGraphicsCombo.SelectedValue.ToString());
                if (field is C1CubeField)
                    Scan((field as C1CubeField).SubFields);
            }
        }
  private void KpiGraphicsCombo_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            Scan(flexPivotPage.FlexPivotEngine.Fields);
        }
  private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            // 接続文字列を設定します
            string connectionString = @"Data Source=http://ssrs.componentone.com/OLAP/msmdpump.dll;Provider=msolap;Initial Catalog=AdventureWorksDW2012Multidimensional";
            string cubeName = "Adventure Works";
            // キューブデータをFlexPivotPageに接続します
            flexPivotPage.FlexPivotPanel.ConnectCube(cubeName, connectionString);
            // ValueFieldsを使用してFlexPivotPageにKPIフィールドデータを表示します
            var fp = flexPivotPage.FlexPivotEngine;
            fp.BeginUpdate();
            fp.ColumnFields.Add("Date.Fiscal Year");
            fp.RowFields.Add("Category");
            fp.ValueFields.Add("Internet Revenue Trend");
            fp.ValueFields.Add("Internet Revenue Status");
            fp.EndUpdate();
            // 実行時にグラフィックを変更するには、コンボボックスにKpiGraphics列挙値を入力します
            KpiGraphicsCombo.ItemsSource = Enum.GetValues(typeof(KpiGraphics));
            KpiGraphicsCombo.SelectionChanged += KpiGraphicsCombo_SelectionChanged;
        }