A line chart or line graph is a type of graph created by connecting a series of data points together with a line. It is a most simple way to summarize how two pieces of information are related and how they vary depending on one another. A line chart is the most basic type of chart used in finance. This chart type is often used to visualize a trend in data over intervals of time. For example, a line chart of a stock would display the stock's closing prices over a period of time, connected by a line.
aiCharts allows you to easily create detailed line charts which can be generated using a small amount of code. To create simple line chart is needed to create an instance of chart series and fill this series with some data points. The source code should have the following view:
<?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.linesample; 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); } }
<?xml version="1.0" encoding="utf-8"?> <ai:chart xmlns:ai="http://www.artfulbits.com/android/aiCharts"> <ai:area> <area.xaxis grid_visible="false" labels_visible="false" title="Life"/> <area.yaxis grid_visible="false" labels_visible="false" title="Quality"/> </ai:area> <ai:series type="Line" points="0, 60, 40, 100"/> <ai:title text="Life gets better!!!" dock="Top"/> </ai:chart>