How to change a Shinobi line chart color


#1

An a priori apology for such a newbie question. I am creating a ShinobiChart doing a just a simple line chart. I want to change the color of the chart line. From my reading of the docs you would do the following when queried to SCChartSeries:

-(SChartSeries *)sChart:(ShinobiChart *)chart seriesAtIndex:(int)index {

SChartLineSeries *lineSeries = [[SChartLineSeriesalloc] init];

// the first series is a cosine curve, the second is a sine curve

if (index == 0) {

if (_yData)

{

SChartLineSeriesStyle *style = lineSeries.style;

NSNumber *first = [_yDataobjectAtIndex:0];

NSNumber *last = [_yDataobjectAtIndex:([_yDatacount]-1)];

if ([first floatValue]>[last floatValue])

{

style.lineColorBelowBaseline = [UIColorredColor];

style.areaLineColor = [UIColorredColor];

style.areaColorBelowBaseline = [UIColorredColor];

}

else

{

style.lineColorBelowBaseline = [UIColorgreenColor];

style.areaLineColor = [UIColorgreenColor];

style.areaColorBelowBaseline = [UIColorgreenColor];

}

lineSeries.style = style;

}

return lineSeries;

}

However, the color of the line chart never changes from blue. Any ideas where I am going wrong or perhaps some code examples.

  • Tom

#2

Greetings Program!

You need to change the lineSeries.style.lineColor.

Wg


#3

Yes, that worked. Thx!