1

I am not able to make the xAxis in my Shinobichart look good. The right axis label is cut in half (see picture). xAxis.setRangePaddingHigh does not work. I assume this has to do with me using a custom date range. Please help!

        DateRange dateRange = new DateRange(oldDate, today);
        xAxis.setDefaultRange(dateRange);
        xAxis.setTickMarkClippingModeHigh(TickMark.ClippingMode.TICKS_AND_LABELS_PERSIST);
        xAxis.getStyle().getTickStyle().setMinorTicksShown(true);
        xAxis.getStyle().getTickStyle().setMajorTicksShown(true);
        xAxis.getStyle().getTickStyle().setLabelsShown(true);
        DateFrequency test = new DateFrequency(30, DateFrequency.Denomination.MINUTES);
        xAxis.setRangePaddingHigh(test);
        shinobiChart.setXAxis(xAxis);

enter image description here

Fubbe99
  • 35
  • 5

1 Answers1

2

As you suspect, when a default range is set on an Axis any range padding is ignored. The API docs don't really mention this so we'll look to update them in the future!

Have you tried the other ClippingModes? The one you are using here will display the tick labels even if it means they will be partially cut off.

The TICKS_PERSIST mode would still show the tick mark line at the far right of the axis but as the label would be cut off it won't be shown. The NEITHER_PERSIST mode on the other hand won't show either the label or the tick mark line.

Depending on when you set the mode you may need to call shinobiChart.redrawChart() though here it looks like you won't have to as you're doing it before you add the axis to the chart.

Finally, if you want more control over how the tick marks are draw you can use the ShinobiChart.OnTickMarkUpdateListener and/or the ShinobiChart.OnTickMarkDrawListener (along with ChartUtils to get some of the default behaviour).

Full disclosure - I work for shinobicontrols

  • Thanks! Changing the clippingmodes gave me more options, and perhaps I will try the Listeners you refered to. I was however hoping for a smoother solution. The user can choose between data from the last 6, 12 or 24 hours, or three days. I make a custom range from present and X hours back in time. In the different charts, the position of the tick labels varies. In the 6 hour span, only one label is shown. (Things are better when the phone is rotated). It would be nice to see the labels position themselves automatically in the same way I feel they do if I don't have the default range set. – Fubbe99 Oct 08 '15 at 05:28