Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Remote Application Platform (RAP) » how to evaluate the data to open flash chart in my custom widget?
how to evaluate the data to open flash chart in my custom widget? [message #766096] Thu, 15 December 2011 08:18 Go to next message
David Song is currently offline David SongFriend
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
Re: how to evaluate the data to open flash chart in my custom widget? [message #766186 is a reply to message #766096] Thu, 15 December 2011 10:35 Go to previous messageGo to next message
Tim Buschtoens is currently offline Tim BuschtoensFriend
Messages: 396
Registered: July 2009
Senior Member
Hi!

I'm not sure what exactly your question is, but some general pointers:

- In your usecase it seems to be a good idea to use the Browser-Widget
to create the custom widget. You can find examples here[1], here[2] and
here[3]. I strongly recommand it, as you dont't have to work with
qooxdoo then.

- If you need to have JSON support in IE, you can use json2.js[4].

- I have no knowledge about OFC, so depending on what exactly your
problem is, you may be asking in the wrong newsgroup.

Greetings,
Tim

[1] https://github.com/eclipsesource/rap-ckeditor/tree/simple
[2] https://github.com/tbuschto/rap-gmap
[3] https://github.com/eclipsesource/org.eclipse.rap.widget.carousel
[4] https://github.com/douglascrockford/JSON-js/blob/master/json2.js

Am 15.12.2011 09:18, schrieb micromms:
> 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
>
>
Re: how to evaluate the data to open flash chart in my custom widget? [message #766211 is a reply to message #766186] Thu, 15 December 2011 11:26 Go to previous message
David Song is currently offline David SongFriend
Messages: 217
Registered: April 2011
Senior Member
Is it possible to pass values from org.eclipse.ui.part.ViewPart to javascript?
or get the viewPart's variables from javascript?



Thanks Tim.

[Updated on: Thu, 15 December 2011 11:55]

Report message to a moderator

Previous Topic:how to evaluate the data to open flash chart in my custom widget?
Next Topic:HTTPS
Goto Forum:
  


Current Time: Tue Oct 19 07:06:47 GMT 2021

Powered by FUDForum. Page generated in 0.01636 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top