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

HiLo Chart Type

Overview

A HiLo chart combines two independent values to supply high and low data for each point in a series. HiLo charts are used primarily in financial applications to show the high and low price for a given stock. The elements of the Y and Y1 arrays in each series of a HiLo chart represent the "high" value, and the "low" value.

Creating the HiLo Chart

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

import java.util.Calendar;

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 series = chartView.getSeries().get(0);
		
		double[] lo = {29, 29, 36, 31, 33, 36, 38, 39, 37, 37};
		double[] hi = {41, 46, 55, 45, 50, 55, 58, 58, 56, 59};
		
		Calendar calendar = Calendar.getInstance();
		
		calendar.clear();
		calendar.set(2010, Calendar.MARCH, 10);
		
		for (int i = 0; i < 10; i++)
		{
			series.getPoints().addDate(calendar, lo[i], hi[i]);
			calendar.roll(Calendar.DAY_OF_MONTH, true);
		}
	}
}
<?xml version="1.0" encoding="utf-8"?>
<ai:chart xmlns:ai="http://www.artfulbits.com/android/aiCharts">
	<ai:area>
		<area.xaxis format="{0,date,dd MMM}" valuetype="Date"/>
		<area.yaxis format="{0} F"/>
	</ai:area>
	<ai:series type="Hilo" linewidth="5"/>
	<ai:title text="10-DAY WEATHER for Salt Lake City, UT" dock="Top"/>
</ai:chart>
Company | Services | Practices | Technologies | Career | Contacts | Privacy
© 2005-2016 ArtfulBits. All rights reserved.