Clint Posted January 15, 2008 Report Share Posted January 15, 2008 I am using the TextProvider Dataprovider to bind the Chart to a csv text file. The file contains a header line of field names. <?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /> as follows: Index,TimeStamp,SIDKWATTS_VAL0,SIDVOLTS_VAL0,G01IACFEEDBACK_VAL0,G01IALKWATTS_VAL0,G01IEEXHL1_VAL0 1,18/06/07 00:00:00,820,420.888346239237,0,274,540 2,18/06/07 00:00:01,820,420.888346239237,0,274,540 3,18/06/07 00:00:02,820,420.888346239237,0,274,540 I need to be able to display only a couple of the fields on the chart at any one time. The problem I am having is that one of the fields seems to display even though I have set Dim txtad As New DataProviders.TextProvider(My.Application.Info.DirectoryPath & "\tmpGraphData.csv") 'Me.txtDestinationFolder.Text & "\" & strFile)txtad.Separators = ","txtad.DateFormat = "dd/MM/yy HH:mm:ss"strFields = GetLocationTags(mLngLocationID) 'load possible fields into string array strfields With FChart.Chart1.DataSourceSettings.Fields.Clear().DataSourceSettings.Fields.Add(New FieldMap("TimeStamp", FieldUsage.XValue)) Dim fm As FieldMapFor i = 0 To UBound(strFields)fm = New FieldMap(strFields(i).ToString, FieldUsage.Value) fm.DisplayName = strFields(i).ToString .DataSourceSettings.Fields.Add(fm) Next i .DataSourceSettings.DataSource = txtad Dim strVisibleFields() As String = GetLocationGraphFields(mLngLocationID, mLngGraphID) 'load display fields into string arrayFor i = 1 To .Series.Count - 1 .Series(i).Visible = FalseFor j = 0 To UBound(strVisibleFields) If .Series(i).Text = strVisibleFields(j) Then.Series(i).Visible = True End If Next NextEnd With Even though I set the series visible property to false one of them still displays. It also seems to be displaying the data from the wrong fields of the text file. I appreciate that my explanation is probably unclear but i hope that from the code sample you can explain what I am doing wrong. I an sure there must be better way to reference the fields in the text file to explicitly ensure that the series names in the chart match the column names in the text file. Any assitance you can offer will be greatly appreciated. Thanks Clint 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.