Spline Series
Send Feedback

Glossary Item Box

Topic Overview


This topic provides a conceptual overview of the Spline series in the IGChartView™ control and provides a code example to demonstrate how to add it to the chart view.

In this topic


Spline series summary

Spline series belongs to a group of category series that uses a collection of points connected by smooth curves of spline when rendered. Values are represented on the y-axis (IGNumericYAxis) and categories are displayed on the x-axis (IGCategoryXAxis or IGCategoryDateTimeXAxis).

Spline series emphasizes the amount of change over a time or compares multiple items as well as the relationship of parts to a whole by displaying the total of the plotted values. The spline series is identical to the line series in all aspects except that the line connecting data points has spline interpolation and smoothing for improved presentation of data.

Data requirements

While the IGChartView control allows easy binding to your own data model, make sure to supply the appropriate amounts and types of data required by the series. If the data does not meet the minimum requirements, based on the type of series that you are using, the IGChartView will appear blank.

The following is a list of data requirements for the area series type:

  • Required – the data model must contain at least one numeric field for rendering the data. The data model should contain two or more data items so that a spline can have two or more points.
  • Optional – the data model may contain a string or NSDate field for labels.

Adding a Spline Series to the IGChartView – Code Example


The code below uses the IGCategorySeriesDataSourceHelper to supply randomly generated data to a spline series that first gets added to the IGChartView instance, and then the current UIView adds the IGChartView as a subview.


This code example requires the inclusion of the IGChartView framework, detail about how to add this framework can be found in the Adding the Chart Framework File topic.


In Objective-C:

    NSMutableArray data = [[NSMutableArray alloc] init];
    for (int i = 0; i < 25; i++)
        double value = arc4random() % 100;
        [data addObject:[[NSNumber alloc] initWithDouble:value]];
    IGCategorySeriesDataSourceHelper *source = [[IGCategorySeriesDataSourceHelper alloc] init];
    source.values = data;
    IGChartView *infraChart = [[IGChartView alloc] initWithFrame:self.view.frame];
    [infraChart setAutoresizingMask:UIViewAutoresizingFlexibleWidth|UIViewAutoresizingFlexibleHeight];
    IGCategoryXAxis *xAxis = [[IGCategoryXAxis alloc] initWithKey:@"xAxis"];
    IGNumericYAxis *yAxis = [[IGNumericYAxis alloc] initWithKey:@"yAxis"];
    [infraChart addAxis:xAxis];
    [infraChart addAxis:yAxis];
    IGSplineSeries *splineSeries = [[IGSplineSeries alloc] initWithKey:@"splineSeries"];
    splineSeries.xAxis = xAxis;
    splineSeries.yAxis = yAxis;
    splineSeries.dataSource = source;
    [infraChart addSeries:splineSeries];
    [self.view addSubview:infraChart];

In C#:

List<NSObject> data = new List<NSObject>();
Random r = new Random();
for(int i = 0;i <25; i++)
double val = r.Next() % 100;
data.Add(new NSNumber(val));

IGCategoryDateSeriesDataSourceHelper source = new IGCategoryDateSeriesDataSourceHelper();
source.Values = data.ToArray();

IGChartView chart = new IGChartView(this.View.Frame);
chart.AutoresizingMask = UIViewAutoresizing.FlexibleHeight | UIViewAutoresizing.FlexibleWidth;


IGCategoryXAxis xAxis = new IGCategoryXAxis("xAxis");
IGNumericYAxis yAxis = new IGNumericYAxis("yAxis");

IGSplineSeries series= new IGSplineSeries ("series");
series.XAxis = xAxis;
series.YAxis = yAxis;
series.DataSource = source;


Related Content


The following topics provide additional information related to this topic.



This collection of topics explaining the various types of Category series supported by the IGChartView control.