Now that Open Flash and Open Flash 2 have been integrated, I figured I would post my request here. I have gotten pie charts working in my site very well. I am having a lot of trouble getting horizontal bar charts working. I cannot get any data to display and have read through the code multiple times trying to adapt my code from my pie charts and the sample vertical bar chart to create a horizontal bar chart. All I can get is the base chart to display with 0 through 10 on the y-axis and 0 on the x-axis (assuming this is just the dummy chart). It is working though because I can modify my title, etc. Has anyone gotten this working successfully and what did you have to do?

Thanks

Comments

ernest.park’s picture

This is from the API for OFC2.

/**
 * PHP Integration of Open Flash Chart
 * Copyright (C) 2008 John Glazebrook <open-flash-chart@teethgrinder.co.uk>
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
 */

require_once('../<path_to_http_base>/sites/all/modules/ofc_api/php5-ofc-library/lib/OFC/OFC_Chart.php');

$title = new OFC_Elements_Title( "Our New House Schedule" );

$hbar = new OFC_Charts_Bar_Horizontal();
$hbar->append_value( new OFC_Charts_Bar_Horizontal_Value(0,4) );
$hbar->append_value( new OFC_Charts_Bar_Horizontal_Value(4,8) );
$hbar->append_value( new OFC_Charts_Bar_Horizontal_Value(8,11) );

$chart = new OFC_Chart();
$chart->set_title( $title );
$chart->add_element( $hbar );
$chart->add_y_axis( new OFC_Elements_Axis_Y() );

$x = new OFC_Elements_Axis_X();
$x->set_offset( false );
$x->set_labels_from_array( array('Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec') );
$chart->set_x_axis( $x );

$y = new OFC_Elements_Axis_Y();
$y->set_offset( true );
$y->set_labels( array( "Make garden look sexy","Paint house","Move into house" ) );
$chart->add_y_axis( $y );

$width = 900;
$height = 450;
echo $chart->toPrettyString();
echo "\n";
print ofc_api_render($chart,$width, $height);

capoyeti’s picture

Hi ernest.park

How do I implement the API - I'm using charts and graphs, and selecting Open Flash 2 as the charting engine.. What do I need to configure or enable for the API to generate graphs - I urgently need horizontal bar's with a hover showing the values. Currently Google Charts option gives the horizontal bar's but not the values when you hover your mouse over them.

Thanks,
Chad

pedrorocha’s picture

Status: Active » Closed (won't fix)

As said in the module description, no more improvements will be made here, since Open Flash Chart project is abandoned.