A Stack Area 100% chart displays multiple sets of data as stacked areas, and the cumulative proportion of each stacked element always totals 100%. The entire chart will always be filled, since the value being measured must be 100% (a combination of several sets of data). This chart type is useful for showing proportional data that occurs over time.
In order to create a stack area 100% chart is needed to create two instances of chart series, set ChartType for those series as StackedArea100 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.stackedarea100sample; import android.app.Activity; import android.os.Bundle; import com.artfulbits.aiCharts.ChartView; import com.artfulbits.aiCharts.Base.ChartSeries; 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); double[] data1 = { 68, 17, 45, 91, 31, 55, 59, 85, 24, 100 }; double[] data2 = { 36, 29, 99, 62, 65, 43, 5, 72, 1, 33 }; series1.getPoints().setData(data1); series2.getPoints().setData(data2); } }
<?xml version="1.0" encoding="utf-8"?> <ai:chart xmlns:ai="http://www.artfulbits.com/android/aiCharts"> <ai:area> <ai:area.yaxis labels_visible="false"/> </ai:area> <ai:series type="StackedArea100"/> <ai:series type="StackedArea100"/> </ai:chart>