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 : Nov 16th 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Problem with Custom Labels on line chart

Thread ID:

Created:

Updated:

Platform:

Replies:

88084 Jul 14,2009 06:16 PM UTC Jul 24,2009 07:04 AM UTC WPF 5
loading
Tags: Chart
Hemanth Javali
Asked On July 14, 2009 06:16 PM UTC

Hi,
I am using chartWPF for displaying line chart. I am using Custom mode for x-axis (primary axis) labels. I add the series in code behind (ChartArea.Series.Add)in an event handler which is fired as a result of user input.

Here is a code snippet to add series.

private void AddSeries()
{
float[] spectrum = Presenter.GetSpectraAt (sp.Row,sp.Column);//returns a float array
if (spectrum == null)
return;
Syncfusion.Windows.Chart.ChartSeries spectrumSeries = new Syncfusion.Windows.Chart.ChartSeries(Syncfusion.Windows.Chart.ChartTypes.Line);
spectrumSeries.DataSource = spectrum;
chartArea.Series.Add(spectrumSeries);
}

Following is the code snippet to add custom labels for X-Axis
private void ShowXAxisLabels()
{
//Wavelengths is an array of floats that I want to use for x- axis labels
if (Wavelengths != null)
{
//xAxis is of type ChartAxis
xAxis.CustomLabels.Clear();
xAxis.LabelsMode = Syncfusion.Windows.Chart.ChartAxisLabelsMode.Custom;
for (int i = 0; i < Wavelengths.Length; i++)
{
Syncfusion.Windows.Chart.ChartAxisLabel label = new Syncfusion.Windows.Chart.ChartAxisLabel(i, Wavelengths[i]);
xAxis.CustomLabels.Add(label);
}

}
}

Please note that the lengths of arrays for series (spectrum) and labels (Wavelengths) is the same.

I am experiencing following problems with the chart.

1.Everytime I add a series, the labels reset to the indices. I have add the custom labels after adding every series. Is there any way I can add the labels only once.

2.No matter waht I set for Interval, the x-axis shows tick lines for every label. This clutters the chart. Is there any way I can control the tick interval when Custom labels are used.


Saradha [Syncfusion]
Replied On July 15, 2009 06:04 AM UTC

Hi Hemanth,

Thanks for your interest in Syncfusion products.

1. I'm unable to reproduce the requirement for resetting the custom labels often. Could you please send a simple sample or modify the sample provided in the below given link, to reproduce the issue.

2. Since we set 100 number of custom labels that Axis.Interval property is not taken into account. However, this could be overcome by making the for loop jump with the Axis.Interval value. Please refer to the code below.

for (int i = 0; i < Wavelengths.Length; i= i + (int)XAxis.Interval)
{
Syncfusion.Windows.Chart.ChartAxisLabel label = new Syncfusion.Windows.Chart.ChartAxisLabel(i, Wavelengths[i]);
XAxis.CustomLabels.Add(label);
}

Sample Link:
http://files.syncfusion.com/support/Chart.WPF/7.3.0.6/F88086/main.htm

Please let us know if you have further queries.

Regards,
K. Saradha Devi

Hemanth Javali
Replied On July 15, 2009 01:54 PM UTC

Hi Saradha Devi,
Thanks for your reply.

1.Correction regarding this issue: The labels actually disappear (do not reset to indices as I mentioned in my first post). This issue issue can be observed in the sample you attached. Here is how you can reproduce:
a.Launch the program "CustomAxisRange.exe"
b.Click button Add series.
c.Click button Add Labels.
d.Click button Add Series. Observe that the x axis labels disappear.

Thanks,
-Hemath


Saradha [Syncfusion]
Replied On July 16, 2009 04:33 AM UTC

Hi Hemanth,

Thanks for using Syncfusion products.

With the same reproduce steps, I'm unable to reproduce the issue. Please refer to the video file that is taken while executing the sample.
http://files.syncfusion.com/support/Chart.WPF/7.3.0.6/F88086/video.zip

Could you please let us know what is the version number you are using.

Thank you,
K. Saradha Devi

Hemanth Javali
Replied On July 16, 2009 03:15 PM UTC

Aahaa! This is fixed in 7.3.0.20 which was released 2 days ago. I was using 7.2.0.20 in which the problem existed. It was perhaps fixed in 7.2.0.37, but I never installed it.
Anyways thanks for your help. I really appreciate it.

-Hemanth

Saradha [Syncfusion]
Replied On July 24, 2009 07:04 AM UTC

Hi Hemanth,

It's nice to hear that you got to know that the issue is fixed in our latest source.

Thank you for informing us.

Regards,
K. Saradha Devi

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

;