Single value in X axis


Hello my name is Miquel,

I am using shinobi for Android, and I need to put a single value in X axis like this:

I’ve done this painting only the last ticmark of the serie. To do this I override the getFormattedString of the Axis class.

It works well in that case, but if I had less points, the result isn’t so satisfying:

The label is shown displaced to the left. How can I do this to get the label of the tick at the right of the chart like in the first image?



Hi Maikals.

I think the issue here is to do with the x axis range being displayed by the chart. The issue is that with auto calculated tick marks, you cannot guarantee that the final tick mark will always be drawn at the very end of the axis. Factors which affect this are the axis range itself, along with the frequency of the major tick marks. Often, the major tick frequency will vary depending upon the data, due to the fact that by default it is auto-calculated. If the (in your case x) value of your final data point is not an exact multiple of your major tick frequency (in your case, this is the x axis’ major tick frequency) then it is highly likely that you will see results like in your second image.

There are two methods which may help you:

1 - Set your major tick frequency explicitly:

2 - Request that the chart displays a specific range (which would have your final x value as it’s upper boundary):,%20T)

As a side note, we do offer alternative ways of customising how tick marks are drawn. You can set a listener, to allow you to take action before tick marks are drawn:

You may find this method particularly useful to address any clipping issues which you may encounter, once you successfully have your tick mark drawn at the end of your axis. Remember, if the tick mark label string is long, it may be clipped off the edge of the chart. As such you might like to have the label drawn slightly to the left.

Also you can give an Axis your own set of custom tick marks:<T>)

I hope that you find this helpful.