IDalton Posted May 17, 2007 Report Share Posted May 17, 2007 ok I see in the documentation on how to setup a multi-pane graph, but my confusion is how do I load the data into the different panes? I know how to load the data into a graph for a single series (see below), but that doesn't work for multiple series. chart.Gallery = ChartFX.WinForms.Gallery.Lineschart.DataSourceSettings.Fields.Add(New FieldMap("StartDate", FieldUsage.XValue)) chart.DataSourceSettings.Fields.Add( New FieldMap("Result", FieldUsage.Value)) chart.DataSource = dt Any help will be appreciated. Ian Link to comment Share on other sites More sharing options...
Frank Posted May 17, 2007 Report Share Posted May 17, 2007 You can add multiple series by adding multiple fields that contain a value. For example:chart.DataSourceSettings.Fields.Add(New FieldMap("StartDate", FieldUsage.XValue)) chart.DataSourceSettings.Fields.Add(New FieldMap("Result", FieldUsage.Value))chart.DataSourceSettings.Fields.Add(New FieldMap("Result2", FieldUsage.Value)) chart.DataSourceSettings.Fields.Add(New FieldMap("Result3", FieldUsage.Value)) Each of the results will be separate series. Link to comment Share on other sites More sharing options...
IDalton Posted May 17, 2007 Author Report Share Posted May 17, 2007 But what if my data is as such: StartDate - Result - Category and what I'm looking to do is have a different series for each category and the xvalue would be StartDate and Value would be result? That is how my data is coming back. Any help would be appreciated. Link to comment Share on other sites More sharing options...
Guest admin Posted May 17, 2007 Report Share Posted May 17, 2007 You need to use the CrossTab provider. Check the programmer's guide under "Passing Data -> Crosstab Provider" for more information. Link to comment Share on other sites More sharing options...
IDalton Posted May 21, 2007 Author Report Share Posted May 21, 2007 I am trying to create a new CrosstabProvider, but it doesn't seem likes it's there even though my help files has documenttation on it. I tried the following and can't find it:Dim t As ChartFX.WinForms.DataProviders. (here is the list I have to choose from - DataReaderProvider, DataTableProvider, DataViewProvider & TextProvider) What am I doing wrong? Link to comment Share on other sites More sharing options...
Frank Posted May 21, 2007 Report Share Posted May 21, 2007 If you look in the resource center, there is a sample application that uses the CrossTab DataProvider. This is the code from it: string mySelectQuery = "SELECT Product,Year,Sales from ProductSales"; string dataPath = Path.Combine(Application.StartupPath, "Samples.mdb");string myConnectionString = string.Format("Provider=Microsoft.Jet.OLEDB.4.0; Data Source={0};", dataPath); System.Data.OleDb.OleDbConnection myConnection = new System.Data.OleDb.OleDbConnection(myConnectionString);System.Data.DataSet ds = new System.Data.DataSet(); System.Data.OleDb.OleDbDataAdapter adapter = new System.Data.OleDb.OleDbDataAdapter(mySelectQuery, myConnection);adapter.Fill(ds, "ProductSales"); // Create and configure the Crosstab data providerDataTableProvider dt = new DataTableProvider(ds.Tables[0]);CrosstabDataProvider cfxCT = new CrosstabDataProvider(); cfxCT.DataSource = dt; // Instruct Chart FX how to use the fields in the Crosstab. Refer to the Resource Center documentation// for further details.chart1.DataSourceSettings.Fields.Add(new FieldMap("Product", FieldUsage.ColumnHeading)); chart1.DataSourceSettings.Fields.Add(new FieldMap("Year", FieldUsage.RowHeading));chart1.DataSourceSettings.Fields.Add(new FieldMap("Sales", FieldUsage.Value)); chart1.DataSource = cfxCT;You need to add a reference to ChartFX.WinForms.Data.dll to your project in order to get access to the CrossTab data provider. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.