whitespace COMPANY whitespace SERVICES whitespace PRODUCTS whitespace PURCHASE whitespace SUPPORT whitespace CONTACTS whitespace Home whitespace Contact Us whitespace Site Map whitespace
whitespace
WHY ARTFULBITS
whitespace
OUR APPROACH
whitespace
OUR TEAM
whitespace
FACT SHEET
whitespace
NEWS & EVENTS
whitespace
PRIVACY
whitespace
whitespace

StackedColumn100 Chart Type

Overview

This chart type displays multiple data series as stacked columns, and the cumulative proportion of each stacked element always totals 100%. The 100% stacked column chart is useful for measuring multiple series as a proportion vs. time. You can use this chart type for displaying the proportion of a monthly mortgage payment that is applied to interest and principal over time. In this example, the mortgage payment amount represents 100%, while the interest and the principal values are the two stacked elements that make up one column.

Creating the Stack Column 100% Chart

In order to create a stack column 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:

zip archive Download 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.stackedcolumn100sample;

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 bottomSeries = chartView.getSeries().get("bottom");
		ChartSeries topSeries = chartView.getSeries().get("top");

		double[] data1 = { 83, 57, 55, 35, 7, 16, 39, 41, 64, 68 };
		double[] data2 = { 1, 16, 18, 26, 82, 91, 73, 69, 50, 38 };

		bottomSeries.getPoints().setData(data1);
		topSeries.getPoints().setData(data2);
	}
}
<?xml version="1.0" encoding="utf-8"?>
<ai:chart xmlns:ai="http://www.artfulbits.com/android/aiCharts">
	<ai:area/>
	<ai:legend/>
	<ai:series name="bottom" type="StackedColumn100"/>
	<ai:series name="top" type="StackedColumn100"/>
</ai:chart>
Company | Services | Practices | Technologies | Career | Contacts | Privacy
© 2005-2016 ArtfulBits. All rights reserved.