0% found this document useful (0 votes)
243 views

Tutorial Open Flash Chart Bar Chart

The document provides tutorials for creating different types of bar charts using Open Flash Chart (OFC), an open source PHP charting library. It covers the basics of bar charts and then demonstrates how to create filled bars, glass bars, axis labeled bars, sketch bars, cylinder bars, outlined cylinder bars, rounded glass bars, round bars, dome bars, dual axis labeled bars, bars with null values, floating bars, click events, and customized tooltips. Code examples in PHP are provided for each chart type along with the necessary JavaScript and HTML to render the charts.

Uploaded by

Subandi Wahyudi
Copyright
© © All Rights Reserved
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
243 views

Tutorial Open Flash Chart Bar Chart

The document provides tutorials for creating different types of bar charts using Open Flash Chart (OFC), an open source PHP charting library. It covers the basics of bar charts and then demonstrates how to create filled bars, glass bars, axis labeled bars, sketch bars, cylinder bars, outlined cylinder bars, rounded glass bars, round bars, dome bars, dual axis labeled bars, bars with null values, floating bars, click events, and customized tooltips. Code examples in PHP are provided for each chart type along with the necessary JavaScript and HTML to render the charts.

Uploaded by

Subandi Wahyudi
Copyright
© © All Rights Reserved
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
You are on page 1/ 11

Tutorial Open Flash Chart Bar Chart

Sebelum membaca materi ini sebaiknya anda baca materi tutorial membuat chart dengan
open flash chart 2 untuk mengetahui requirememt yang dibutuhkan
a. Bar chart
Data-bar-chart.php
<?php
include 'ofc/php-ofc-library/open-flash-chart.php';
$title = new title( date("D d !"" ";
$bar = new bar(";
$bar-#set$%alues( array(&'(')'*'+','-'.'/" ";
$chart = new open$flash$chart(";
$chart-#set$title( $title ";
$chart-#add$ele0ent( $bar ";
echo $chart-#to1retty2trin3(";
?>
Ofc-bar-chart.php
<script type="text/a!ascript" src="ofc/s/s"fobect#s"></script>
<script type="text/a!ascript">
s"fobect#embedS$%&
"ofc/open'flash'chart#s"f"( "my)chart"(
"**+"( "2++"( ",#+#+"( "express-nstall#s"f"(
."data'file"/"data'bar'chart#php"0 12
</script>
<di! id=3my)chart3></di!>
4asilnya /
b. Bar filled chart
5
Data-bar-filled-chart.php
<?php
include 'ofc/php-ofc-library/open-flash-chart.php';
$title = new title( date("D d !"" ";
$bar = new bar$filled( '45.D**6'' '4+)).*/' ";
$bar-#set$%alues( array(&'(')'*'+','-'.'/" ";
$chart = new open$flash$chart(";
$chart-#set$title( $title ";
$chart-#add$ele0ent( $bar ";
$chart-#set$b3$colour( '4777777' ";
echo $chart-#to1retty2trin3(";
?>
Ofc-bar-filled-chart.php
<script type="text/a!ascript" src="ofc/s/s"fobect#s"></script>
<script type="text/a!ascript">
s"fobect#embedS$%&
"ofc/open'flash'chart#s"f"( "my)chart"(
"**+"( "2++"( ",#+#+"( "express-nstall#s"f"(
."data'file"/"data'bar'filled'chart#php"0 12
</script>
<di! id=3my)chart3 ></di!>
4asilnya
c# 6ar 7lass chart

8ata'bar'glass'chart#php
<?php
include 9ofc/php'ofc'library/open'flash'chart#php92
2
:title = ne" title& date&"8 ; d <"1 12
:data = array&,(=(>(?(null(@(A(2(512
:dataB@C = ne" bar)!alue&*12
:dataB@C'>set)colour& 9Dff++++9 12
:dataB@C'>set)tooltip& 94ello<br>D!alD9 12
:bar = ne" bar)glass&12
:bar'>set)!alues& :data 12
:chart = ne" open)flash)chart&12
:chart'>set)title& :title 12
:chart'>add)element& :bar 12
echo :chart'>toString&12
?>
Efc'bar'glass'chart#php
<script type="text/a!ascript" src="ofc/s/s"fobect#s"></script>
<script type="text/a!ascript">
s"fobect#embedS$%&
"ofc/open'flash'chart#s"f"( "my)chart"( "**+"( "2++"(
",#+#+"( "express-nstall#s"f"(
."data'file"/"data'bar'glass'chart#php"0 12
</script>
<di! id="my)chart" ></di!>
4asilnya /
d# Ad bar chart
A
8ata'Ad'bar'chart#php
<?php
include 9ofc/php'ofc'library/open'flash'chart#php92
srand&&double1microtime&1F5++++++12
:data = array&12
// add random height bars/
for& :i=+2 :i<,2 :iGG 1
:dataBC = rand&2(,12

// make the last bar a different colour/
:bar = ne" bar)!alue&*12
:bar'>set)colour& 9D,+++++9 12
:bar'>set)tooltip& 94ello<br>D!alD9 12
:dataBC = :bar2
:title = ne" title& date&"8 ; d <"1 12
:bar = ne" bar)Ad&12
:bar'>set)!alues& :data 12
:bar'>colour = 9D8*@H>=92
:x)axis = ne" x)axis&12
:x)axis'>set)Ad& * 12
:x)axis'>colour = 9D,+,+,+92
:x)axis'>set)labels& array&5(2(A(@(*(?(>(=(,(5+1 12
:chart = ne" open)flash)chart&12
:chart'>set)title& :title 12
:chart'>add)element& :bar 12
:chart'>set)x)axis& :x)axis 12
echo :chart'>toIrettyString&12
?>
Efc'Ad'bar'chart#php
<script type="text/a!ascript" src="ofc/s/s"fobect#s"></script>
<script type="text/a!ascript">
s"fobect#embedS$%&
"ofc/open'flash'chart#s"f"( "my)chart"( "**+"( "2++"(
",#+#+"( "express-nstall#s"f"(
@
."data'file"/"data'Ad'bar'chart#php"0 12
</script>
<di! id="my)chart" ></di!>
4asilnya /
e# line start chart
data'sketch'bar'chart#php
<?php
include 9ofc/php'ofc'library/open'flash'chart#php92
:title = ne" title& date&"8 ; d <"1 12
:title'>set)style& 9.color/ D*?>A++2 font'siJe/ 5@px09 12
:data=array&12
for& :i=+2 :i<522 :iGG1
.
if&rand&5(5+1<>1
:dataBC = :i2 // <'' append a number
else
.
// append a bar)!alue obect to the data array
:bar = ne" bar)!alue&A12
:bar'>set)tooltip& 94ello<br>D!alD9 12
:dataBC = :bar2
0
0
*
:bar = ne" bar)sketch& 9D=5KH++9( 9D*?>A++9( * 12
:bar'>set)!alues& :data 12
:chart = ne" open)flash)chart&12
:chart'>set)title& :title 12
:chart'>add)element& :bar 12
echo :chart'>toIrettyString&12
?>
ofc'sketch'bar'chart#php
<script type="text/a!ascript" src="ofc/s/s"fobect#s"></script>
<script type="text/a!ascript">
s"fobect#embedS$%&
"ofc/open'flash'chart#s"f"( "my)chart"( "**+"( "2++"(
",#+#+"( "express-nstall#s"f"(
."data'file"/"data'sketch'bar'chart#php"0 12
</script>
<di! id="my)chart" ></di!>
hasilnya /
f# 6ar Hylinder chart
8ata'bar'cylinder'chart#php
<?php
include 9ofc/php'ofc'library/open'flash'chart#php92
:title = ne" title& date&"8 ; d <"1 12
?
:data = array&,(=(>(?(*(@(A(2(512
:bar = ne" bar)cylinder&12
:bar'>set)!alues& :data 12
:chart = ne" open)flash)chart&12
:chart'>set)title& :title 12
:chart'>add)element& :bar 12
:x)axis = ne" x)axis&12
:x)axis'>set)Ad& * 12
:x)axis'>colour = 9Dd+d+d+92
:chart'>set)x)axis& :x)axis 12
echo :chart'>toString&12
?>
Efc'bar'cylinder'chart#php
<script type="text/a!ascript" src="ofc/s/s"fobect#s"></script>
<script type="text/a!ascript">
s"fobect#embedS$%&
"ofc/open'flash'chart#s"f"( "my)chart"( "**+"( "2++"(
",#+#+"( "express-nstall#s"f"(
."data'file"/"data'bar'cylinder'chart#php"0 12
</script>
<di! id="my)chart" ></di!>
4asilnya /
g# bar'cylinder'outline'chart
>
data'bar'cylinder'outline'chart#php
<?php
include 9ofc/php'ofc'library/open'flash'chart#php92
:title = ne" title& date&"8 ; d <"1 12
:data = array&,(=(>(?(*(@(A(2(512
:bar = ne" bar)cylinder)outline&12
:bar'>set)!alues& :data 12
:chart = ne" open)flash)chart&12
:chart'>set)title& :title 12
:chart'>add)element& :bar 12
echo :chart'>toString&12
?>
ofc'bar'cylinder'outline'chart#php
<script type="text/a!ascript" src="ofc/s/s"fobect#s"></script>
<script type="text/a!ascript">
s"fobect#embedS$%&
"ofc/open'flash'chart#s"f"( "my)chart"( "**+"( "2++"(
",#+#+"( "express-nstall#s"f"(
."data'file"/"data'bar'cylinder'outline'chart#php"0 12
</script>
<di! id="my)chart" ></di!>
hasilnya /
h# bar rounded glass
data'bar'rounded'glass#php
<?php
=
include 9ofc/php'ofc'library/open'flash'chart#php92
:title = ne" title& date&"8 ; d <"1 12
:data = array&,(=(>(?(*(@(A(2(512
:bar = ne" bar)rounded)glass&12
:bar'>set)!alues& :data 12
:chart = ne" open)flash)chart&12
:chart'>set)title& :title 12
:chart'>add)element& :bar 12
echo :chart'>toString&12
?>
ofc'bar'rounded'glass#php
<script type="text/a!ascript" src="ofc/s/s"fobect#s"></script>
<script type="text/a!ascript">
s"fobect#embedS$%&
"ofc/open'flash'chart#s"f"( "my)chart"( "**+"( "2++"(
",#+#+"( "express-nstall#s"f"(
."data'file"/"data'bar'rounded'glass#php"0 12
</script>
<di! id="my)chart" ></di!>
hasilnya /
i# bar round chart
data'bar'round'chart#php
<?php
include 9ofc/php'ofc'library/open'flash'chart#php92
:title = ne" title& date&"8 ; d <"1 12
,
:data = array&,(=(>(?(*(@(A(2(512
:bar = ne" bar)round&12
:bar'>set)!alues& :data 12
:chart = ne" open)flash)chart&12
:chart'>set)title& :title 12
:chart'>add)element& :bar 12
echo :chart'>toString&12
?>
ofc'bar'round'chart#php
<script type="text/a!ascript" src="ofc/s/s"fobect#s"></script>
<script type="text/a!ascript">
s"fobect#embedS$%&
"ofc/open'flash'chart#s"f"( "my)chart"( "**+"( "2++"(
",#+#+"( "express-nstall#s"f"(
."data'file"/"data'bar'round'chart#php"0 12
</script>
<di! id="my)chart" ></di!>
hasilnya /
# bar dome chart
k# bar round Ad chart
l# 2 bar set of bar in chart
m# 2 bar set of bars "ith null !alues
5+
n# En sho" animation
o# %loating bar
p# on click e!ent
q# tool tips style

55

You might also like