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

Pyramid Chart Type

Overview

A Pyramid Chart is a chart type in which chart has the form of a triangle with lines dividing it into some sections. A related topic is placed in each section. Because of the triangular shape, each section is a different width from the others; this width indicates a level of hierarchy among the topics. For example, the widest section may contain a general topic and the narrowest section may contain a much more specific topic from within that general topic. However, the width is not visually representative of the quantity beyond larger or smaller. This chart type is useful when items need to be arranged in a way that shows hierarchical structure, as well as quantity or size. This can include business management positions, products sold, business locations, etc. In any case, the topics must have a progressive order.

Creating the Pyramid Chart

In order to create a simple spline area chart is needed to create an instance of chart series, set ChartType as Pyramid 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.pyramidsample;

import android.app.Activity;
import android.graphics.Color;
import android.graphics.Paint;
import android.graphics.Typeface;
import android.os.Bundle;

import com.artfulbits.aiCharts.ChartView;
import com.artfulbits.aiCharts.Base.ChartPalette;
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);

		chartView.setPalette(ChartPalette.Grayscale);

		ChartSeries series = chartView.getSeries().get(0);
		String[] names = { "Zombies", "Humans", "Animals", "Plants" };
		
		for (int i = 0; i < names.length; i++)
		{
			series.getPoints().addXY(i, 1).setLabel(names[i]);
		}

		Paint labelPaint = new Paint();

		labelPaint.setTextSize(16);
		labelPaint.setTypeface(Typeface.DEFAULT_BOLD);
		labelPaint.setColor(Color.WHITE);
		labelPaint.setAntiAlias(true);

		series.setMarkerPaint(labelPaint);
		series.setBorderColor(0); // no border
	}
}
<?xml version="1.0" encoding="utf-8"?>
<ai:chart xmlns:ai="http://www.artfulbits.com/android/aiCharts">
	<ai:area/>
	<ai:series type="Pyramid" showlabel="true"/>
	<ai:title text="Food Chain" dock="Left"/>
</ai:chart>
Company | Services | Practices | Technologies | Career | Contacts | Privacy
© 2005-2016 ArtfulBits. All rights reserved.