eamchartwidget Simple Widget to renderize Charts using AmCharts Javascript Library

  1. Requirements
  2. Usage
  3. Installation
  4. Resources

This widget for use with the Yii Framework utilises the Amchart plugin visualize (http://www.amcharts.com/) to render graphs and charts for your web application.

Requirements

  • Yii 1.1 or above

Usage

The following code is a simple instance of Widget, you can create the following chart types:

  • Pie
  • Line
  • Area
  • Column
  • Bar
  • Scatter

The configuration parameter have the same name of the Chart and Grpah defined by AmChart, you can the AmChart Doc and Amchart Examples

// DataProvider, you can use any Provider that implement IDataProvider
$dataProvider = new CActiveDataProvider('OlimpicMedals');


//Chart With bar & line graph
	$this->widget('application.extensions.amcharts.EAmChartWidget', 
					array(
						'width' => 700, // width of the Chart
						'height' => 400, // height of the chart
						'chart'=>array(// collections of grpah to display into the chart
									'dataProvider'=>$dataProvider, // DataProvider
									'categoryField' => 'Date' // Field of the DataProvider to set on the X Axis
									),
						'graphs'=>array(
								array(
									'valueField' => 'GoldMedals', // Field of the DataProvider to set the Y Axis
									'title'=>'Value', // Title of the , used on the Legend
									'type' => 'bar' // Type of Graph
								),
								array(
									'valueField' => 'SilverMedals',
									'title'=>'Value',
									'type' => 'line',
									'fillColors'=>'Transparent',
									'fillAlphas'=>'0',
									'lineColor'=>'#EE2299',
									'bullet'=>'round'
								)),
						'categoryAxis'=>array(
									'title'=>'Species Name'
									),
						'valueAxis'=>array(
									'title'=>'Identifier')
	)); 
	
	// Chart with pie	
	$this->widget('application.extensions.amcharts.AmChartWidget',
			array(
					'width' => 700,
					'height' => 400,
					'Chart'=>array(
							'dataProvider'=>$arrayData,
							'titleField' => 'Country',
							'valueField' => 'Medals',
							'type' => 'pie'
					)
			));

Installation

  • Download the widget from here
  • Extract the following Widget on /YourProject/protected/extensions/

Resources

1 0
11 followers
0 downloads
Yii Version: 1.1
License: Apache-2.0
Category: User Interface
Developed by: luckas
Created on: Aug 13, 2012
Last updated: 5 years ago

Related Extensions