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
close icon

Dates on X-axis

I am having trouble getting what I want when I put Dates on the X-axis. My observation is that if I set PrimaryXAxis.ValueType = ChartValueType.DateTime, then I have to set Indexed to false. And when I do this, I basically lose control over setting the range and labels displayed on the X-axis. And the range and labels chosen by the chart control are sub-optimal (to put it nicely). So in order to ensure I am in control of the range and labels on the X-axis, I have been setting PrimaryXAxis.ValueType = ChartValueType.Custom, and I have been generating a Point and Label for each point along the X-axis. Unfortunately, the control does not appear to like duplicate labels. Whenever I try to generate empty or blank labels for some of the points, I get very weird results, because the duplicate labels are ignored. So I generally have to have too many labels on the X-axis--often they overlap one another. Is there any solution to this problem other than using somebody else''s charting suite?

13 Replies

DJ Davis Jebaraj Syncfusion Team January 11, 2005 07:58 PM UTC

Hi, Thank you for using Essential Chart. Have you tried customizing the Range after the range has been calculated: this.chartControl1.PrimaryXAxis.DateTimeRange = new ChartDateTimeRange(this.chartControl1.PrimaryXAxis.DateTimeRange.Start, this.chartControl1.PrimaryXAxis.DateTimeRange.End, 1, ChartDateTimeIntervalType.Days); The above line of code uses the existing ''start'' and ''end'' dates and adjusts the interval to suit a custom need. Please let us know if this helps or you would like to do some additional customizations. Thank you for your patience. Regards, Davis


BH Bob Hogan January 12, 2005 11:44 AM UTC

Thanks, this seems to have set me on the right course. Is there any way to get the columns to be placed so that they straddle (are bisected by) their vertical gridline? Currently my columns are being drawn such that their left edge is on the labelled gridline.


DJ Davis Jebaraj Syncfusion Team January 12, 2005 07:32 PM UTC

Hi Bob, The columns fall at a particular point with respect to the grid lines based on the difference in the X axis point date versus the actual grid line date. The reason for this is because we are using the automatically calculated Start and End dates and only changing the interval. Please refer to the sample linked to below that manipulates the X axis range such that the actual points will fall exactly on the grid lines. F23389ChartColumnAlign_4097.zip Thank you for your patience. Regards, Davis


BH Bob Hogan January 13, 2005 10:57 AM UTC

I find that if I either set RelativeWidthMode, or if I set FixedWidthMode but leave the ColumnFixedWidth = 0, then the columns are placed such that their midpoints are on the grid line. If I set FixedWidthMode and set a non-zero ColumnFixedWidth, then the columns are placed such that their left edge is on the grid line. Is this intentional? Seems strange to me, and kind of inconvenient because it means I have no control over the column width. I contend that the correct placement of columns is _always_ with their midpoints on the grid lines. Clearly your tool is capable of doing this. I''d like to request that you fix this problem. Thanks.


DJ Davis Jebaraj Syncfusion Team January 13, 2005 11:37 AM UTC

Hi Bob, Thank you for bringing this issue to our attention. I already noticed this issue when working on your other forum post and have requested our development team to fix this issue. Thanks, Davis


BH Bob Hogan January 13, 2005 01:36 PM UTC

I''ve noticed another problem relating to Dates on the X-axis. When I explicitly set the X-axis Range, ChartDateTimeIntervalType.Months, and Interval = 1, depending on the data points in my series I get different and frequently erroneous month labels. For example, in one case I have: DEC 2003, JAN 2004, FEB 2004, MAR 2004, APR 2004, MAY 2004, JUL 2004,.... In another case I get: DEC 2003, DEC 2003, JAN 2004, MAR 2004, MAR 2004,.... I could go on but you get the idea. I''ll be glad to send you BMP files if you want to see them.


DJ Davis Jebaraj Syncfusion Team January 13, 2005 06:46 PM UTC

Hi Bob, Could you please check if the Charts that have the incorrect X axis labels have their Indexed property set to false. If they are set to true, the ChartControl tries to use the X axis value as the label (if a X axis value has been specified). Thanks, Davis


BH Bob Hogan January 13, 2005 07:03 PM UTC

I have _all_ of the Indexed properties set to false. Any other ideas?


DJ Davis Jebaraj Syncfusion Team January 13, 2005 08:22 PM UTC

Hi Bob, Please try this sample at your end and let me know if the months appear correctly or not: F23389ChartColumnAlign_2195.zip Thanks, Davis


AD Administrator Syncfusion Team January 14, 2005 12:28 PM UTC

Davis: I appreciate your help on this. The app you included in your last post looked fine. But I changed it to initialize nowTime as follows: nowTime = new DateTime(2004, 1, 1); and now the app exhibits my problem. It seems clear that the chart control is just adding 30 days to the current label''s date to get the next label''s date when the IntervalType is Months. --Bob


DJ Davis Jebaraj Syncfusion Team January 14, 2005 07:18 PM UTC

Hi Bob, I see the problem after making the change. We will fix this problem in the next build. Thank you for your patience. Regards, Davis


AH Angelica Hernandez September 28, 2005 10:47 PM UTC

Hello Davis. I have syncfusion version 3.2.1.516 and y got the same problem with the dates in x axis. I''m using intervals of one day but some days appear twice and others just don''t appear. I wonder if I''m doing something wrong or the fix is not ready yet. Thanks Angelica. >Hi Bob, > >I see the problem after making the change. We will fix this problem in the next build. > >Thank you for your patience. > >Regards, > >Davis


DJ Davis Jebaraj Syncfusion Team October 4, 2005 10:45 PM UTC

Hi Angleica, We regret for the delay in responding. This issue was fixed in version 3.3.0.0 Could you please install the latest version from within Direct-Trac? Thanks, Davis

Loader.
Live Chat Icon For mobile
Up arrow icon