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 to label aach item on an axis in a WPF Syncfusion Chart

Thread ID:





121503 Dec 21,2015 06:57 PM UTC Dec 22,2015 05:55 AM UTC WPF 1
Tags: Chart
David Schmidt
Asked On December 21, 2015 06:57 PM UTC

I am getting a variable number of labels on my x-axis when trying to show a chart. I want a label for each item on the x-axis. I have uploaded a zip file with a picture of the result I'm seeing. Can anyone help me?

My data source is an ObservableCollection<Agent> and I'm trying to plot Agent.FullName (x-axis) by Agent.UnitsSold (y-axis).

public class Agent : INotifyPropertyChanged
        private string m_lastName;
        private string m_firstName;
        private int m_unitsSold;

        public event PropertyChangedEventHandler PropertyChanged;

        public Agent()
            FirstName = string.Empty;
            LastName = string.Empty;
            UnitsSold = 0;

        public string LastName
            get { return m_lastName; }
            set { m_lastName = value; FirePropertyChanged("LastName"); }

        public string FirstName
            get { return m_firstName; }
            set { m_firstName = value; FirePropertyChanged("FirstName"); }

        public string FullName
        { get { return FirstName + " " + LastName; } }

        public int UnitsSold
            get { return m_unitsSold; }
            set { m_unitsSold = value; FirePropertyChanged("UnitsSold"); }

        private void FirePropertyChanged(string propertyName)
            PropertyChangedEventHandler temp = PropertyChanged;
            if (temp != null)
                temp(this, new PropertyChangedEventArgs(propertyName));

<syncfusion:Chart Name="Chart1"  Margin="0" Background="White">
                <TextBlock FontSize="20" TextWrapping="Wrap" FontWeight="Regular">Agents- Units Sold</TextBlock>
            <!--Chart area to present chart segments-->
            <syncfusion:ChartArea IsContextMenuEnabled="False" ContextMenu="{x:Null}" >
                    <syncfusion:ChartStyleModel Palette="Metro"/>
                <!--Chart area Legend declaration-->
                    <syncfusion:ChartLegend Name="Legend1"  syncfusion:Chart.Dock="{Binding ElementName=Position1, Path=SelectedItem, Mode=TwoWay}"></syncfusion:ChartLegend>
                    <syncfusion:ChartAxis Header="Agents" RangePadding="Normal"  HidePartialLabel="False"  LabelRotateAngle="90" EdgeLabelsDrawingMode="Shift"></syncfusion:ChartAxis>

                    <syncfusion:ChartAxis Header="Units Sold" EdgeLabelsDrawingMode="Shift"></syncfusion:ChartAxis>
                <!--Chart series declaration-->
                <syncfusion:ChartSeries Name="SeriesA" Type="Column" IsIndexed="True" Unit="Units"  DataSource="{Binding Agents}" BindingPathX="FullName" BindingPathsY="UnitsSold" Label="Office" StrokeThickness="0.5" >


Attachment: ChartLabel_Example_1433814a.zip

Rachel A [Syncfusion]
Replied On December 22, 2015 05:55 AM UTC

Hi David,

Thanks for contacting Syncfusion support.

You can achieve the requirement by setting the Interval as 1 in ChartAxis(PrimaryAxis) as in the following code example.



                    <syncfusion:ChartAxis Header="Agents" RangePadding="Normal"  HidePartialLabel="False"  Interval="1"

                                          LabelRotateAngle="90" EdgeLabelsDrawingMode="Shift"></syncfusion:ChartAxis>


Please refer the following UG documentation link to know about ChartAxis




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