This topic introduces Series Data Correlation feature of the {DataChartName}™ control and explains how to use it with code examples.
The topic is organized as follows:
-
-
Assembly Requirements
-
Data Requirements
-
-
-
Preview
-
Procedure
-
The Series Data Correlation is an integration of the {DataChartName} control with the CorrelationCalculator that allows for the calculation of the correlation between two values in a data set displayed using the ScatterSeries. Data Correlation is useful for identifying how two variables in the data set are related to each other. For example, you can use correlation to determine if there is a connection between high blood pressure readings and the age group of patients plotted in the {DataChartName} control. Refer to the Infragistics Math Calculators topic for more information about the CorrelationCalculator and the different types of data correlation.
This section provides prerequisites for working with the Series Data Correlation feature of the {DataChartName} control.
Table 1 – List of assemblies that need to be added to a {PlatformName} project.
Assembly | Description |
---|---|
{ApiPlatform}Math.Calculators{ApiVersion}.dll |
{ProductName} assembly containing mathematical calculators to compute correlation, mean, median, variance and many more mathematical values. |
{ApiPlatform}Math{ApiVersion}.dll |
{ProductName} assembly containing standard mathematical constants and all-purpose mathematical functions designed to act on a variety of mathematical objects. |
{ApiPlatform}{DataChartAssembly}{ApiVersion}.dll |
{ProductName} assembly containing the {DataChartName} control and various types of Series and Axes for plotting data. |
The CorrelationCalculator requires data object that must implement the IEnumerable interface (e.g. List, Collection, Queue, Stack) and items of this object must consist of two numeric data columns on which data correlation is calculated. Furthermore, these two data columns must be mapped to XMemberPath and YMemberPath properties of the CorrelationCalculator and the ScatterSeries objects.
An example of an object that meets the above criteria is the CorrelationDataSample, which you can download from the Correlation Data Sample resource and use it in your project.
Note
|
Note:
Once the data is bound to ItemsSource of the CorrelationCalculator the correlation is computed and stored as a numeric value in the Value property of the CorrelationCalculator. |
The following example demonstrates how to calculate correlation of data bound to the ScatterSeries in the {DataChartName} control and display the result as title of the series in a legend of the chart. It assumes that you added all required assemblies listed in the Assembly Requirement section to your project.
This procedure provides steps necessary for integrating the {DataChartName} control with CorrelationCalculator and displaying the result of calculation.
Note
|
Note:
This example uses the CorrelationDataSample object as data source but you can use your own data. Refer to the Data Requirements section of this topic for more information data requirements. |
-
Add Correlation Data Sample object as data source that will provide data for calculating correlation.
Note
|
Note:
The CorrelationCalculator is not a visual element and it must be defined in resources section on application, page, or control level the same way as you would define a data source. |
-
Create instance of the CorrelationCalculator with appropriate data bindings.
-
Bind Title property of ScatterSeries object to the Value property of the CorrelationCalculator resource. Alternatively, you can display the result of data correlation in other controls (e.g. TextBlock) through binding to a static resource.