Fast Updating Live Chart



New to ShinobiCharts and need a little help pelase

I have a very fast data source (approx 20Hz). I therefore need to update a live chart in milliseconds. is this possible?

Also, my code does not seem to work. The xAxis is set as Date but still retruns a number…

The chart is define as follows:

self.chart = [[ShinobiChart alloc] initWithFrame:CGRectInset(self.view.bounds, 100, 20) withPrimaryXAxisType:SChartAxisTypeDateTime withPrimaryYAxisType:SChartAxisTypeNumber];

An observer is watching for updates to the data from an external BLE device (only the observer code is included as I know this works):

- (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary *)change context:(void *)context {
    if ([keyPath isEqual:@"motionCHAR"]) {
        if ([[[[BLEControlClass sharedInstance] livedata] objectForKey:@"name"]]){
            [data addObject:[[NSDictionary alloc] initWithObjectsAndKeys:[[[BLEControlClass sharedInstance] livedata] objectForKey:@"data"],@"data",[[[BLEControlClass sharedInstance] livedata] objectForKey:@"date"],@"date",[[[BLEControlClass sharedInstance] livedata] objectForKey:@"name"],@"name", nil]];
            //NSLog(@"Livee Data - _data === %@", data);
            [self.chart reloadData];
            [self.chart redrawChartIncludePlotArea:YES];


The follow are my chart methods:

#pragma mark - SChartDataSource Methods

-(NSInteger)numberOfSeriesInSChart:(ShinobiChart *)chart
    return 1;

-(SChartSeries *)sChart:(ShinobiChart *)chart seriesAtIndex:(NSInteger)index
    SChartLineSeries *series = [SChartLineSeries new]; = @(5);
    // = YES;
    if (index == 0){
        series.title = @"Acc X";

    return series;

-(NSInteger)sChart:(ShinobiChart *)chart numberOfDataPointsForSeriesAtIndex:(NSInteger)seriesIndex
    //NSLog(@" == %lu", (unsigned long)data.count);
    return data.count;

-(id<SChartData>)sChart:(ShinobiChart *)chart dataPointAtIndex:(NSInteger)dataIndex forSeriesAtIndex:(NSInteger)seriesIndex
    SChartDataPoint *dp = [[SChartDataPoint alloc] init];
    [data enumerateObjectsUsingBlock:^(id obj, NSUInteger idx, BOOL *stop) {
        dp.xValue = obj[@"date"];

        NSData *valueRead = obj[@"data"];
        int16_t AccXData;
        NSRange rangeAccXData = NSMakeRange(6, 2);
        [valueRead getBytes: &AccXData range: rangeAccXData];
        dp.yValue = @(AccXData*0.061);

    return dp;

The ‘data’ as the following content:

        data = <12003000 160089fc b6fe153f b4dfa02e a5dc>;
        date = "2015-35-18 17:35:33.741";
        name = "MM-8ACD";

Any suggestions please?



I’d recommend taking a look at our ‘AppendData’ sample as this demonstrates how to use our data streaming API that prevents the chart from having to reload your entire dataset.

With regards to your x axis, the chart requires the datapoint’s x value to be of type NSDate - would you mind checking that is the case?

Kind regards,



I have the same challenge here. But couldn’t find the ‘AppendData’ example you mentioned. Could you please give some help here?

Meanwhile, I problably need to have 10 time based line series (each one has about 3000 points) in one chart and have to update them at 10HZ. Is it possible on iPhone 6 plus or iPad Air 2?

Thanks in advance.


Hi - our AppendData sample should be in the Samples folder of the trial zip, which you can download from our website - let me know if you have problems finding it after the download :slight_smile:

Regarding redrawing the chart with 30,000 points 100 times a second, I don’t believe this is possible at the moment, as the charts are geared towards interactivity with large data sets and less towards rapid redraw speeds, I’m afraid. However, please feel free to try and see what results it gives you :slight_smile:

Kind regards,