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

RangeArea Chart Type

Overview

Range area chart displays graphically quantitative data. A range-area chart is a variation of an Area chart that lets you plot bands of data similar to bollinger bands and weather patterns. Each point in the chart is specified by two y-coordinate values, which represent the higher and lower ends of the band.

Creating the RangeArea Chart

In order to create a simple range area chart you will need to create instance of chart series, set ChartType as RangeArea 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.RangeAreaSample;

import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;

import com.artfulbits.aiCharts.ChartView;
import com.artfulbits.aiCharts.Base.ChartSeries;

import android.app.Activity;
import android.database.sqlite.SQLiteDatabase;
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 series = chartView.getSeries().get(0);

		SQLiteDatabase db = openDB("data.db");

		series.getPoints().setData(db, "[values]",
				new String[] { "value1", "value2" });
	}

	public SQLiteDatabase openDB(String filename)
	{
		File file = getDatabasePath(filename);

		if (!file.exists())
		{
			File patentDir = file.getParentFile();

			if (!patentDir.exists())
				patentDir.mkdirs();

			int length = 0;
			byte[] buffer = new byte[2048];

			try
			{
				OutputStream output = new FileOutputStream(file);
				InputStream input = getAssets().open(filename);

				while ((length = input.read(buffer)) > 0)
				{
					output.write(buffer, 0, length);
				}

				output.close();
				input.close();
			}
			catch (IOException ex)
			{
				ex.printStackTrace();
			}
		}

		return SQLiteDatabase.openOrCreateDatabase(file, null);
	}
}
<?xml version="1.0" encoding="utf-8"?>
<ai:chart xmlns:ai="http://www.artfulbits.com/android/aiCharts">
	<ai:area/>
	<ai:series type="RangeArea"/>
</ai:chart>
Company | Services | Practices | Technologies | Career | Contacts | Privacy
© 2005-2016 ArtfulBits. All rights reserved.