Elements - Tags Menu - Tags Example
OK people - this chart is wrong! Incorrect! Erroneous!
Why? A chart should be simple, it should show a simple shape that you see and go "Oh yeah, it slopes down."
The value of each bar should not be shown.
Why not show the value of each bar? Well it adds visual clutter to the chart. The absoulte value
is already there for the user to explore using the tooltips.
Simple is better. Visual clutter is bad. A simple chart with a table of data next to it
is better than a cluttered chart that is trying too hard. Values in a table, shapes in a chart!
Use these tags to tag single items of data, or exceptions, or other data points of interest.
I am leaving this example here because I get a lot of requests for this type of bar chart and
I am tired of explaining why bar charts shouldn't look like this.
Documentation: tag,
tags,
ofc_arrow.
This goes into the <head> of the page:
<script type="text/javascript" src="js/swfobject.js"></script>
<script type="text/javascript">
swfobject.embedSWF(
"open-flash-chart.swf", "my_chart",
"650", "200", "9.0.0", "expressInstall.swf",
{"data-file":"gallery/tags-example.php"} );
</script>
This writes the chart into a div with id="my_chart",
right click and view source to see it in action,
[the tutorials have more details]
gallery/tags-example.php
<?php
include '../php-ofc-library/open-flash-chart.php';
$title = new title( date("D M d Y") );
$bar_values = array(9,8,7,6,5,4,4);
$bar = new bar_glass(); $bar->set_values( $bar_values );
// // THE MAIN EVENT // set up the tags //
$tags = new ofc_tags(); $tags->font("Verdana", 10) ->colour("#000000") ->align_x_center() ->text('#y#');
$x=0; foreach($bar_values as $v) { $tags->append_tag(new ofc_tag($x, $v)); $x++; }
$x = new x_axis(); $x->set_labels_from_array(array('Mon','Tue','Wed','Thur','Fri','Sat','Sun'));
$chart = new open_flash_chart(); $chart->set_title( $title ); $chart->add_element( $bar ); $chart->add_element( $tags ); $chart->set_x_axis( $x );
echo $chart->toString();
|
Adverts:
|