Chart labels: min interval size + max interval count

Hi!

I'd like to set my (Stock)Chart Y axis labels to have a label for each integer, but maximum 8 labels.

If I use (image1)
<StockChartPrimaryYAxis DesiredIntervals="8" MaximumLabels="8" LabelIntersectAction="LabelIntersectAction.Hide" LabelFormat="n0" />
there are 8 labels even if the total range is smaller than 8 (in this case the same label is displayed multiple times: this is what I'd like to avoid.).

If I use (image2)
<StockChartPrimaryYAxis DesiredIntervals="8" MaximumLabels="8" Interval="1" LabelIntersectAction="LabelIntersectAction.Hide" LabelFormat="n0"  />
a label is shown for each integer, but the number of labels exceeds 8 (by much).

Is there a solution for this?
Thank you!

Attachment: Archívum_f54ecb89.zip

4 Replies 1 reply marked as answer

SM Srihari Muthukaruppan Syncfusion Team April 14, 2021 01:57 PM UTC

Hi Kristof, 
 
Sorry for the inconvenience. 
 
We would like to let you know that the DesiredIntervals property is used to calculate intervals approximately equal to your specified interval. And MaximumLabels property is to display the maximum number of label count per 100 pixels with respect to the axis length. We have also attached our API reference link for your reference. 
 
API Link: 
 
 
From the images attached we couldn’t fetch sufficient information for our analysis. We kindly request you to share more details about your exact requirement and the data source behind the sample. If you have any concerns with sharing data at least share some mock data that reproduces the scenario, that would be helpful for us to analyze further and provide you the solution sooner. 
 
Regards, 
Srihari M 



KR Kristof April 14, 2021 03:07 PM UTC

Hi! 

Created an example at: https://github.com/kristof12345/ChartsDemo
The main problem is that on the second chart Y axis labels (100 and 101) are displayed multiple times. I'd like to set these to be unique.

Thanks.


DG Durga Gopalakrishnan Syncfusion Team April 16, 2021 03:41 AM UTC

Hi Kristof, 

We are validating your reported scenario with attached sample. We will update details within two business days(19th April 2021). We appreciate your patience until then. 

Regards, 
Durga G


DG Durga Gopalakrishnan Syncfusion Team April 18, 2021 04:05 PM UTC

Hi Kristof, 

We have checked the provided sample, we feel that the attached screenshots and output of the sample do not the same which doesn’t suit the reported case.  

So, we have prepared a sample as per the attached image at the initial update. Your major problem is displaying duplicate values on Y-axis that occur due to the minimal range in Y-axis. In the attached sample we have data between 1278 and 1280. Here the total delta is only 2. While automatically calculating the interval for this delta the interval will set to 0.5. So the axis label collection will be (1278, 1278.5, 1279, 1279.5, and 1280). Since you have set LabelFormat="n0" for StockChartPrimaryYAxis, the decimal value will be removed in the axis labels and looks like (1278, 1278, 1279, 1279, and 1280) duplicate. To overcome this scenario we suggest you specify the Inteval=1. Since your data range is less chart will be displayed with 3 axis labels only as shown below. 

Screenshot: 

 


If provided solution doesn’t meet your requirement, please revert us. 

Regards, 
Durga G

Marked as answer
Loader.
Up arrow icon