Multiple Axis Label problem


#1

Problem Setting Title for Multiple Axis

I think the title lables for Multiple axis are not attached to their respective axis, the titlelabel frames move with some constant value from their respective axis, how can I fix this ?

 I tried adjusting them using this code,

- (void)sChartRenderFinished:(ShinobiChart *)chart
{
    
    [chart.allYAxes enumerateObjectsUsingBlock:^(SChartAxis *obj, NSUInteger idx, BOOL *stop) {
         if (obj.axisPosition == SChartAxisPositionReverse) {
            obj.titleLabel.frame = CGRectMake(obj.titleLabel.frame.origin.x-30, obj.titleLabel.frame.origin.y, obj.titleLabel.frame.size.width, obj.titleLabel.frame.size.height);
        }
    }];
}

Result of this is

Correct result

But the problem with this is as soon as I tap the graph the labels move to different position as shown below

Incorrect positioin

Even orientation changes disturb the position of labels.

Can somebody let me know how to solve this ?


#2

Hi, even I am stuck with the same issue. The label appears but it’s out of  visible area. Can anybody tell me how do I reposition the axis title. 


#3

Hi Akhtarraza,

It appears you’ve discovered a bug, as this isn’t a known issue with the charts. For the moment I would suggest sticking with your renderFinished workaround, you can also perform such a workaround from the sChartIsPanning delegate method to keep the label positioned while the user pans on the chart. Similarly such a workaround will need to be performed on device rotation, as you discovered. I’ve added this issue to our internal bug tracker, and we hope to have this fixed in a future release. If you’d like to send us your email address (to info@shinobicontrols.com), I’ll let you know when we have a release out which contains a fix :slight_smile:

Best regards,

Rob


#4
rippling
Hi Akhtarraza,
It appears you've discovered a bug, as this isn't a known issue with the charts. For the moment I would suggest sticking with your renderFinished workaround, you can also perform such a workaround from the sChartIsPanning delegate method to keep the label
 positioned while the user pans on the chart. Similarly such a workaround will need to be performed on device rotation, as you discovered. I've added this issue to our internal bug tracker, and we hope to have this fixed in a future release. If you'd like to
 send us your email address (to info@shinobicontrols.com), I'll let you know when we have a release out which contains a fix :)
Best regards,
Rob

Hi Rob,

Thanks for pionting out to use sChartIsPanning delegate.

I tried using it, but still the labels positions were disturbed. Just tried other delegate methods finally this came to my rescue

- (void)sChartRenderStarted:(ShinobiChart *)chart withFullRedraw:(BOOL)fullRedraw
{
    if (!fullRedraw) {
        [chart.allYAxes enumerateObjectsUsingBlock:^(SChartAxis *obj, NSUInteger idx, BOOL *stop) {
            if (obj.axisPosition == SChartAxisPositionReverse) {
                obj.titleLabel.frame = CGRectMake(obj.titleLabel.frame.origin.x-60, obj.titleLabel.frame.origin.y, obj.titleLabel.frame.size.width, obj.titleLabel.frame.size.height);
            }
        }];
    }
}

At every interaction with the chart, this delgate was being called, hence it worked like charm.

@nikesh you could try using the above delegate method, hope it helps u :slight_smile:

regards,

Raza


#5

Hi Raza,

               It rocks. Thanks for your valuable help.  :slight_smile:

Regards,

Nik


#6

how can we achieve multiple y axis with single x axis using shinobi charts