example1
<?php
// Sets height and width
$flashChart->begin(450, 250, 'Day', 'Month');
__('Jan', true),
__('Feb', true),
__('Mar', true),
__('Apr', true),
__('May', true),
__('Jun', true),
__('Jul', true),
__('Aug', true),
__('Sep', true),
__('Oct', true),
__('Nov', true),
__('Dec', true)
);
$flashChart->labels($months);
// Title
$flashChart->title('Example 1 - Bars: Hits per Month');
// Prepare some random data (10 points)
$random_hits = $links = array(); for ($i=0; $i < count($months); $i++) { $random_hits[] = rand(0,1000000); $links[] = "javascript:alert('hits: " . $random_hits[$i] . "')";
}
// Register each data set with its information.
'color' => '#afe342',
'font_size' => 11,
'data' => $random_hits,
'links' => $links,
'graph_style' => 'bar',
)
);
$flashChart->setData($data);
// Show the graph
echo $flashChart->render(); ?>
example2
<?php
// Sets height and width
$flashChart->begin(400, 250, 'Day', '#Hits');
// Title
$flashChart->title('Example 2 - Lines: Hits per Day');
// Prepare some random data (10 points)
for ($i=0; $i < 10; $i++) {
$random_hits[] = rand(10000,20000); }
// Register each data set with its information.
'color' => '#00aa42',
'font_size' => 11,
'data' => $random_hits,
'graph_style' => 'lines',
)
);
$flashChart->setData($data);
// Set Ranges in the chart
// $flashChart->setRange('y', 0, 100);
// $flashChart->setRange('x', 0, 10);
// Show the graph
echo $flashChart->render(); ?>
example3
<?php
// Sets height and width
$flashChart->begin(400, 250);
// Title
$flashChart->title('Example 3 - Scatter: Some Random Points');
// Configure Grid style and legends
$flashChart->configureGrid(
'step' => 1,
'legend' => 'Day'
),
'legend' => '#Hits',
)
)
);
// Prepare some random data (10 points)
$random_points = array(); for ($i=0; $i < 10; $i++) {
// Each point is represented as a pair (x,y)
$random_points[] = array('x' => $i, 'y' => rand(0,100)); }
// Register each data set with its information.
'Random Points' => array( 'color' => '#00aa42',
'font_size' => 11,
'data' => $random_points,
'graph_style' => 'scatter'
)
);
$flashChart->setData($data);
// Set Ranges in the chart
$flashChart->setRange('y', 0, 100);
$flashChart->setRange('x', 0, 10);
// Show the graph
echo $flashChart->render(); ?>
example4
<?php
$flashChart->begin(400, 250);
$flashChart->title('Example 4 - Pie Chart: My imaginary Browser Stats');
'value' => 30
),
'value' => 7
),
'value' => 38
),
'value' => 25
)
);
$flashChart->pie($browser_data);
echo $flashChart->render(); ?>
example5
<?php
// Sets height and width
$flashChart->begin(400, 250);
// Title
$flashChart->title('Example 5 - Mixed: Hits per Day vs. # Visits');
// Configure Grid style and legends
$flashChart->configureGrid(
'step' => 1,
'legend' => 'Day'
),
'legend' => '#Hits',
)
)
);
// Prepare some random data (10 points)
for ($i=0; $i < 10; $i++) {
$random_hits2[] = rand(-30,10); }
// debug($random_hits2);
// Register each data set with its information.
'color' => '#324aef',
'font_size' => 11,
'data' => $visits,
'graph_style' => 'bar',
),
'color' => '#afe342',
'font_size' => 11,
'data' => $random_hits2,
'graph_style' => 'line_dot',
)
);
$flashChart->setData($data);
// Set Ranges in the chart
// $flashChart->setRange('y', 0, 100);
// $flashChart->setRange('x', 0, 10);
// Show the graph
echo $flashChart->render();
?>