tourajv Posted December 18, 2007 Report Share Posted December 18, 2007 First of all its a great tool. congrats but the documentation is very poor. Can someone from Chart FX please assist us with the following questions/issues Question 1 i have a datatable with 4 columns. i populate it using the function outlined below i want to map 2 series - one for Alex and one for John for the Variable 'V' having dates as the xaxis i cant get this to happen at all. i have tried using the crosstabprovider but it doesnt present the data in the datagrid as expected i would like the headings of each cell in the datagrid to be the dates and not numbers 1,2,3,4,5 etc even if the xvalues are dates the headings in the datagrid are just numbers i use the dataprovider as below Dim dt As DataTable = returnDataTable() Dim dtp As DataTableProvider = New DataTableProvider(dt)Dim ct As CrosstabDataProvider = New CrosstabDataProvider ct.DataSource = dt Chart1.Data.Series = 2 Chart1.Data.Points = 4 Chart1.DataSourceSettings.Fields.Add(New FieldMap("Name", FieldUsage.ColumnHeading)) Chart1.DataSourceSettings.Fields.Add( New FieldMap("DateOfEvent", FieldUsage.RowHeading))Chart1.DataSourceSettings.Fields.Add(New FieldMap("DateOfEvent", FieldUsage.XValue))Chart1.DataSourceSettings.Fields.Add(New FieldMap("Value2", FieldUsage.Value)) Chart1.DataSource = ct dt.DefaultView.Sort = " DateOfEvent,Name " DataGridView1.DataSource = dt Question 2 as shown in my attached project, if you run the sample the last date is cut off on the xaxis. how can this be fixed. you only get to see 16/11/ Question 3 The datagrid is very important and great. how can we however change the labels ie i dont want to see just the Name in the first row heading of the datagrid In the case of mapping several variables i may want a combination such as 'Alex - Finance Figures' the documentation doesnt clearly explain what rowheadings, column headings etc are and how they can be used i would sincerely appreciate any help Software FX technicians can give us Function returnDataTable() As DataTableDim dt As New DataTable dt.Columns.Add( "Name", GetType(String))dt.Columns.Add("Variable", GetType(String)) dt.Columns.Add( "Value2", GetType(Double))dt.Columns.Add("DateOfEvent", GetType(Date)) Dim dr As DataRow dr = dt.NewRow dr( "Name") = "John" dr( "Variable") = "V"dr("Value2") = 20dr("DateOfEvent") = New Date(2007, 12, 13) dt.Rows.Add(dr) dr = dt.NewRow dr( "Name") = "John" dr( "Variable") = "V"dr("Value2") = 25dr("DateOfEvent") = New Date(2007, 12, 14) dt.Rows.Add(dr) dr = dt.NewRow dr( "Name") = "John" dr( "Variable") = "V"dr("Value2") = 22dr("DateOfEvent") = New Date(2007, 12, 15) dt.Rows.Add(dr) dr = dt.NewRow dr( "Name") = "John" dr( "Variable") = "V"dr("Value2") = 13dr("DateOfEvent") = New Date(2007, 12, 16) dt.Rows.Add(dr) dr = dt.NewRow dr( "Name") = "Alex" dr( "Variable") = "V"dr("Value2") = 15dr("DateOfEvent") = New Date(2007, 12, 13) dt.Rows.Add(dr) dr = dt.NewRow dr( "Name") = "Alex" dr( "Variable") = "V"dr("Value2") = 17dr("DateOfEvent") = New Date(2007, 12, 14) dt.Rows.Add(dr) dr = dt.NewRow dr( "Name") = "Alex" dr( "Variable") = "V"dr("Value2") = 19dr("DateOfEvent") = New Date(2007, 12, 15) dt.Rows.Add(dr) dr = dt.NewRow dr( "Name") = "Alex" dr( "Variable") = "V"dr("Value2") = 15dr("DateOfEvent") = New Date(2007, 12, 16) dt.Rows.Add(dr) Return dt End Function Quote Link to comment Share on other sites More sharing options...
Frank Posted December 19, 2007 Report Share Posted December 19, 2007 1) You are adding the Date column twice:Chart1.DataSourceSettings.Fields.Add(New FieldMap("DateOfEvent", FieldUsage.RowHeading)) Chart1.DataSourceSettings.Fields.Add(New FieldMap("DateOfEvent", FieldUsage.XValue)) Instead, you muist add it only once, as a row heading:Chart1.DataSourceSettings.Fields.Add(New FieldMap("DateOfEvent", FieldUsage.RowHeading)) The DataGrid headers can not show the dates because they may not be the same for both John and Alex, even though in your data they are, but in general they may be different. So there is a separate set of X-Values for Jhon and Alex. You can set: Chart1.Data.X.Shared = True To instruct Chart FX that the X-Values are shared for all series. Do this only if you are certain that your data is always going to be this way, otherwise you will end up with the wrong data in your chart. 2) Add the following: Chart1.PlotAreaMargin.Right = 50 3) The crosstab provider supports only one value field. If you need to plot more than one, you will need to by-pass the crosstab provider altogether and dynamically create your own DataTable in the flat format expected by Chart FX where each column represents a data series. Something like: Date Frank-Finance-Figures Frank-OtherFigures John-FinanceFigures John-OtherFigures 1/1/2007 100 150 175 180 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.