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.
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Chart X-Axis Label Values

Thread ID:

Created:

Updated:

Platform:

Replies:

110216 Jul 25,2013 01:43 AM UTC Jul 30,2013 07:45 PM UTC ASP.NET MVC (Classic) 1
loading
Tags: Chart
Tony Basallo
Asked On July 25, 2013 01:43 AM UTC

Is there a way to extract the x-axis label values from a chart for use within the view?

I currently am able to extract the data, but I would also like to extract the x-axis labels for display in the view.

Thanks


Bharathiraja K [Syncfusion]
Replied On July 30, 2013 07:45 PM UTC

Hi Tony,

 

Thanks for using Syncfusion products.

 

We have prepared a sample based on your requirement. We can get X-axis label through find the X-Axis visible Range min, max and interval and calculate the label value based on this information.

 

Please find the below code snippet to achieve this.

 

[C#]

 

           //Find Min, Max and Interval Range of primaryXAxis

            double minX = chartModel.PrimaryXAxis.VisibleRange.Min;

            double maxX = chartModel.PrimaryXAxis.VisibleRange.Max;

            double intrvl = chartModel.PrimaryXAxis.VisibleRange.Interval;

 

            //Add X-Axis label to List

            X_label.Add(minX);

            while (minX < maxX)

            {

                X_label.Add(minX+intrvl);

                minX = minX + intrvl;

                i++;

            }

 

[ASPX]

 

<ul>

<b>Display X-Axis Label in View Page</b>

@foreach (var label in (List<double>)ViewData["label"])

{

<li>

@label

</li>

}

</ul>

 

Please download the sample with screenshot from the below link.

 

Please let us know your concerns.

 

Thanks,

Bharathiraja K.



110216_e84dfa18.zip

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

;