Warning: Axis width does not provide enough space to fit the tickmarks and ticklabels


#1

Is there any way to stop this warning from the ShinobiChart? I mean I’m aware of the meaning of the warning. I just would like to avoid it to spam my log window

Thanks


#2

Hi,

Thanks for getting in touch. There currently isn’t a way to disable this warning log from the chart. We are aware of this issue and will be looking at making our logs configurable in future.

Regards,
Chris


#3

I am also in need of this.

In my case, I do not want the xaxis ticks or labels to be visible so I set the width to @0.1. Is there a better way to do this?


#4

Hi tybro0103

You can hide an axis by setting the “showLabels” and “showTicks” properties on your axes “style.majorTickStyle” object. The following code hides a charts X-Axis:

yourChart.xAxis.style.majorTickStyle.showLabels = NO;
yourChart.xAxis.style.majorTickStyle.showTicks = NO;

Kind Regards,
Andrew Polkinghorn


#5

|
1

2
|

yourChart.xAxis.style.majorTickStyle.showLabels = NO;

yourChart.xAxis.style.majorTickStyle.showTicks = NO;

|

This method can’t hide the gap where between the chart and bounds at the left.


#6

Hi Song,

Have you got an image of the gap you are talking about? As this would help me locate the origin of the axis gap you described.

Kind Regards,
Andrew Polkinghorn


#7

Hi MrApolk,

I found the reason and the gap can be removed like this

xAxis.style.majorTickStyle.showTicks = NO;
    xAxis.style.majorTickStyle.showLabels = NO;
    xAxis.style.minorTickStyle.showTicks = NO;
    xAxis.style.minorTickStyle.showLabels = NO;
    
    yAxis.style.majorTickStyle.showTicks = NO;
    yAxis.style.majorTickStyle.showLabels = NO;
    yAxis.style.minorTickStyle.showTicks = NO;
    yAxis.style.minorTickStyle.showLabels = NO;

#8

I’m getting this logging message when I override -sChart:longestLabelStringOnAxis: e.g. if I return a string like @"####"; when I comment this method out then the logs go away however I end up with the tick mark labels ending with a “…”.

I’m using versions 2.9.4-2 of the premium chart kit.

Thanks Ants


#9

Hi Ants,

Are you setting the width of your axis somewhere in your code? If so then you’ll have to increase the width so the labels will fit (or use a smaller font). Otherwise, the width should be calculated automatically based on the longest label string provided, and you shouldn’t see the warning.

Regards,

Alison


#10

Hi Alison,

Actually yes I am setting the width. currently setting it to @(0.1) because I want the y axis labels to be over the top of the graph not to the left of it. Perhaps there is a better way to do this? I also have multiple charts aligned vertically and I want the start of each chart to align.

e.g. like this: https://www.dropbox.com/s/t0tjz1iht4bqb9k/IMG_4723.PNG?dl=0


#11

Hi Ants,

Thanks for the image.

There are two ways to remove this warning:

  1. Increase your Y-axis’ negative tick gap.
    Analysing your image, it looks like you are setting a negative tick gap on your Y-axis to move the labels into the chart’s canvas. The reason the warning is being displayed is the chart thinks the negative tick gap you have supplied isn’t large enough to get the label’s fully on screen based on the longest string your providing “####”.

For example, if you are setting your Y-axis tick gap to -50 but the longest string length is calculated to be 60 pixels wide. To remove the error you need to have a tick gap of at least -60.

  1. Turn off warning our ShinobiChart logs like so:

    [ShinobiChartLog setLoggingEnabled:NO];

Let me know if you have any questions.

Kind regards,
Andrew Polkinghorn.


#12

OK great, increasing the -ve tickGap does fix the warning. Thanks Andrew.


#13

Looks like choosing to use “####” for my string was a bad idea as they are very wide with the font I am using. Changed to using “0000” and setting tickGap to the width of that string using that font works perfectly. Thanks again!