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. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

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

Thread ID:

Created:

Updated:

Platform:

Replies:

21169 Nov 3,2004 05:34 PM UTC Nov 4,2004 04:29 PM UTC WinForms 3
loading
Tags: Chart
Administrator [Syncfusion]
Asked On November 3, 2004 05:34 PM UTC

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?

Davis Jebaraj [Syncfusion]
Replied On 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

Administrator [Syncfusion]
Replied On 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 >

Davis Jebaraj [Syncfusion]
Replied On 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

CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

;