SciChart® the market leader in Fast WPF Charts, WPF 3D Charts, and iOS Chart & Android Chart Components


Hi All,

I have a fix for this for now.

The problem was that public override string FormatLabel(IComparable dataValue) for my label provider was being called with interim values I wasn’t expecting as I have an integer XAxis i.e. it was being called for 0, 0.5, 1, 1.5, 2, 2.5 etc etc. which I was then converting this to an int and returning a string equivalent from the label array. thus causing the recurring labels.

My solution for was to check the dataValue for being an integer before returning the string, if it was one of these mid-points I just returned an empty string.

Not sure if this is the SciChart way of doing things (I’m probably setting the axis up incorrectly or something) – but it’s giving me the result I want 🙂

  • Andrew
    See my comment below, you're spot on - interim values :)
  • You must to post comments


Please excuse the abrupt nature of this post as I don’t want to go into a load of detail for it post an empty one again. I’ll post more info if it’s necessary and there isn’t an obvious answer.

Basically the problem is that my BoxPlot xAxis isn’t displaying how I think it should when using a LabelFormater i.e. there are multiple labels of the same name for a single data entry. Admittedly I’m resetting the axis strings each time the data set changes but I’d still only expect 1 label.

Please see attached image.


  • Andrew
    My guess is, you are casting double to ints to get the index to the string array, but when a double value 2.5 is passed from axis, you return the label at index 2. Do you want to put some debug.writeline logging in your LabelProvider to see the actual data value in + string label out? You can return null or string.empty as a label to ignore it if you want. Another thing you can do is set MajorDelta = 1 and AutoTicks = false on your axis. This will ensure that data-values are always spaced by 1.
  • Stuart McCullough
    It's nice to work one out on my own for once :-) The axis setting advice is duly noted though - it never hurts to learn something new :-)
  • Andrew
    It has its drawbacks. If you set AutoTicks = false then specify MajorDelta = 1, and MinorDelta = 0.25 say, then when you zoom in and out, the MajorDelta will always be 1 and labels will start to get crowded. If this is what you want e.g. you're not planning to zoom, then that is fine. However, if you want finer grained control over the exact output of the Axis, take a look at the Axis.TickProvider feature, which allows you to completely override the algorithm to generate tick coordinates (used by labels and gridlines)
  • You must to post comments
Showing 2 results
Your Answer

Please first to submit.