A polar chart displays a series as a set of points that are grouped by category on a 360-degree circle. Values are represented by the length of the point as measured from the center of the circle. The farther the point is from the center, the greater its value. Polar charts can be used to display non-directional data series against variation in angles. The values of the non-directional data will be plotted proportional to the radius of the polar chart. Polar charts can be plotted using geographical or geometrical angles. The legend entries correspond to the variables that are represented by the radius.
In order to create a simple spline area chart is needed to create an instance of chart series, set ChartType as Polar and fill series with some data, like in the following sample:
<?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="fill_parent" > <com.artfulbits.aiCharts.ChartView android:id="@+id/chartView" chart="@xml/chart" android:background="@android:drawable/alert_dark_frame" android:layout_width="fill_parent" android:layout_height="fill_parent"/> </LinearLayout>
package com.artfulbits.aiCharts.polarsample; import java.util.Random; import com.artfulbits.aiCharts.ChartView; import com.artfulbits.aiCharts.Base.ChartSeries; import android.app.Activity; import android.os.Bundle; public class MainActivity extends Activity { /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); ChartView chartView = (ChartView) findViewById(R.id.chartView); ChartSeries series1 = chartView.getSeries().get(0); ChartSeries series2 = chartView.getSeries().get(1); ChartSeries series3 = chartView.getSeries().get(2); for (int i = 0; i < 50; i++) { series1.getPoints().addXY(i, i); series2.getPoints().addXY(i, 2 * i); series3.getPoints().addXY(i, 3 * i); } } }
<?xml version="1.0" encoding="utf-8"?> <ai:chart xmlns:ai="http://www.artfulbits.com/android/aiCharts"> <ai:area> <area.yaxis position="Top"/> </ai:area> <ai:series type="Polar" /> <ai:series type="Polar" /> <ai:series type="Polar" /> <ai:title text="Just a line..." dock="Right"/> </ai:chart>