Pre loader

Issues with text labels using ILableProvider


Hi Guys,

I have successfully added text labels to my charts using ILabelProvider.

However, some of the charts are showing duplicate labels for each bar, and others are not showing the labels for all bars (even though there is space to do so).

Any idea how to fix these? See the attached images for more details.

Thanks in advance.

  • You must to post comments

Hi Andresca,

Labels missing:

This occurs because of two reasons:

  1. SciChart decides on the spacing of ‘ticks’ (Gridlines, labels) depending on your VisibleRange, Size of the Chart and Axis Type. You can learn about this here.

  2. SciChart culls labels which overlap each other by default. This can be disabled by setting the AxisBase.IsLabelCullingEnabled property to false.

Regarding duplicate labels:

It is very likely that this is because of a mixture of (1) above and your own Labelprovider algorithm. For instance, if the Axis decides to create ticks at 1, 1.2, 1.4, 1.6, 1.8, 2.0 and you use a LabelProvider to convert the axis value to integer and choose a label, then you are going to get LabelA, LabelA, LabelA, LabelA, LabelB as a result.

What I would suggest is to use a combination of setting axis tick frequency.

Some useful documentation:

let me know if this helps!

Best regards,

  • andrecsa
    Thanks Andrew. It’s exactly the way I want now.
  • You must to post comments
Showing 1 result
Your Answer

Please first to submit.

Try SciChart Today

Start a trial and discover why we are the choice
of demanding developers worldwide

Start TrialCase Studies