Skip to main content

Open Flash Charts 2 & individual clickable bars: How to add Links to bar charts

Open Flash Charts is an open source, flash charting component built by monk.e.boy. It supports multiple languages including php, java, .NET and more. In the words of the creator, it was created because
"I could learn Flash and Actionscript and write my own charting component, release it as Open Source, host it on sourceforge and build up a community of helpful coders faster than they(company who sells proprietary flash charting component) can fix a single bug.
--From "

Open Flash Chart released version 2 Lug Wyrm Charmer in July 2009, and sadly the project hasn't seen a newer version since then. The community however has modifications and patches for OFC2 which keeps the project alive.

I used OFC2 in a intranet project recently where I didn't want to use Google Charts. Tutorials on the OFC2 website made the setup pretty easy.

I used Bar Charts, which did not properly support click events. The fix was pretty easy and I am documenting the same here.

Sample code for Open Flash Charts 2 on how to add links to your bar charts.
Usage Example:
stats.php (source from OFC examples, modified code is marked.)

set_colour( '#ff0000' );
$data[4]->set_tooltip( 'Hello
#val#' );

//modified code starts
//modified code ends

$bar = new bar_glass();
$bar->set_values( $data );

$chart = new open_flash_chart();
$chart->set_title( $title );
$chart->add_element( $bar );

echo $chart->toString();

Source Code Modification:
I was using the php-ofc-library, and had to modify the file ofc_bar_glass.
Find the class bar_value, and modify as below

class bar_value
* @param $top as integer. The Y value of the top of the bar
* @param OPTIONAL $bottom as integer. The Y value of the bottom of the bar, defaults to Y min.
function bar_value( $top, $bottom=null )
$this->top = $top;

if( isset( $bottom ) )
$this->bottom = $bottom;

function set_colour( $colour )
$this->colour = $colour;

function set_tooltip( $tip )
$this->tip = $tip;
//modified code start
function set_on_click( $onclick )
$this->$tmp = $onclick;
//modified code end

(Syntax Highlighting not available)
If you are new to OFC, you may have to look at the tutorials. has a modified version of OFC, with a lightweight SWF file which I found very useful.


Popular posts from this blog

CPU Temperature Guide for Intel Core 2 Duo : Range of Normal CPU Temperatures

Is your CPU Temperature too High? How high is high enough? Is 60 degree Celsius high enough or is 70 degree Celsius the threshold? Hipatic covers your temperature problems right here. Below we discuss Intel Core 2 Duo.
If your CPU is overheating, visit our CPU Overheating Guide and CPU Overheating: Symptoms, Causes, & Solutions

To measure CPU Temperatures you may need Real Temp

Intel Core 2 Duo:
(If you wish to access the PDF related to your processor, please first follow the link given under sources at the end of the article instead of directly accessing the pdf link given under each sub heading. This will help you access the latest information on your processor from Intel's website & will also prevent hotlinking.)

1. Intel® Core™2 Duo Processor E8000 Series
Intel ® Core™2 Duo Processor E8600, E8500, E8400, E8300, E8200, E8190 Thermal Profile
Range: 45.1 degree Celsius (Power - 0W) to 72.4 degree Celsius (Power 65W)

CPU Overheating: Symptoms, Causes and Solutions

The most hit pages on this blog are the CPU Temperature Guides, so here is a comprehensive(work in progress) guide to everything(almost) related to CPU Overheating.

Symptoms of a Overheating CPU :

1. Random Crashes:
Your system may switch off or restart automatically while you are using it. And this may happen repeatedly. If the overheating problem is not severe enough, then your PC may only crash when you are running many CPU intensive applications or running a CPU intensive game. If your CPU temperature is very high, then the system may restart as it is booting up ending into a endless and dangerous loop.

2.Sluggish System:
An overheating CPU underperforms, result being a sluggish computing experience. The system may experience random lock-ups too.

Differential Diagnosis:
A PC may also crash due to RAM, Motherboard, Hard Disk & Power Supply Unit issues.

Causes of CPU Overheating:

1. Improper CPU + Heatsink installation:
If your system is new and you have overheating issues, or if you…

CPU Temperature Guide for Intel Pentium 4: Range of Normal CPU Temperatures

Is your CPU Temperature too High? How high is high? Is 60 degree Celsius high enough or is 70 degree Celsius the threshold? Hipatic covers your temperature problems right here. Below we discuss Intel Pentium 4.

Pentium 4 Processors:
Temperatures Specified are Maximum Processor Case Temperatures(Tc). For details refer the sources given.
For 65 nm Process in the 775-land LGA Package supporting Hyper-Threading Technology and Intel® 64 architecture

Thermal Profile for 775_VR_CONFIG_05A ProcessorsRange 44.3 degree (at Power - 0W) Celsius to 69.2 degree Celsius (at Power - 86W)
Source: Page:77 Table:28

Thermal Profile for 775_VR_CONFIG_06 Processors
Range 43.6 degree (at Power - 0W) Celsius to 64.1 degree Celsius (at Power - 64W)
Source: Page:78 Table:29

For 90 nm Process in the 775-land LGA Package supporting Intel® Extended Memory 64 Technology & Supporting Intel® Virtualization Tech…