Chart styling / order of data question


Hi all,

I wanted to ask some chart styling and data questions. My chart currently looks like this:

I would like to add a border around the chart with rounded edges, I have tried using the following code to no avail:

    _chart.layer.cornerRadius = 10.0;

    _chart.layer.borderWidth = 0.7;

    _chart.layer.borderColor = [UIColorwhiteColor].CGColor;

 I would also like to add labels to the bars to indicate their values, but have no idea how to do so.
 My final question is regarding the data in the chart. Despite having a data structure in the correct order, the data appears scrambled in terms of order (it should read M T W TH F S SU). My data structure is:

    _sales[0] = @{@“M” : @1.6, @“T” : @5.6, @“W” : @10.6, @“TH” : @12.6, @“F” : @15.6, @“S” : @3.6, @“Su” : @4.6};

and is used in the following way:

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

    SChartDataPoint *datapoint = [[SChartDataPointalloc] init];

    NSString* key = _sales[seriesIndex].allKeys[dataIndex];

    datapoint.xValue = key;

    datapoint.yValue = _sales[seriesIndex][key];

    return datapoint;


Any advice or input would be appreciate, thanks in advance!


Greetings Program!

Have a look at the “Labelled Datapoints” sample app; it provides an excellent example for labeling the datapoints.

I added the following to the above sample app to get the rounded border you are looking for:

chart.layer.cornerRadius = 10;
chart.borderColor = [UIColor whiteColor];
chart.borderThickness = [NSNumber numberWithDouble:0.7] ;
chart.canvasAreaBackgroundColor = [UIColor blackColor];
chart.plotAreaBackgroundColor = [UIColor blackColor];
chart.canvasInset = UIEdgeInsetsMake(10, 10, 10, 10);
chart.backgroundColor = [UIColor blackColor];

The NSDictionary isn’t ordered and allKeys won’t return it in the order it’s added/initialized. Since your x-axis is limited to the days of the week, use this instead:

NSArray *daysOfWeek = @[@"M", @"T", @"W", @"TH", @"F", @"S", @"Su"];
NSString *key = [daysOfWeek objectAtIndex:dataIndex];

datapoint.xValue = key;
datapoint.yValue = _sales[seriesIndex][key];



Thank you wizgod, that was very helpful!

Only change I had to make was to use:

_chart.borderColor instead of _chart.layer.borderColor  smiley cool


Excellent; glad you got it sorted.