XY Chart NET 3 Control Reference
ProfileOHLCData Property

Use this property to get/set the open, high, low, and close-data point values for a specific Profile which has the Candle ChartFeatureType set.

Syntax
[Visual Basic]
Property ProfileOHLCData(ProfileIndex As Integer) As Object
[C#]
object XYChartNETCtl.get_ProfileOHLCData(int ProfileIndex)
void  XYChartNETCtl.set_ProfileOHLCData(int ProfileIndex, object Value)
[C++]
property System::Object ^ XYChartNet::XYChartNETCtl::ProfileOHLCData[int]
       
Parameters
ProfileIndex
The index of the profile to set/get the open, high, low, and close-data point values of.  Valid values are 0..(NumProfiles - 1).
Remarks

ProfileOHLCData is a one-dimensional array (Number of Rows - 1) of double.  The number of rows is Profile(idx).NumSamples, where idx is the profile index to set/get the y-values for.

Initially, all data values are 0.  Two common methods to populate the ProfileOHCLData array are:

  1. Set ProfileOHLCData equal to a one-dimensional array.
  2. Read data from a CSV text file into a one-dimensional array, and then set ProfileOHLCData equal to the array.
Example 1: Set ProfileOHLCData equal to an array
' XYChartNETCtl1 is the name of the XY Chart NET control instance placed on the form.

Dim arrData(4) As Double
Dim arrData2(8) As Double
Dim DataArray(4) As Double
Dim Data2Array(8) As Double
Dim dDate As DateTime = New DateTime(2008, 1, 1)
Dim dDate2 As DateTime = New DateTime(2008, 2, 1)

arrData(0) = 0
arrData(1) = -0.105
arrData(2) = -0.222
arrData(3) = -0.356
arrData(4) = -0.435

DataArray(0) = dDate.ToOADate
DataArray(1) = dDate.AddDays(2).ToOADate
DataArray(2) = dDate.AddDays(4).ToOADate
DataArray(3) = dDate.AddDays(6).ToOADate
DataArray(4) = dDate.AddDays(8).ToOADate

arrData2(0) = 10
arrData2(1) = 34
arrData2(2) = 46
arrData2(3) = 46.5
arrData2(4) = 53
arrData2(5) = 54
arrData2(6) = 59
arrData2(7) = 62.6
arrData2(8) = 89

Data2Array(0) = dDate2.ToOADate
Data2Array(1) = dDate2.AddDays(3).ToOADate
Data2Array(2) = dDate2.AddDays(6).ToOADate
Data2Array(3) = dDate2.AddDays(9).ToOADate
Data2Array(4) = dDate2.AddDays(12).ToOADate
Data2Array(5) = dDate2.AddDays(15).ToOADate
Data2Array(6) = dDate2.AddDays(18).ToOADate
Data2Array(7) = dDate2.AddDays(21).ToOADate
Data2Array(8) = dDate2.AddDays(24).ToOADate

With XYChartNETCtl1
   .NumProfiles = 2
   .Profile(0).NumSamples = 5   '5 xy data points for Profile 0
   .Profile(0).ChartFeatureType = XYChartNet.XYChartNETCtl.ChartFeatureOptions.cfCandle
   .Profile(1).NumSamples = 9   '9 xy data points for Profile 1
   .Profile(1).ChartFeatureType = XYChartNet.XYChartNETCtl.ChartFeatureOptions.cfCandle
   .ProfileXData(0) = DataArray
   .ProfileXData(1) = Data2Array
   .ProfileOHLCData(0) = arrData
   .ProfileOHLCData(1) = arrData2
   .Refresh                     'Refresh required to re-generate graph with new values
End With

'Get each profile datapoints
arrData= XYChartNETCtl1.ProfileOHLCData(0)
arrData2= XYChartNETCtl1.ProfileOHLCData(1)
                       
                       
Example 2: Read data from a CSV text file into an array, and then set ProfileOHLCData equal to the array
' XYChartNETCtl1 is the name of the XY Chart NET control instance placed on the form.

Dim FilePathAndName As String
Dim iFileNumber As Integer
Dim Row As Integer
Dim DataArray() As Double

'Filepath below assumes source file is in the same folder as the application
FilePathAndName = ".\" + CSVFileName
iFileNumber = FreeFile()
Microsoft.VisualBasic.FileOpen(iFileNumber, FilePathAndName, OpenMode.Input)

With XYChartNETCtl1
   .NumProfiles = 1
   .Profile(0).NumSamples = 5   '5 xy data points for Profile 0
   .Profile(0).ChartFeatureType = XYChartNet.XYChartNETCtl.ChartFeatureOptions.cfCandle

   ReDim DataArray(.Profile(0).NumSamples - 1)

   For Row = 0 To .Profile(0).NumSamples - 1
      Microsoft.VisualBasic.Input(iFileNumber, DataArray(Row))
   Next Row

   .ProfileOHLCData(0) = DataArray
   .Refresh                     'Refresh required to re-generate graph with new values
End With
Microsoft.VisualBasic.FileClose(iFileNumber)
   
 
See Also

 

 


© 2003 - 2013 ControlEng Corporation. All rights reserved.