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

Analyze Data

  • 5 min to read

In this lesson, you will learn how to add the Analysis functionality to your application. For this purpose, you will add the Analysis business class and the Pivot Chart Module to your application.

  • Add the Analysis business class to your MySolution.Module project using the Module Designer. If you are using Entity Framework as your ORM, register the Analysis type in DbContext. Edit the BusinessObjects\MySolutionDbContext.cs (MySolutionDbContext.vb) as follows and then rebuild the solution.

    public class MySolutionDbContext : DbContext {
        //..
        public DbSet<Analysis> Analysis { get; set; } 
    }
    

    Invoke it by double-clicking the Module.cs (Module.vb) file within the MySolution.Module project displayed in the Solution Explorer. In the Exported Types section, locate the Referenced Assemblies | DevExpress.Persistent.BaseImpl.v19.1 (DevExpress.Persistent.BaseImpl.EF.v19.1) | Analysis node. Select it and press the Spacebar, or right-click it and choose Use Type in Application in the invoked menu. The node will be marked in bold. This means that the Analysis business class will be added to the Application Model, and this class will take part in the UI construction process.

    Tutorial_EM_Lesson_6_1

  • Rebuild your solution so that the changes made in the Designer are loaded to the Application Model.
  • The eXpressApp Framework provides the Pivot Chart Module. When this module is referenced, the Self property of the Analysis Detail View is displayed via a special Property Editor. In WinForms applications, this Property Editor uses the PivotGridControl supplied by the Pivot Grid library and the ChartControl from the Chart Control library. In ASP.NET applications, this Property Editor uses the ASP.NET Pivot Grid that is supplied by the ASP.NET Pivot Grid library, and the WebChartControl from the Chart Control library. These controls allow end-users to build summarized reports to analyze large quantities of data quickly and easily. Features like filtering, top value display, hierarchical value arrangement on the axes, and grand and group totals give end-users a wide range of tools to control the data level in detail.

    To use the Pivot Chart Module in a WinForms application, add it to the WinForms module project. For this purpose, find the WinModule.cs (WinModule.vb) file in the MySolution.Module.Win project displayed in the Solution Explorer. Double-click this file. The Module Designer will be invoked. In the Toolbox, navigate to the DX.19.1: XAF Modules page. Drag the PivotChartWindowsFormsModule item to the Designer's Required Modules section. Build the project.

    Tutorial_EM_Lesson_6_2_1

    To use the Pivot Chart Module in the ASP.NET application, add it to the ASP.NET module project. For this purpose, double-click the WebModule.cs (WebModule.vb) file, located in the MySolution.Module.Web application project. The Module Designer will be invoked. In the Toolbox, navigate to the DX.19.1: XAF Modules tab, and drag the PivotChartAspNetModule item to the Designer's Required Modules section. Build the project.

    Tutorial_EM_Lesson_6_2_2

  • Run the WinForms or ASP.NET application. In the navigation control, select the Reports | Analysis item. An empty Analysis object list will be displayed (called Analysis List View). Create a new Analysis object by clicking the New button. In the invoked Detail View, specify a name for the new Analysis object and the type of objects to be analyzed via a pivot grid and chart control. For instance, assign the "Tasks" value to the Name property and choose "Task" in the Data Type drop-down menu. Click Bind Analysis Data (Bind Analysis Data). Task objects will be loaded as the data source for the pivot grid.

    Tutorial_EM_Lesson_6_3

  • Drag the required fields to the row, column and data areas.

    Tutorial_EM_Lesson_6_3_1

    The following configuration demonstrates how to find out how many tasks are assigned to a contact.

    Tutorial_EM_Lesson_6_4

  • Switch to the Chart tab. It displays the data configured in the pivot grid via a chart.

    Tutorial_EM_Lesson_6_5

  • In WinForms applications, you can specify the chart's settings using the ChartWizard Action invoked by right-clicking the chart image and choosing ChartWizard.

    Tutorial_EM_Lesson_6_7_1

    In ASP.NET applications, you can only set the chart type using the ChartType combo box.

    Tutorial_EM_Lesson_6_13

The following configurations demonstrate how fields in the pivot grid can be reconfigured based on what you are trying to analyze.

How many tasks of a particular priority are completed.

Tutorial_EM_Lesson_9_1

How many tasks of a particular priority are assigned to a contact.

Tutorial_EM_Lesson_6_8

How many estimated and actual hours each contact has spent on implementing all tasks assigned to that contact.

Tutorial_EM_Lesson_6_10

How many hours of work are planned for a contact and how many hours a contact has already spent on the completed tasks.

Tutorial_EM_Lesson_6_11

The previous analysis is extended by showing the distribution based on task priority.

Tutorial_EM_Lesson_6_12

Note

The images above illustrate how to build an analysis in a WinForms application, but you can follow the same steps in an ASP.NET application.

When an Analysis object is displayed in a Detail View, the Export button can be used to export the Pivot Grid or Chart to a number of formats.

Tutorial_EM_Lesson_6_14

The Export Action is available in both WinForms and ASP.NET applications.

The Print PivotGrid (btn_pivot_print) and Print Chart (btn_chart_print) actions can be used to print the Pivot Grid and the Chart. These Actions are not available in an ASP.NET application.

You can see the analysis demonstrated above in the Main Demo. The MainDemo application is installed in %PUBLIC%\Documents\DevExpress Demos 19.1\Components\eXpressApp Framework\MainDemo by default. The ASP.NET version is available online at http://demos.devexpress.com/XAF/MainDemo/.

 

Next Lesson: Create a Report in Visual Studio

See Also