Polar Scatter Series
Send Feedback

Glossary Item Box

Topic Overview

Purpose

This topic provides a conceptual overview of the Polar Scatter series in the IGChartView™ control and provides a code example showing you how to add it to the chart view.

In this topic


Introduction

Polar Scatter series summary

The Polar Scatter series renders data as a collection of unconnected polar coordinates against a circular polar plot.

Using the same concepts of the Scatter Series, the Polar Scatter series uses polar coordinates to wraps data points around a circular plot. Polar coordinates consist of an ordered pair with the values representing the data points distance from and the angle formed in relation to the center as opposed to stretching them along a Cartesian plane like the Scatter Series. As with other series types, multiple Polar Scatter series can be plotted on the same data chart, and they can overlay one another to show differences and similarities between data sets.

Data requirements

While the IGChartView control allows for easy binding to your own data model, it is important that you supply the appropriate data amount and type of required by that series. If the data model does not meet the series’ minimum requirements, the IGChartView will appear blank.

Required – the bound data model must contain 2 numeric fields, one for each of the two polar coordinates (angle and radius) to render Polar Scatter data.


Adding a Polar Scatter Series to the IGChartView Code Example

Description

The code below uses the IGPolarSeriesDataSourceHelper to supply randomly generated data to a polar scatter series that first gets added to the IGChartView instance, and then the IGChartView is added as a subview of the current UIView.

Prerequisites

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.

Code

In Objective-C:

    NSMutableArray *angle = [[NSMutableArray alloc] init];
    for (int i = 0; i < 25; i++) {
        [angle addObject:[[NSNumber alloc] initWithDouble:(i * 14)]];
    }
    
    NSMutableArray *radius = [[NSMutableArray alloc] init];
    for (int i = 0; i < 25; i++) {
        [radius addObject:[[NSNumber alloc] initWithDouble:(arc4random() % 100)]];
    }
    
    IGPolarSeriesDataSourceHelper *source = [[IGPolarSeriesDataSourceHelper alloc] init];
    source.angleValues = angle;
    source.radiusValues = radius;
    
    IGChartView *infraChart = [[IGChartView alloc] initWithFrame:self.view.frame];
    
    IGNumericAngleAxis *angleAxis = [[IGNumericAngleAxis alloc] initWithKey:@"angleAxis"];
    IGNumericRadiusAxis *radiusAxis = [[IGNumericRadiusAxis alloc] initWithKey:@"radiusAxis"];
    angleAxis.minimum = 0;
    angleAxis.maximum = 360;
    angleAxis.interval = 30;
    [infraChart addAxis:angleAxis];
    [infraChart addAxis:radiusAxis];
    
    IGPolarScatterSeries *polarScatterSeries = [[IGPolarScatterSeries alloc] initWithKey:@"polarScatterSeries"];
    polarScatterSeries.angleAxis = angleAxis;
    polarScatterSeries.radiusAxis = radiusAxis;
    polarScatterSeries.dataSource = source;
    
    [infraChart addSeries:polarScatterSeries];
    [self.view addSubview:infraChart];

In C#:

List<NSObject> angle = new List<NSObject>();
Random r = new Random();
for(int i = 0; i < 25; i++)
angle.Add(new NSNumber(i*14));


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




IGPolarSeriesDataSourceHelper source = new IGPolarSeriesDataSourceHelper ();
source.AngleValues = angle.ToArray();

source.RadiusValues = radius.ToArray();





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

this.View.AddSubview(chart);


IGNumericAngleAxis angleAxis= new IGNumericAngleAxis ("xAxis");
IGNumericRadiusAxis radiusAxis= new IGNumericRadiusAxis ("yAxis");
chart.AddAxis(angleAxis);
chart.AddAxis(radiusAxis);

angleAxis.minimum = 0; angleAxis.maximum = 360; angleAxis.interval = 30;




IGPolarScatterSeries series= new IGPolarScatterSeries ("series");
series.AngleAxis= angleAxis;
series.RadiusAxis = radiusAxis;
series.DataSource = source;

chart.AddSeries(columnSeries);


Related Content

Topics

The following topics provide additional information related to this topic.

Topic

Purpose

This is a group of topics explaining the various types of Polar series supported by the IGChartView control.