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

How do I get the correct labels on the horizontal axis?

I want to create a column chart from 10 years of data. The data falls into years 1990 to 1999. I don''t want the horizontal axis to be labelled with 0,1,2..9. I want the actual years 1990, 1991, 1992...1999. What do I need to set for this to happen?

3 Replies

DJ Davis Jebaraj Syncfusion Team November 4, 2004 12:14 PM UTC

Hi, To get the DateTime labels on the X axis, set the Indexed property of the ChartControl to be false and set the ValueType of the Axis to be DateTime. this.chartControl1.Indexed = false; this.chartControl1.PrimaryXAxis.ValueType = ChartValueType.DateTime; this.chartControl1.PrimaryXAxis.DateTimeRange = new ChartDateTimeRange(startTime, endTime, 1, ChartDateTimeIntervalType.Hours); this.chartControl1.PrimaryXAxis.DateTimeFormat = "hh:mm:ss"; Thanks, Davis


AD Administrator Syncfusion Team November 4, 2004 01:35 PM UTC

Hi Davis, I kinda understand what you are saying, however, my X axis is not displaying anything to do with Dates and/or Times. I have YEARS. I don''t believe that formatting "hh:mm:ss" is going to do it. In other words, how do I get the X axis labels to show my own "strings" instead of the 0,1,2,... TIA >Hi, > >To get the DateTime labels on the X axis, set the Indexed property of the ChartControl to be false and set the ValueType of the Axis to be DateTime. > >this.chartControl1.Indexed = false; > >this.chartControl1.PrimaryXAxis.ValueType = ChartValueType.DateTime; > >this.chartControl1.PrimaryXAxis.DateTimeRange = new ChartDateTimeRange(startTime, endTime, 1, ChartDateTimeIntervalType.Hours); > >this.chartControl1.PrimaryXAxis.DateTimeFormat = "hh:mm:ss"; > >Thanks, > >Davis >


DJ Davis Jebaraj Syncfusion Team November 4, 2004 04:29 PM UTC

Hi, Sorry about. I was thinking you had actual DateTime data to be plotted. You can use the ChartFormatAxisLabel event of the ChartControl to customize the labels. Please refer to the sample linked to below: ChartYearAxis_8538.zip In the sample, all labels below 1990 and above 1999 are set to be empty by handling the ChartFormatAxisLabel event. Thanks, Davis

Loader.
Up arrow icon