Warning this is an old version.

Take me to the latest version

Tutorial 3

1: Where is the data file

As well as the URL, Open Flash Chart will also look in the variables that have been passed to it for a 'data-file', if this is found OFC will load that URL.

Code:
<html>
<head>
 
<script type="text/javascript" src="js/swfobject.js"></script>
<script type="text/javascript">
swfobject.embedSWF(
  "open-flash-chart.swf", "my_chart", "550", "200",
  "9.0.0", "expressInstall.swf",
  {"data-file":"chart-3.php"}
  );
</script>
 
</head>
<body>
 
<p>Hello World</p>
 
 
<div id="my_chart"></div>
 
 
</body>
</html>

You should see something like this example 6.

Stop! And read this...

You MUST urlencode any parameter you pass into swfobject, this includes the URL! In the example above there are no evil characters, but if your URL has a ? or & in it - urlencode it before passing it in.

More info: tutorial feedback, and a common misunderstanding.

For details on swfobject, take a look at the swfobject documentation.

Note:

  • That the URL doesn't have an 'ofc=' variable in it.
  • This way of passing the URL to the data file is useful if you have more than one chart on a page.

Great! Next we'll look at how to use the libraries to create the data file for you.

Tutorial 4

Support This Project
Adverts:


Open Flash Chart logo by numb.me.uk. | Syntax highlights are by GeSHi