Author |
Topic  |
|
Plutiko
8 Posts |
Posted - 11 Sep 2003 : 15:23:20
|
Hello I want to plot a XY line chart. On the x-as I would like have some date. The I don't know how I can translate an array of the type Date to an array of the type ChartCalendar. Does somebody has an example how you cast it? I hope somebody can help,
thank you
Plutiko |
|
quinncurtis
1164 Posts |
Posted - 11 Sep 2003 : 15:45:48
|
Do you mean the DateTime class, rather than a Date class. I could find no reference to a Date class in .Net.
The QCChart2D ChartCalendar class has a constructor that accepts a DateTime class.
If you want language specific example you will need to specify whether you are using C# or VB.
|
 |
|
Plutiko
8 Posts |
Posted - 11 Sep 2003 : 16:07:15
|
I'm using VB.net I tried it also with an array of the type DateTime, but I couldn't let ik work. If you have an example I would appreciate it. |
 |
|
Plutiko
8 Posts |
Posted - 11 Sep 2003 : 16:24:32
|
Maybe easier when I adjust the code that doesn't work.
Public Sub PasteData(ByVal skew As ArrayList, ByVal ATM As ArrayList) skewArray = skew ATMArray = ATM End Sub
Private Sub InitializeChart() Dim chartVu As ChartView = Me Dim skew As New ArrayList() Dim ATM(ATMArray.Count) As Double Dim arrayExp(ATMArray.Count) As ChartCalendar Dim DT As DateTime Dim x As skewprm Dim i As Integer
For Each x In skew DT = CType((x.getExpDate), DateTime) arrayExp(i) = DT i = i + 1 Next
Dim Dataset1 As New TimeSimpleDataset("First", arrayExp, ATM)
The line arrayExp(i) = DT doesn't work any clue? |
 |
|
quinncurtis
1164 Posts |
Posted - 11 Sep 2003 : 16:41:56
|
Here is a modified version of the date initialization section in the InitializeChart method of the EditChartExample example program. It creates a DateTime array with dates separated by 3 months, and copies that to a ChartCalendar array.
Dim x1(nnumpnts - 1) As ChartCalendar Dim y1(nnumpnts - 1) As Double Dim y2(nnumpnts - 1) As Double Dim startdatetime As DateTime = New DateTime(2003, 1, 1) Dim datetimearray(nnumpnts - 1) As DateTime For i = 0 To nnumpnts - 1 datetimearray(i) = startdatetime.AddMonths(i * 3) Next y1(0) = 100 y2(0) = 30 For i = 0 To nnumpnts - 1 x1(i) = New ChartCalendar(datetimearray(i)) If (i > 0) Then y1(i) += y1((i-1))+(5+i)*(0.75- ChartSupport.GetRandomDouble()) y2(i) += y2((i-1))+(15+i)*(0.95- ChartSupport.GetRandomDouble()) End If Next
|
 |
|
Plutiko
8 Posts |
Posted - 11 Sep 2003 : 16:57:51
|
Thank you, that works perfectly |
 |
|
quinncurtis
1164 Posts |
Posted - 11 Sep 2003 : 16:58:31
|
You can't assign disimilar types
arrayExp(i) = DT where arrayExp(i) is of type ChartCalendar and DT is of type DateTime.
I think this code should work, assuming that DT is a valid date for all i. I think you have a dangerous, unitialzied i variable in your code.
i = 0 For Each x In skew DT = CType((x.getExpDate), DateTime) arrayExp(i) = new ChartCalendar(DT) i = i + 1 Next
|
 |
|
|
Topic  |
|