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

Archived

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

×
×
  • Create New...