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

SplineArea Chart Type

Overview

A Spline Area chart type is an area chart that plots a fitted curve through each data point in a series. This chart type allows to take limited set of known data points and approximate intervening values.

Creating the Spline Area Chart

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

import com.artfulbits.aiCharts.ChartView;
import com.artfulbits.aiCharts.Annotations.ChartAnnotation;
import com.artfulbits.aiCharts.Annotations.ChartAnnotationPosition;
import com.artfulbits.aiCharts.Annotations.ChartDrawableAnnotation;
import com.artfulbits.aiCharts.Base.ChartSeries;
import com.artfulbits.aiCharts.Enums.Alignment;

import android.app.Activity;
import android.graphics.drawable.Drawable;
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);
		
		double[] hill = { 90, 85, 80, 30, 25, 20, 10, 5, 0};
		
		series.getPoints().setData(hill);
		
		Drawable drawable = getResources().getDrawable(R.drawable.bike);
		ChartDrawableAnnotation annotation = new ChartDrawableAnnotation(drawable);
		
		annotation.setPosition(ChartAnnotationPosition.relativeToSeries("hill", 1));
		annotation.setVerticalAlignment(Alignment.Near);
		
		chartView.getChart().getAnnotations().add(annotation);
	}
}
<?xml version="1.0" encoding="utf-8"?>
<ai:chart xmlns:ai="http://www.artfulbits.com/android/aiCharts">
	<ai:area>
		<ai:area.xaxis labels_visible="false"/>
		<ai:area.yaxis labels_visible="false"/>
	</ai:area>
	<ai:series name="hill" type="SplineArea"/>
</ai:chart>
Company | Services | Practices | Technologies | Career | Contacts | Privacy
© 2005-2016 ArtfulBits. All rights reserved.