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

Bubble Chart Type

Overview

A bubble chart is a type of chart where each plotted entity is defined in terms of three distinct numeric parameters. In those charts each data field is tied to a particular visualization. Most often data controls the Size and Position of elements in the chart. Thus the charts often resemble a bunch of bubbles. This chart type can be used instead of a point chart if your data has three data series, each of which contains a set of values. Line charts have two axes: numeric axis and categorical axis. The Y-Axis is the numeric axis for line charts. It's means that the quantitative magnitude of the plot is indicated by the position of the plot with respect to the Y-axis. In bubble charts both axes are numeric. Thus, the position of the plot indicates two numeric value and the area of the plot indicates the magnitude of the third numeric characteristic. Bubble charts can facilitate the understanding of the social, economical, medical, and other scientific relationships. Bubble charts are useful when the worksheet has any of the following types of data: three values per data point, multiple data series, negative values.

Creating the Bubble Chart

In order to create a simple bubble chart is needed to create an instance of chart series, set ChartType as Bubble 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.bubblesample;

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;
import com.artfulbits.aiCharts.Types.ChartBubbleType;

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 = {"cow", "chicken", "pig", "turkey"};
		double[] ages = { 5, 1, 2, 1.4 };
		double[] weights = { 520, 3, 180, 9 };

		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, ages[i], weights[i] );
			
			point.setAxisLabel(labels[i]);
		}
		
		series.setLabelFormat("%YVALUE1$#% kg");
		series.setAttribute(ChartBubbleType.MIN_RADIUS, 5);
		series.setAttribute(ChartBubbleType.MAX_RADIUS, 50);
		
		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="animals"/>
	 <area.yaxis title="age (years)" scale_min="0" scale_max="10"/>
	</ai:area>
	<ai:series type="Bubble" showLabel="true"/>	
	<ai:title text="Animals weights" dock="Top"/>
</ai:chart>
Company | Services | Practices | Technologies | Career | Contacts | Privacy
© 2005-2016 ArtfulBits. All rights reserved.