Jump to content
Software FX Community

How to Bind a Chart using Business Object ?


kort

Recommended Posts

Hi all,

I'm trying to bind a Chart using the DataSource property

I'm doing smth. like that

--------------------------------------------------------------------------------------

ArrayList  list = new ArrayList();

list.Add(new History(date,instrument_name,price));  !!! in a loop and I add 3 instruments with different price and date in the same ArrayList

ChartFX.WinForms.DataProviders.ListProvider plist = new ListProvider(list);

this.chart1.DataSourceSettings.DataSource = plist; !!! here I'm hoping to have the 3 instruments in the Legend and their History in Chart

----------------------------------------------------------------------------------------

my class History has 3 properties: Date(DateTime), InstrumentName(string), Price(double).

if I bind the Chart with an ArrayList which contains 1 instrument -> Great... it work

But if I use an ArrayList with 2 Instruments for instance, I get a single serie chart !!

Is there a way to fix that ?

Thanks in advance

kort

 

Link to comment
Share on other sites

It sounds like what you want is to use the field Instrument name as a grouping filed. You want to end up with one series for each unique value of InstrumentName.

If this is the case, the CrossTab data provider is what you need. Instead of passing the ListProvider directly to Chart FX, you need to create a CrossTab data provider, give it the list and then set the crosstabprovider as the datasource for the chart.

In the crosstab provider you will configure your InstrumentName column as the Column heading and the Date column as the RowHeading.

For more information about the CrossTab provider please refer to the Programmer

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...