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

Axis Lable

Thread ID:





83927 Jun 28,2009 08:46 AM UTC Jun 30,2009 01:17 PM UTC WinForms 2
Tags: Chart
Asked On June 28, 2009 08:46 AM UTC

I want Set XAxisLable Manualy,
In a for block i set my Series :
for (int i = 0; i < n ; i++)
string Title = items[i];
ChartSeries series = new ChartSeries();
series.Name = Title;
series.Points.Add(i, result[i]);
series.Type = ChartSeriesType.StackingColumn;
series.Text = series.Name;
series.PrepareStyle += new ChartPrepareStyleInfoHandler(series_PrepareStyle);

void series_PrepareStyle(object sender, ChartPrepareStyleInfoEventArgs args)
ChartSeries series = sender as ChartSeries;
args.Style.DisplayText = true;
args.Style.TextOrientation = ChartTextOrientation.Smart;
series.Style.Font.Size = 12;

and set my labels :

private void chart1_ChartFormatAxisLabel(object sender, ChartFormatAxisLabelEventArgs e)
chart1.PrimaryXAxis.TickLabelsDrawingMode = ChartAxisTickLabelDrawingMode.AutomaticMode;
int index = (int)e.Value;
if (e.AxisOrientation == ChartOrientation.Horizontal && index < chart1.Series.Count && index > 0)
e.Label = chart1.Series[index - 1].Name;

When my series is more than 5 it shows XaxisLabel for odd Series and when my series is more than 10 it shows XaxisLable for 3,6,9 and when .... but i want see all my XaxisLabel.
what can i do?

Replied On June 28, 2009 08:49 AM UTC

i try 2 use usermode and write :

chart1.PrimaryXAxis.Labels.Add(new ChartAxisLabel(items[i], Color.Maroon, new Font("Arial", 9F, System.Drawing.FontStyle.Bold)));

but all of my Xaxis has shown on Serie[0];

Manimala S [Syncfusion]
Replied On June 30, 2009 01:17 PM UTC

Hi Mahdi,

Sorry for the delay in responding.

To set custom labels for the axis ChartAxisTickLabelDrawingMode must be set as Usermode. But in the code you have given as Automaticmode. So this will not force custom labels to be displyed. I have created a sample to set custom labels for the axis. Kindly get the sample from the following link.


Kindly, let me know if you have any other queries.



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.

Please sign in to access our forum

or the page will be automatically redirected to sign-in page in 10 seconds.

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