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.
Andre.
- andrecsa asked 8 years ago
- You must login to post comments
Hi Andresca,
Labels missing:
This occurs because of two reasons:
-
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.
-
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:
- Axis Ticks – MajorDelta, MinorDelta and AutoTicks: Should be sufficient to set labels spaced at integer intervals
- Axis advanced tick frequency overriding. use only when setting AutoTicks / MajorDelta / MinorDelta is not sufficient
- LabelProvider API – Full Control over Axis Labels: which you’ve already seen but for reference I’ve included it here.
- AxisBase.IsLabelCullingEnabled property.
let me know if this helps!
Best regards,
Andrew
- Andrew Burnett-Thompson answered 8 years ago
-
Thanks Andrew. It’s exactly the way I want now.
- You must login to post comments
Please login first to submit.