Providing Data

The Dashboard Designer allows you to bind various dashboard items to data in a virtually uniform manner. To learn more, see the Binding Dashboard Items to Data topic.

The only difference is in the data sections that the required dashboard item has. This topic describes how to bind a Scatter Chart dashboard item to data in the Designer or in code.

Binding to Data in the Designer

The image below shows a sample Scatter Chart dashboard item that is bound to data.

ScatterChart_ProvidingData

To bind the Scatter Chart dashboard item to data, drag and drop a data source field to a placeholder contained in one of the available data sections. A table below lists and describes Scatter Chart data sections.

Section Processed as Description
X-Axis Measure Contains the data item against which the X-coordinates of data points are calculated.
Y-Axis Measure Contains the data item against which the Y-coordinates of data points are calculated.
Weight Measure Contains the data item whose values are used to calculate the weight of data points.
Arguments Dimension Contains data items providing scatter chart arguments that are used to create data points.

Transposing X- and Y-axis

The Scatter Chart dashboard item provides the capability to transpose its axes. In this case, the data item contained in the X-Axis section is moved to the Y-Axis section, and vice versa.

ScatterChart_Transpose

To transpose the selected Scatter Chart dashboard item, use the Transpose button in the Home ribbon tab.

TransposeButton_Ribbon

Binding to Data in Code

To provide data for the Scatter Chart dashboard item in code, create the ScatterChartDashboardItem object and specify the following properties.

X-axis

ScatterChartDashboardItem.AxisXMeasure

Y-Axis

ScatterChartDashboardItem.AxisYMeasure

Weight

ScatterChartDashboardItem.Weight

Arguments

ScatterChartDashboardItem.Arguments

Example

The following example demonstrates how to bind a Scatter Chart dashboard item to data in code.

Imports System
Imports DevExpress.DashboardCommon

Namespace Dashboard_CreateScatterChart
    Partial Public Class Form1
        Inherits DevExpress.XtraEditors.XtraForm

        Public Sub New()
            InitializeComponent()
        End Sub

        Private Sub Form1_Load(ByVal sender As Object, ByVal e As EventArgs) Handles MyBase.Load
            ' Creates a new dashboard and data source for this dashboard.
            Dim dashboard As New Dashboard()

            ' Creates an OLAP dashboard data source based on the connection string 
            ' stored in the app.config file.
            Dim olapDataSource As New DashboardOlapDataSource()
            olapDataSource.ConnectionName = "AdventureWorksString"
            dashboard.DataSources.Add(olapDataSource)

            ' Creates a scatter chart and binds it to data.
            Dim scatterChart As New ScatterChartDashboardItem()
            scatterChart.DataSource = olapDataSource
            scatterChart.AxisXMeasure = New Measure("[Measures].[Sales Amount]")
            scatterChart.AxisYMeasure = New Measure("[Measures].[Gross Profit Margin]")
            scatterChart.Arguments.Add(New Dimension("[Product].[Category].[Category]"))
            scatterChart.Weight = New Measure("[Measures].[Gross Profit]")

            ' Adds the scatter chart to the dashboard and opens this
            ' dashboard in the Dashboard Viewer.
            dashboard.Items.Add(scatterChart)
            dashboardViewer1.Dashboard = dashboard
        End Sub
    End Class
End Namespace