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

Column Chart Type

Overview

Column chart represents data as a series of vertical columns whose height is determined by values in the data. Values are represented by the height of the columns and measured from the Y-axis. Category labels are displayed on the X-axis. There are three types of column charts: column, stacked column, and 100% stacked column. This chart type is useful for showing data changes over a period of time. Column charts are frequently used to show comparisons between groups. If there are more than three series presented on the chart, using of the column chart is most suitable.

Creating the Column Chart

In order to create a column chart is needed at first to create an instance of chart series, set ChartType as Column 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.columnsample;

import android.app.Activity;
import android.os.Bundle;

import com.artfulbits.aiCharts.ChartView;
import com.artfulbits.aiCharts.Base.*;
import com.artfulbits.aiCharts.Base.ChartAxis.LabelsMode;

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);
		
		String[] labels = {"Boxing", "Kickboxing", "Karate", "Street fighting", "RUN!!!"};
		double[] efficiency = { 35, 40, 30, 50, 100 };

		ChartView chartView = (ChartView) findViewById(R.id.chartView);
		ChartSeries series = chartView.getSeries().get(0);

		for (int i = 0; i < labels.length; i++)
		{
			ChartPoint point = series.getPoints().addXY(i, efficiency[i]);
			
			point.setAxisLabel(labels[i]);
		}
		
		ChartArea area = chartView.getAreas().get(0);
		
		area.getDefaultXAxis().setLabelsMode(LabelsMode.SeriesLabels);
	}
}
<?xml version="1.0" encoding="utf-8"?>
<ai:chart xmlns:ai="http://www.artfulbits.com/android/aiCharts">
	<ai:area>
	 <area.xaxis title="Form of Self-Defence"/>
	 <area.yaxis title="Efficiency" scale_min="0" labels_visible="false"/>
	</ai:area>
	
	<ai:series type="Column"/>	
	<ai:title text="Self-Defence efficiency" dock="Top"/>
</ai:chart>
Company | Services | Practices | Technologies | Career | Contacts | Privacy
© 2005-2016 ArtfulBits. All rights reserved.