Jump to content
Software FX Community

How do I bind chart with a database?


athaurgs

Recommended Posts

I have downloaded your beta version. I am trying to bind a database with the chart. I am not able to do that. This is how my code look like

 DataSet dataset = new DataSet();

//Database Connectionstring ConnectionString = string.Format("Provider=Microsoft.Jet.OLEDB.4.0; Data Source={0}", "Northwind.mdb");

OleDbConnection Connection = new OleDbConnection(ConnectionString);OleDbCommand Command = new OleDbCommand("Select Top 10 * from [Products]", Connection);

OleDbDataAdapter DataAdapter = new OleDbDataAdapter(Command);

//Fill the datasetDataAdapter.Fill(dataset, "Product");

//Creating resource with the name MyDBSourcethis.Resources.Add("MyDBSource", dataset.Tables["Product"].Rows);

InitializeComponent();

 XAML

<

my:SeriesAttributes Fill="Crimson" Gallery="Line" GalleryAttributes="{x:Null}" BindingPathX="ProductID" ItemsSource="{StaticResource MyDBSource}" BindingPathFrom="UnitPrice">

 When I try to run this application. it gives exception stating 'name' parameter not found. let me know what have to be changed in the code to make my chart work.

Link to comment
Share on other sites

  • 2 weeks later...

The SeriesAttributes class has 3 properties related to data binding

BindingPath (required): Name of the CLR property or database field that contains the value to be plotted

BindingPathX (optional): Name of the CLR property or database field that contains the X value to be plotted. This X value can be numeric or datetime.

BindingPathFrom (optional): Name of the CLR property or database field that contains the "From" value to be plotted. This is supported by certain galleries (e.g. bar, gantt and area) where each point plotted has a "From" and a "To".

Apologies for the lack of docs.

JuanC

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...