wpf-6858-controls-and-libraries-charts-suite-chart-control-examples-providing-data-how-to-bind-a-chart-to-data-from-an-mdb-file.md
The following example demonstrates how to bind a DXCharts control to an MDB database.
To accomplish this, it is necessary to add a corresponding DataSet to a project, and set the Series.ArgumentScaleType, Series.ArgumentDataMember, Series.ValueScaleType and Series.ValueDataMember properties to the required values.
Then, in a code-behind the Window.Initialize method, you can obtain all data from a DataSet, using the data adapter’s GetData method, and assign this data to a series’ Series.DataSource property.
<Window x:Class="WpfApplication1.Window1" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:dxc="http://schemas.devexpress.com/winfx/2008/xaml/charts" Title="Window1" Height="300" Width="396">
<Grid>
<dxc:ChartControl Name="chartControl1">
<dxc:ChartControl.Diagram>
<dxc:XYDiagram2D>
<dxc:XYDiagram2D.Series>
<dxc:BarSideBySideSeries2D Name="carSeries" ArgumentDataMember="Model" ValueDataMember="Price" />
</dxc:XYDiagram2D.Series>
</dxc:XYDiagram2D>
</dxc:ChartControl.Diagram>
</dxc:ChartControl>
</Grid>
</Window>
using System.Windows;
namespace WpfApplication1 {
public partial class Window1 : Window {
public Window1() {
InitializeComponent();
carSeries.DataSource =
new CarsDBDataSetTableAdapters.CarsTableAdapter().GetData();
}
}
}
Imports Microsoft.VisualBasic
Imports System.Windows
Namespace WpfApplication1
Partial Public Class Window1
Inherits Window
Public Sub New()
InitializeComponent()
carSeries.DataSource = _
New CarsDBDataSetTableAdapters.CarsTableAdapter().GetData()
End Sub
End Class
End Namespace