Create a custom theme for Shinobichart


#1

Any example how I can apply a custom theme with a pallet of colors (SChartTheme)?

Thanks


#2

Hi ateresa,

You should just be able to subclass SChartTheme (or one of its subclasses such as SChartiOS7Theme ).

Then within this subclass, you can override properties such as the font and implement any methods that return a series style e.g. my implementation file for my SChartiOS7Theme subclass called ‘ThemeTest’

#import "ThemeTest.h"

@implementation ThemeTest

- (SChartColumnSeriesStyle *)columnSeriesStyleForSeriesAtIndex:(NSInteger)seriesIndex selected:(BOOL)selected {
    SChartColumnSeriesStyle *style = [SChartColumnSeriesStyle new];
    style.areaColor = [UIColor orangeColor];
    style.lineColor = [UIColor purpleColor];
    style.lineWidth = @2;
    
    return style;
}

@end

Finally, all you need to do, is create an instance of your theme and then apply it to the chart:

ThemeTest *testTheme = [ThemeTest new];
[self.chart applyTheme:testTheme];

I hope that helps you. Please get back in touch if you run into any further difficulties