Jump to content
Software FX Community

Confused?


arch13e

Recommended Posts

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 

   

Link to comment
Share on other sites

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?

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...