日期:2014-05-16 浏览次数:20535 次
//yui LineChart 核心代码
var mychart = new YAHOO.widget.LineChart( "chart", myDataSource,
{
series: seriesDef,
xField: "month",
yAxis: currencyAxis,
dataTipFunction: YAHOO.example.getDataTipText,
//only needed for flash player express install
expressInstall: "assets/expressinstall.swf"
});
//extjs LineChart 核心代码
new Ext.Panel({
title: 'ExtJS.com Visits Trend',
renderTo: 'container',
width:500,
height:300,
layout:'fit',
items: {
xtype: 'linechart',
store: store,
xField: 'name',
yField: 'visits',
listeners: {
itemclick: function(o){
var rec = store.getAt(o.index);
Ext.example.msg('Item Selected', 'You chose {0}.', rec.get('name'));
}
}
}
});



/**
* Embeds the SWF in the page and associates it with this instance.
*
* @method _embedSWF
* @private
*/
_embedSWF: function(swfURL, containerID, swfID, version, backgroundColor, expressInstall, wmode)
{
//standard SWFObject embed
var swfObj = new YAHOO.deconcept.SWFObject(swfURL, swfID, "100%", "100%", version, backgroundColor);
if(expressInstall)
{
swfObj.useExpressInstall(expressInstall);
}
//make sure we can communicate with ExternalInterface
swfObj.addParam("allowScriptAccess", "always");
if(wmode)
{
swfObj.addParam("wmode", wmode);
}
//again, a useful ExternalInterface trick
swfObj.addVariable("allowedDomain", document.location.hostname);
//tell the SWF which HTML element it is in
swfObj.addVariable("elementID", swfID);
// set the name of the function to call when the swf has an event
swfObj.addVariable("eventHandler", "YAHOO.widget.FlashAdapter.eventHandler");
var container = YAHOO.util.Dom.get(containerID);
var result = swfObj.write(container);
if(result)
{
this._swf = YAHOO.util.Dom.get(swfID);
//if successful, let's add an owner property to the SWF reference
//this will allow the event handler to communicate with a YAHOO.widget.FlashAdapter
this._swf.owner = this;
}
else
{
YAHOO.log("Unable to load SWF " + swfURL);
}
},
swfObj.addParam(“allowScriptAccess”, “always”);//allowscriptaccess=always 允许随时执行脚本操作 使 Flash 应用程序可与其所在的 HTML 页通信
swfObj.addVariable(“allowedDomain”, document.location.hostname);//actionscript与JS的交