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

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...