Flash Chart Testing

Posted by hank, Sun Oct 21 23:00:00 UTC 2007

I’m testing a flash chart plugin based on this.

Basically, it works by pulling from a PHP file that has some nifty PHP code in it:

<?php
# Data
$xlabels = array(
  "Barney Flats Oatmeal Stout",
  "Rogue Chocolate Stout",
  "Rogue Mocha Porter",
  "Samuel Smith's Old Brewery Pale Ale"
);

$data = array(4.95, 4.9, 4.85, 4.75);

include_once( 'open-flash-chart.php' );
$g = new graph();

$g->title( 'Favorite Beer to Date', '{font-size: 26px; color: #EEEEEE;}' );

$g->set_data( $data );
$g->bar_filled( 50, '#9999CC', '#8080A0', 'Overall Rating', 9 );

$g->set_x_labels( $xlabels );
$g->set_x_label_style( 9, "#EEEEEE" );
$g->set_y_label_style( 9, "#EEEEEE" );

$g->set_y_max( 5 );
$g->set_y_min( 4 );

$g->bg_colour = '#202028';
$g->x_axis_colour( '#D0D0D0', '#808080' );
$g->y_axis_colour( '#D0D0D0', '#808080' );

echo $g->render();
?>

Then, in Mephisto, I have this line in my post:


<macro:chart width="660">/charts/2007-10-21-beer.php</macro:chart>

It’s quite cool, actually. I did it by installing this nifty plugin in my Mephisto checkout. Then, I added some stuff to get the following:


https://modzer0.cs.uaf.edu/repos/hank/code/rails/mephisto/filtered_column_flash_chart/

Just install it like any other mephisto plugin (if you’re brave … it’s probably buggy as all hell):


./script/plugin install https://modzer0.cs.uaf.edu/repos/hank/code/rails/mephisto/filtered_column_flash_chart/

Then copy the swf to your public directory in your Mephisto tree, and restart Mephisto. Then make a nice post about graphing, and a graph data page to go along with it.

Tags:

Comments

  • no avatar available for monk.e.boy monk.e.boy
    October 22, 2007 @ 06:17 AM

    Hey, pretty cool.

    You should drop by the forums if you need any help with the charting stuff:

    http://sourceforge.net/forum/?group_id=201148

    monk.e.boy

Have your say

A name is required. You may use Markdown in your comments.