We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Chart Control and Dates give strange results

If I take a chart control and drop it on the form then add the following to form load: ChartSeries s= chartControl1.Model.NewSeries("Licenses",ChartSeriesType.Area); s.Points.Add(Convert.ToDateTime("4/4/2004 12:00:00"),81); s.Points.Add(Convert.ToDateTime("4/11/2004 12:00:00"),84); s.Points.Add(Convert.ToDateTime("4/18/2004 12:00:00"),82); s.Points.Add(Convert.ToDateTime("4/25/2004 12:00:00"),87); s.Points.Add(Convert.ToDateTime("5/2/2004 12:00:00"),94); s.Points.Add(Convert.ToDateTime("5/9/2004 12:00:00"),104); s.Points.Add(Convert.ToDateTime("5/16/2004 12:00:00"),112); s.Points.Add(Convert.ToDateTime("5/23/2004 12:00:00"),112); s.Points.Add(Convert.ToDateTime("6/1/2004 12:00:00"),116); s.Points.Add(Convert.ToDateTime("6/6/2004 12:00:00"),116); s.Points.Add(Convert.ToDateTime("6/13/2004 12:00:00"),127); chartControl1.Series.Add(s); chartControl1.Legend.Visible=false; chartControl1.PrimaryXAxis.ValueType=ChartValueType.DateTime; I would expect it to give me the dates along the bottom, no? I''m using 2.0.5.1.

4 Replies

SG Sean Greer June 15, 2004 02:20 PM UTC

Thanks for asking this Eric, as I''m having the dilemna with 2.0.6.0. I do this: ChartSeries cs = this.m_ChartControl.Model.NewSeries(string.Format("{0} Product Projection", nYear), ChartSeriesType.Bar); cs.Points.Add(new DateTime(nYear, 1, 1), Convert.ToDouble(drv["productproj"])); cs.Text = cs.Name; cs.Type = ChartSeriesType.Column; I''ve got these settings for the x axis: PrimaryXAxis.ValueType = ChartValueType.DateTime; PrimaryXAxis.IntervalType = ChartDateTimeIntervalType.Years; PrimaryXAxis.DateTimeFormat = "yyyy"; And I get 1899 for each column. What''s up with that?


DJ Davis Jebaraj Syncfusion Team June 15, 2004 05:52 PM UTC

Hi, Please add this line to set the Indexed mode to false and the values will be interpreted properly: this.chartControl1.Indexed = false; It would also help to rotate the labels along the X axis to prevent them from overlapping: this.chartControl1.PrimaryXAxis.LabelRotate = true; this.chartControl1.PrimaryXAxis.LabelRotateAngle = 90; Thank you for your patience. Regards, Davis


ED Eric Duesing June 16, 2004 12:32 PM UTC

Doh! You are correct. >Hi, > >Please add this line to set the Indexed mode to false and the values will be interpreted properly: > > this.chartControl1.Indexed = false; > >It would also help to rotate the labels along the X axis to prevent them from overlapping: > >this.chartControl1.PrimaryXAxis.LabelRotate = true; > >this.chartControl1.PrimaryXAxis.LabelRotateAngle = 90; > >Thank you for your patience. > >Regards, > >Davis > > >


AD Administrator Syncfusion Team December 14, 2005 03:14 PM UTC

>Doh! You are correct. > >>Hi, >> >>Please add this line to set the Indexed mode to false and the values will be interpreted properly: >> >> this.chartControl1.Indexed = false; >> >>It would also help to rotate the labels along the X axis to prevent them from overlapping: >> >>this.chartControl1.PrimaryXAxis.LabelRotate = true; >> >>this.chartControl1.PrimaryXAxis.LabelRotateAngle = 90; >> >>Thank you for your patience. >> >>Regards, >> >>Davis >> >> >>

Loader.
Up arrow icon