The Interactive chart widget is similar to the embedded widget but allows much
more user customization. This is a premium widget and requires your account to
be configured for premium access.
Below is a sample Interactive chart:
Installing the Interactive Chart Scripts
Add the following
<script> tags to your web page <header> or just below the <body> tag :
<script src="http://widgets.FreeStockCharts.com/script/bfcGlobalLib.js" type="text/javascript"></script>
<script src="http://widgets.FreeStockCharts.com/script/FSCChartWidget3.js" type="text/javascript"></script>
Showing the Chart (Method 1 - Inline)
There are two methods for showing the Interactive Chart widget in a web page. Method 1 involes adding some JavaScript at the position in the webpage that the chart should appear(Inlining). To inline a chart, add the following javascript to your html:
<script type="text/javascript">
var chart = new BFCChart("bfcChart",501, 660, 500);
chart.createChart();
</script>
In the above code a new chart object is created and inserted into the html document at the point in which the script is placed.
The parameters for the BFCChart constructor are:
BFCChart(controlID,pubID,chartWidth,chartHeight)
- controlID - The Element ID of the Chart Control. Must be unique on the html page
- pubId - Your publisher ID. Assigned to you when you create an account.
- chartWidth - the width of the chart. Can specify pixels or percent
- chartHeight - the height of the chart. Cane specify pixels or percent
Showing the Chart (Method 2 - Specifying a Container)
The second method for adding an interactive Chart widget to your web page is to
designate a host element for the control. This can be any valid html element
(examples: <div>, <span>,<p>,<td>). Consider the following html fragment:
<body>
<p> StockMarket Charts Inc interactive chart demo</p>
<div id='bfcHostDiv'><div>
<p> The Real-time chart above is provided by FreeStockCharts.com</p>
<script type="text/javascript">
var chart = new BFCChart("bfcChart",501, 800, 500);
chart.targetElement = 'bfcHostDiv';
chart.createChart();
</script>
In the above code a div with the id bfcHostDiv is the location in the
document where the chart widget will appear. In the script block the second line
of code: chart.targetElement = 'bfcHostDiv'; instructs the
widget to be created inside the div with the id bfcHostDiv.This allows
the JavaScript for the chart widget creation and initialization to be
located on a different part of the webpage or in a javascript library instead of
the position where the chart should appear.
Once created, there are a number of custom properties, functions and events that
can be called on the Interactive chart widget. View the
properties and methods