how to evaluate the data to open flash chart in my custom widget? [message #766092] |
Thu, 15 December 2011 08:18 |
David Song Messages: 217 Registered: April 2011 |
Senior Member |
|
|
hi all,
I am going to write a custom widget width the Open Flash Chart to display my chart graphic in my rap app. and as we know, ofc search the vars ofc and data-file in the web page, also the global scope javascript fucntion open_flash_chart_data() to fetch the chart data. I tried the vars ofc and data-file but them did not work, and I don't know how to evaluate the json chart data from the database to the function. I maped the swf and js files to the org.eclipse.rap.ui.resources point in the extentions tab in Plugin.xml. Some codes for Chart.js file are just like below,
qx.Class.define( "com.learn.rap.flashchart.Chart", {
extend : qx.ui.layout.CanvasLayout,
construct: function( id ) {
this.base( arguments );
this.setHtmlAttribute( "id", id );
this._id = id;
},
properties : {
chartData : {
init : "",
apply : "initChart"
}
},
members : {
_doActivate : function() {
var shell = null;
var parent = this.getParent();
while( shell == null && parent != null ) {
if( parent.classname == "org.eclipse.swt.widgets.Shell" ) {
shell = parent;
}
parent = parent.getParent();
}
if( shell != null ) {
shell.setActiveChild( this );
}
},
initChart : function() {
if (this.getChartData()) {
var t = "<object width=\"100%\" height=\"100%\">"+
"<param name=\"movie\" value=\"/com/learn/rap/flashchart/internal/chartkit/open-flash-chart.swf?&data-file="+
JSON.stringify(this.getChartData())+
"></param><embed width=\"100%\" height=\"100%\" type=\"application/x-shockwave-flash\" src=\"/com/learn/rap/flashchart/internal/chartkit/open-flash-chart.swf?data-file="+
JSON.stringify(this.getChartData())+
"></embed></object>";
document.getElementById(this._id).innerHTML = t;
}
}
}
});
by the way JSON can not run in IE.
Thanks a lot
David
|
|
|
Powered by
FUDForum. Page generated in 0.02022 seconds