C1 Community
ComponentOne Community is a free source for developers and help authors to collaborate and communicate.

Date axis on the graph is not correct

rated by 0 users
This post has 3 Replies | 2 Followers

Not Ranked
Posts 8
NZbeny99 Posted: Tue, Mar 10 2009 9:52 PM

I have a Chart with two series, the X axis use dateManual as annotation format. then I pass in six dates as X value.which date is the last day of each month. But the graph's X axis shows Jul Aug Oct Nov Dec. Sept is missing in between. how does that happen? how do I have "Sept" back on my graph?

Code Sample:

Dim dat() As Date = New Date() {New Date(2005, 7, 31), New Date(2005, 8, 31), New Date(2005, 9, 30), New Date(2005, 10, 31), New Date(2005, 11, 30), New Date(2005, 12, 31)}

thisChart.ChartGroups(0).ChartData.SeriesList(0).PointData.Length = 6

thisChart.ChartGroups(0).ChartData.SeriesList(1).PointData.Length = 6

For i As Integer = 0 To 5

thisChart.ChartGroups(0).ChartData.SeriesList(0).X(i) = dat(i)

thisChart.ChartGroups(0).ChartData.SeriesList(0).Y(i) = i

thisChart.ChartGroups(0).ChartData.SeriesList(1).X(i) = dat(i)

thisChart.ChartGroups(0).ChartData.SeriesList(1).Y(i) = i

Next

Thanks!

Top 10 Contributor
Posts 1,090
C1_JohnAd replied on Tue, Mar 17 2009 10:26 AM
 
Hello,
 
Try the given code snippet.
 
BEGIN CODE

Me.C1Chart1.ChartGroups(0).ChartData.SeriesList.Clear()

Dim ds As C1.Win.C1Chart.ChartDataSeries = Me.C1Chart1.ChartGroups(0).ChartData.SeriesList.AddNewSeries

Dim dat() As Date = New Date() {New Date(2005, 7, 31), New Date(2005, 8, 31), New Date(2005, 9, 30), _

                                New Date(2005, 10, 31), New Date(2005, 11, 30), New Date(2005, 12, 31)}

Me.C1Chart1.ChartGroups(0).ChartData.SeriesList(0).PointData.Length = 6

ds.X.CopyDataIn(dat)

For i As Integer = 0 To 5

ds.Y(i) = i

Next

Me.C1Chart1.ChartArea.AxisX.AnnoFormat = C1.Win.C1Chart.FormatEnum.DateManual

Me.C1Chart1.ChartArea.AxisX.AnnoFormatString = "MMMM"

Me.C1Chart1.ChartArea.AxisX.SetMinMax(CDate("06/01/2005"), CDate("12/31/2005"))

Me.C1Chart1.ChartArea.AxisX.UnitMajor = 30


END CODE
 
Hope this helps.
 
Regards,
 
John Adams
<NZbeny99> wrote in message news:215210@10.0.1.98...

I have a Chart with two series, the X axis use dateManual as annotation format. then I pass in six dates as X value.which date is the last day of each month. But the graph's X axis shows Jul Aug Oct Nov Dec. Sept is missing in between. how does that happen? how do I have "Sept" back on my graph?

Code Sample:

Dim dat() As Date = New Date() {New Date(2005, 7, 31), New Date(2005, 8, 31), New Date(2005, 9, 30), New Date(2005, 10, 31), New Date(2005, 11, 30), New Date(2005, 12, 31)}

thisChart.ChartGroups(0).ChartData.SeriesList(0).PointData.Length = 6

thisChart.ChartGroups(0).ChartData.SeriesList(1).PointData.Length = 6

For i As Integer = 0 To 5

thisChart.ChartGroups(0).ChartData.SeriesList(0).X(i) = dat(i)

thisChart.ChartGroups(0).ChartData.SeriesList(0).Y(i) = i

thisChart.ChartGroups(0).ChartData.SeriesList(1).X(i) = dat(i)

thisChart.ChartGroups(0).ChartData.SeriesList(1).Y(i) = i

Next

Thanks!



http://helpcentral.componentone.com/cs/forums/p/78477/215210.aspx#215210

Not Ranked
Posts 8

I have tried your code snippet, the Date axis on the graph is now correct. but I am creting a column chart. the column is not drawn on the right date axis. the first column should be on august because i passed in "31th of july" for x1, not in between of august and september. any idea? Thanks!

 

Not Ranked
Posts 2
Altrine replied on Mon, Jun 29 2009 2:02 PM

Hello

I have the same problem. If anybody replies you then that will be helpful for me too.

Thanks.

 

 

Page 1 of 1 (4 items) | RSS
Contact ComponentOne: 1.800.858.2739 ©1987-2010 ComponentOne LLC All Rights Reserved.