Can you mix 'n match custom majorTickValuesForAxis values and auto-calculated values?


#1

I’ve got a Shinobi Chart in which I want to use custom major tick values & labels for the X axis, but I’d really prefer to use auto-calculated values for the Y axis. However, I don’t know what to return from the delegates if I want auto-calculated behaviour. So, for example, I have:

    func sChart(_ chart: ShinobiChart, majorTickValuesFor axis: SChartAxis) -> [AnyObject] {
        if axis.isXAxis() {
            return [3, 15, 27, 39, 51, 63, 75, 87]
        }
        return [0, 0.25, 0.5, 0.75, 1.0, 1.25, 1.5, 1.75, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10, 15, 20, 25, 30, 35, 40, 45, 50, 55, 60, 65, 70]
    }
But I really don’t want to attempt to supply the Y axis values, because the default behaviour works well. But I can’t seem to get the default behaviour, unless I don’t implement the delegate at all.


#2

Hi Andromeda,

Unfortunately there actually seems to have been a bug arise as one of our last updates. We should have allowed you to return nil as part of this method, which in doing so would tell the chart to use the default tick values. I’ve gone ahead and fixed this bug and it should be included as part of the release that follows our iOS 10 release.

For now you can actually edit the SChartDatasource file within our framework and set the sChart:majorTickValuesForAxis delegate method to be nullable like so:

- (nullable NSArray *)sChart:(ShinobiChart*)chart majorTickValuesForAxis:(SChartAxis *)axis;

Apologies for any inconvenience this may cause you, and let me know if you have any further questions.

Kind regards,

Matt / iOS Developer


#3

Thanks Matt!I’ve edited the header file, and modified the Swift code to make the value optional:

    func sChart(_ chart: ShinobiChart, majorTickValuesFor axis: SChartAxis) -> [AnyObject]? {
        if axis.isXAxis() {
            return [3, 15, 27, 39, 51, 63, 75, 87]
        }
        return nil
    }

Now I get the default behaviour for the Y axis - thanks very much!


#4

You may wish to know that I’ve just updated to the latest release of Shinobi Charts Premium (as of October 17, 2016), and this issue has NOT been fixed in this version.

Fortunately, I can stil “fix” the issue by editing the header file to make the value nullable, but you may wish to correct the header file.


#5

Hi Andromeda,

I would like to apologise for the fix not being included in the latest release.

The fix has been implemented but it didn’t get merged in time due to our all our resources concentrating on the iOS 10 release.

We are about to release another version of charts (2.9.0) and I have personally made sure the fix has been included in this release.

Our next release has almost completed our testing stage and should be released fairly soon.

Let me know if you have any questions.

Kind Regards,
Andrew Polkinghorn.


#6

Hi Andromeda,

This is just a quick message to say we have just released our 2.9.0 version of ShinobiCharts that should include your fix.

It is available to download in our customer portal.

Let me know if you have any questions.

Kind regards,
Andrew Polkinghorn.