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. Image for the cookie policy date
close icon

Charts mislabel horizontal axis

Keerthi
Created on Jul 31, 2015 08:53 AM

Hi,

 I am new to Syncfusion. We are using Syncfusion 10.104.0.44. 

Please find the Screen1, Screen2 and Screen3 files from attachment.


Issue: Around 200 labels are displaying on X-Axis horizontally on chart. When popup the chart, the label alignment is Center only which is correctly as in Screen1. 
But when scrolling the chart from left to right sometimes the x-axis labels are correct sometimes they are incorrect. 
please watch the Screen1, Screen2 and Screen3 for tall bar 17041 . 
Sometimes it is reported as "6" it is correct label. 
Some time it is reported as "5" it is incorrect label. 
This correct/incorrect toggles for every click of the scroll left/right bar.

I want to show the all labels with center alignment as in Screen1 even while scrolling.


Info: ChartControl.LayoutCompleted event is getting triggered for every scroll click. made the PrimaryXAsis label alignment as Center in the handler even after getting same issue. 


Can any one please help me for this issue. 


Regards,
Keerthi


Attachments_d0e3497e.zip

Attachment: Attachments_4f931dc5.zip

3 Replies

VA Vinothkumar Arumugam Syncfusion Team August 3, 2015 03:07 PM UTC

Hi Keerthi,
Thanks for using Syncfuison control.
We have analyzed your query and found that you have assigned string for X-axis labels. So while scrolling the chart, X-Axis label are changed. For example,

In the below screen shot

we have changed the axis label 8 as “eight" on rendering the chart.


Code Snippet

CS:

if (e.Value == 8)

   e.Label = "eight";
e.Handled = true;

After zooming the chart, the range for the chart are changing based on the zoomfactor.

Screenshot


CS
chart.ZoomFactorX = 0.9;

Now see the labels of X-Axis, we don’t have 8 as visible label, so the string "eight" is not visible. But the column is drawn for 8th point only.

Likewise in your scenario, we guess that, you are changing the X-axis labels to string  based on index of visiblelabels, on changing the zoomfactor using scrollbar the visible labels are changing and string value for the labels is assigned based on new visible label index, hence you are finding the difference in xaxis label.

Please let us know, if you have any clarification.

Regards,

Sanjith K.?



KE Keerthi replied to Vinothkumar Arumugam August 4, 2015 12:02 PM UTC

Hi Keerthi,
Thanks for using Syncfuison control.
We have analyzed your query and found that you have assigned string for X-axis labels. So while scrolling the chart, X-Axis label are changed. For example,

In the below screen shot

we have changed the axis label 8 as “eight" on rendering the chart.


Code Snippet

CS:

if (e.Value == 8)

   e.Label = "eight";
e.Handled = true;

After zooming the chart, the range for the chart are changing based on the zoomfactor.

Screenshot


CS
chart.ZoomFactorX = 0.9;

Now see the labels of X-Axis, we don’t have 8 as visible label, so the string "eight" is not visible. But the column is drawn for 8th point only.

Likewise in your scenario, we guess that, you are changing the X-axis labels to string  based on index of visiblelabels, on changing the zoomfactor using scrollbar the visible labels are changing and string value for the labels is assigned based on new visible label index, hence you are finding the difference in xaxis label.

Please let us know, if you have any clarification.

Regards,

Sanjith K.​


Hi Sanjith, 

Your guess is absolutely right. We are changing the X-axis labels to string  based on index of visiblelabels.

We are setting the value for
  chart.ZoomFactorX based on number labels count (ex: for suppose total no.of labels is 200).
Ex:

LABEL_THRESHOLD_NUMBER = 15;
NoOfLabelCount = 200; 

chart.ZoomFactorX = (LABEL_THRESHOLD_NUMBER/ NoOfLabelCount) // which is 0.075 

Here setting the value for ZoomFactorX  at the time of preparing chart and after they are not changing it till end. 
We should not modify the ZoomFactorX manually because of chart also will get change based on it.

So, how can we achieve, to show all the XAxis labels on with center alignment even while scrolling…? 

Regards,
Keerthi.



SK Sanjith Kesavan Syncfusion Team August 4, 2015 12:54 PM UTC

Hi Keerthi,
Please ignore our previous update.

By default, points in series are plotted against X and y values. When there is necessary to ignore the x-values and simply use the positional value of the point in a series, “Indexed” property is used.
Please find the following code snippet
Code Snippet
[C#]
chart.Indexed = true;

Screen shot:



We have prepared the sample as per your requirement. Please find the sample from the below location
https://www.syncfusion.com/downloads/support/directtrac/142228/ze/Lables-1710463669


Please let us know if you have any concerns

Regards,
Sanjith K


Loader.
Live Chat Icon For mobile
Up arrow icon