kort Posted August 31, 2007 Report Share Posted August 31, 2007 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 Quote Link to comment Share on other sites More sharing options...
Frank Posted September 6, 2007 Report Share Posted September 6, 2007 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 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.