Change the x or y axis value


#1

Hello Everyone,I am so much happy with this lib and supporting team’s support. But from few days I am not getting any response on topics.I am showing data for days of month like 1,2,3,------31. And I want to show this data also in this order not in 0,1,2,3,----30. So How can i fix this error? Please help me as soon as.Thanks a lot


#2

Hi satvikios,It sounds like you’re using a number axis rather than the SChartDateTimeAxis. The values on the axis will take the form of whatever you pass in through “dataPointAtIndex:”. When you provide the datapoint, you should provide the xValue as an NSDate type (assuming you want the dates on the x-axis). That way, your days of the month will show up as proper dates.Alternatively, if you just want the numbers, make sure your datapoint.xValue = @(dataIndex+1).


#3

Hello Everyone,

Thanks for supprot. Now I need urgent help for  supportin team.

I am getting error in display of data like this 

2014-01-28 19:42:03.414 Saudi_Traffic_Department[3721:60b] ydict:-{

    0 = 8;

    1 = 9;

    10 = 18;

    11 = 19;

    12 = 20;

    13 = 21;

    14 = 22;

    2 = 10;

    3 = 11;

    4 = 12;

    5 = 13;

    6 = 14;

    7 = 15;

    8 = 16;

    9 = 17;

}

2014-01-28 19:42:03.416 Saudi_Traffic_Department[3721:60b] xdict:-{

    0 = 238;

    1 = 209;

    10 = 250;

    11 = 215;

    12 = 280;

    13 = 206;

    14 = 228;

    2 = 244;

    3 = 254;

    4 = 211;

    5 = 242;

    6 = 237;

    7 = 208;

    8 = 289;

    9 = 247;

}

There are two dictionary with same keys. When i show this data on bar chatr then after 15 it not showing annotation for 16 and onwords. Those value displaed on 8,9 as on woard.

So How can i fix this bug?

I have use this piece of code:-

  • (id<SChartData>)sChart:(ShinobiChart *)chart dataPointAtIndex:(NSInteger)dataIndex forSeriesAtIndex:(NSInteger)seriesIndex {

    SChartDataPoint *datapoint = [[SChartDataPointalloc] init];

    NSString* key = [NSString stringWithFormat:@"%d",dataIndex];

    datapoint.xValue = x_dict[key];

    datapoint.yValue = y_dict[key];

    SChartAnnotation *a = [SChartAnnotationannotationWithText:[NSStringstringWithFormat:@"%@",x_dict[key]]

                                                       andFont:[UIFont boldSystemFontOfSize:15]

                                                     withXAxis:chart.xAxis

                                                      andYAxis:chart.yAxis

                                                   atXPosition:@([datapoint.xValue floatValue] / 2)

                                                  andYPosition:datapoint.yValue

                                                 withTextColor:[UIColor whiteColor]

                                           withBackgroundColor:[UIColor clearColor]];

    

    [chart addAnnotation:a];

    CGRect f      = a.label.frame;

    f.origin.x=0.0;

    f.origin.y =0.0;

    a.label.frame = f;

    return datapoint;

}