Open Flash Chart
Support This Project :: Home - Javascript - AJAX
Info: Open Flash Chart 2 is out. Version 1.x and these pages will never disappear and the charts will continue working forever, but further development on 1.x has stopped. Take a look at version 2 here Open Flash Chart 2.

Using Javascript to get Open Flash Chart to reload the data file.

function reload()
{
  tmp = findSWF("chart");
  
  //
  // reload the data:
  //
  x = tmp.reload();
  
  //
  // to load from a specific URL:
  // you may need to 'escape' (URL escape, i.e. percent escape) your URL if it has & in it
  //
  x = tmp.reload("gallery-data-32.php?beer=1");
  
  //
  // do NOT show the 'loading...' message:
  //
  x = tmp.reload("gallery-data-32.php?beer=1", false);
}

function findSWF(movieName) {
  if (navigator.appName.indexOf("Microsoft")!= -1) {
    return window["ie_" + movieName];
  } else {
    return document[movieName];
  }
}

The reload method takes an options parameter, which is the URL of the data file. If not present it simply reloads the original URL.

The chart ID is different for IE and Firefox. Firefox follows the standards IE does not, so IE requires more HTML and wants to have two ID properties with the same ID, which is illegal HTML. Firefox complains about this, so to stop errors in both, IE has a 'ie_' appended to the movie name (which is "chart"). For pages with many charts in, the charts are numbered: chart, chart_2, chart_3... etc (and for IE they are ie_chart, ie_chart_2...)

Click here to reload, show beer, earnings.

Click here to reload from a different URL.

IE bug

For some reason this chart looks totally black to me in IE, if it does for you, try clicking on it. The above links work and it reloads data OK, if you can figure out what is going wrong, please email me!!

Please do play with this and report any bugs to me.

gallery-chart-32.php
<?php
include_once 'ofc-library/open_flash_chart_object.php';
open_flash_chart_object'100%''100%''http://'$_SERVER['SERVER_NAME'] .'/open-flash-chart/gallery-data-32.php'false );
?>
To see the data produced : gallery-chart-32.php, then 'view source'.
Help support the project: Support This Project

Adverts: