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

StackedColumn Chart Type

Overview

A stacked column chart is used to display all series stacked in a single column for each category. The height of each column is determined by the total of all the series values for the category. Using a stacked column chart is an effective way to present the absolute values of data points represented by the segments of each bar, as well as the total value represented by data points from each series stacked in a column.

Creating the Stack Column Chart

In order to create a stack column chart is needed to create two instances of chart series, set ChartType for those series as StackedColumn 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.stackedcolumnsample;

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);
		
		series1.getPoints().setData(new double[]{ 30, 10, 20, 25, 30 } );
		series2.getPoints().setData(new double[]{ 40, 35, 45, 37, 43 } );
	}
}
<?xml version="1.0" encoding="utf-8"?>
<ai:chart
	xmlns:ai="http://www.artfulbits.com/android/aiCharts">
	<ai:area />
	<ai:series
		type="StackedColumn"
		background="@drawable/column"
		border="0" />
	<ai:series
		type="StackedColumn"
		background="@drawable/statue"
		border="0" />
</ai:chart>
Company | Services | Practices | Technologies | Career | Contacts | Privacy
© 2005-2016 ArtfulBits. All rights reserved.