Skip to content

Commit 3afb643

Browse files
mjm555mjm555
authored andcommitted
Increase / Decrease colors for OHLC plot style
Changed CPTTradingRangePlot:drawOHLCInContext to use increaseLineStyle and decreaseLineStyle to color OHLC bars like is the case for Candlestick plot style.
1 parent 7ca9440 commit 3afb643

1 file changed

Lines changed: 13 additions & 0 deletions

File tree

‎framework/Source/CPTTradingRangePlot.m‎

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -922,6 +922,19 @@ -(void)drawOHLCInContext:(CGContextRef)context
922922
{
923923
CPTLineStyle *theLineStyle = [self lineStyleForIndex:idx];
924924

925+
if ( !isnan(openValue) && !isnan(closeValue) ) {
926+
if ( openValue < closeValue ) {
927+
if( [[self increaseLineStyleForIndex:idx] isKindOfClass:[CPTLineStyle class]] ){
928+
theLineStyle = [self increaseLineStyleForIndex:idx];
929+
}
930+
}
931+
else if ( openValue > closeValue ) {
932+
if( [[self decreaseLineStyleForIndex:idx] isKindOfClass:[CPTLineStyle class]] ){
933+
theLineStyle = [self decreaseLineStyleForIndex:idx];
934+
}
935+
}
936+
}
937+
925938
if ( [theLineStyle isKindOfClass:[CPTLineStyle class]] ) {
926939
CGFloat theStickLength = self.stickLength;
927940
CGMutablePathRef path = CGPathCreateMutable();

0 commit comments

Comments
 (0)