how to make chart using extjs and php

In this section i want to share about how to make chart using extjs and php, this chart very sampel, i use pie chart and json to make it.

case study: in this tutorial I want to display the graph the number of visitors in a particular month.

create database: exmaple “chart” after that create table like this:

CREATE TABLE IF NOT EXISTS `testchart` (
 `name` varchar(100) NOT NULL,
 `visit` varchar(100) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;

Enter the following data into the testchart table

INSERT INTO `testchart` (`name`, `visit`) VALUES
('jul  2007', '1000'),
('jun 2007', '1500'),
('agu 2007', '2000'),
('sep 2007', '2500');

we have created database, the next is to make the appearance, here are some files that you have to make,

index.php

Charts

 
 
 
 
 

at the source code , there are red script, the script used to call piechhart.js files, the contents of the file is as follows.

/*!
 * Ext JS Library 3.1.0
 * Copyright(c) 2006-2009 Ext JS, LLC
 * licensing@extjs.com
 * http://www.extjs.com/license
 */
Ext.chart.Chart.CHART_URL = 'ext/resources/charts.swf';

Ext.onReady(function(){
 var store = new Ext.data.JsonStore({
 url:'viewchart.php',
 fields:['name', 'visit', 'view'],
 root:'data'

 });
 store.load();
 new Ext.Panel({
 width: 400,
 height: 400,
 title: 'chart using piechart',
 renderTo: 'container',
 items: {
 store: store,
 xtype: 'piechart',
 dataField: 'visit',
 categoryField: 'name',
 //extra styles get applied to the chart defaults
 extraStyle:
 {
 legend:
 {
 display: 'bottom',
 padding: 5,
 font:
 {
 family: 'Tahoma',
 size: 13
 }
 }
 }
 }
 });
});

.

on javascript file there is script to load php file, the contents of the file is as follows.

 $arr));
 echo $jsonresult;
?>

piechart-extjs

Tags: , , , , , , , , , , , , , , ,

Incoming search terms for the article:

extjs charts , extjs chart , pie chart extjs php , extjs php , extjs graph , extjs piechart , extjs chart json , ExtJS 3 chart , ext chart extraStyle examples , chart php extjs , chart extjs , extjs javascript chart , extjs pie chart , extjs php mysql , extjs barchar series color , extjs php json_encode , extjs graphing , extjs multifile uploader , extjs pie chart (css OR style) , piechart ext js , php extjs library , php ext js script , php chart , Java Script Chart for extjs , how to show chart values extjs , How to create using ExtJS , how to create graph using php , extjs piechart legend , use extjs in php , extjs create bar chart php example , extjs charts with php , extjs charts grid , extjs 3 1 chart , extjs 3 0 chart title at bottom , ext js in php , ext js chart tutorial , ext create a chart from a jsonstore , ext chart legend under , datafield chart ext , chart extjs php , chart extjs 3 0 tutorial , extjs 3 1 data php , extjs 3 1 editable grid php , extjs charts example , extjs charts b is null , example Ext chart Chart CHART_URL , extjs chart series , extjs chart legend item data , extjs chart graph , extjs bar chart colors extjs themes , extjs file upload , extjs theme , extjs upload , extjs upload file , extjs grid checkbox , extjs tutorial , extjs login , extjs login form , extjs grid paging exjs file upload , getForm() load({url:simplegrid php?act=get&id= m[0] get(id) waitMsg:Loading}); , extjs get grid row height , submit grid checkbox extjs , extjs grid checkbox submit , extJS login demo not work in 3 1 , upload xls file using extjs , extjs CheckboxSelectionModel color , extjs form load callback , upload file extjs tutorial 

Leave a Reply

Security Code: