I is it possible to have a date series for an X axis in an XY chart.
Chart.addXY() is alwats looking for double parameters and wont take a date format.
X axis Date series
Hi Chuck
Yes, it's possible, in the method "Add" has more of one possibility, you can put two parameters, the first is in X axis and can be a datetime. The second is in Y axis and can be a value. You can do something similar as below code:
Yes, it's possible, in the method "Add" has more of one possibility, you can put two parameters, the first is in X axis and can be a datetime. The second is in Y axis and can be a value. You can do something similar as below code:
Code: Select all
bar1.Add(DateTime.Parse("15/3/07"), 5);
bar1.Add(DateTime.Parse("16/3/07"), 4);
bar1.Add(DateTime.Parse("17/3/07"), 5);
bar1.Add(Convert.ToDateTime("18/3/07"), 2);
bar1.Add(Convert.ToDateTime("19/3/07"), 4);
bar1.Add(Convert.ToDateTime("20/3/07"), 6);
Hi Chuck
As a followup, looking at the syntax of your code line, Chart.addXY(), it appears you may be using the ActiveX version of TeeChart. If that is the case my previous reply does not apply well to your question. Datetime is stored as double in the ActiveX version. It could be set as follows:
Please use the ActiveX forum for future posts if you are using the TeeChart ActiveX version.
As a followup, looking at the syntax of your code line, Chart.addXY(), it appears you may be using the ActiveX version of TeeChart. If that is the case my previous reply does not apply well to your question. Datetime is stored as double in the ActiveX version. It could be set as follows:
Code: Select all
With TChart1
.Series(0).XValues.DateTime = True
.Series(0).AddXY DateSerial(2007, 4, 1), 5, "", clTeeColor
.Series(0).AddXY DateSerial(2007, 4, 2), 4, "", clTeeColor
.Series(0).AddXY DateSerial(2007, 4, 3), 6, "", clTeeColor
End With