arch13e Posted November 8, 2007 Report Share Posted November 8, 2007 Hi, I've got a query that pulls my data out into the following table; Date | Type | Value ------------------------------------------------ Jan IS 10 Feb SO 5 Jan IS 11 Jun SO 50 .....etc I've written the following code based on what i have read but i just can't seem to get it to work. Can anyone guide me in the right direction? Chart1.Gallery = ChartFX.WinForms.Gallery.Bar Dim mySelectQuery As String = My.Resources.SQL_StockUsage Dim myConnectionString As String = "Provider=sqloledb;Data Source=SERVERNAME;Initial Catalog=DATABASENAME;Integrated Security=SSPI;" Dim myConnection As New System.Data.OleDb.OleDbConnection(myConnectionString) Dim ds As New System.Data.DataSet() Dim adapter As New System.Data.OleDb.OleDbDataAdapter(mySelectQuery, myConnection) adapter.Fill(ds) Dim dt As New ChartFX.WinForms.DataProviders.DataTableProvider(ds.Tables(0)) Dim cfxCT As New ChartFX.WinForms.DataProviders.CrosstabDataProvider cfxCT.DataSource = dt Chart1.DataSourceSettings.Fields.Add(New ChartFX.WinForms.FieldMap("Date", ChartFX.WinForms.FieldUsage.RowHeading)) Chart1.DataSourceSettings.Fields.Add(New ChartFX.WinForms.FieldMap("Type", ChartFX.WinForms.FieldUsage.ColumnHeading)) Chart1.DataSourceSettings.Fields.Add(New ChartFX.WinForms.FieldMap("Quantity", ChartFX.WinForms.FieldUsage.Value)) Chart1.DataSource = cfxCT Chart1.Focus() Thanks Quote Link to comment Share on other sites More sharing options...
IGSFX Posted November 8, 2007 Report Share Posted November 8, 2007 I noticed that your data sample has two different values for two records with the same Date and Type, which is not allowed. You must ensure that each pair Date-Type appears no more than once. According to your Crosstab configuration you should obtain a chart with the Date in the X axis and using the different Types as series. Can you please elaborate on the problem you are getting? 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.