JFreechart in RCP: dynamic chart problems

A discussion forum for JFreeChart (a 2D chart library for the Java platform).
Locked
jinrf
Posts: 6
Joined: Thu Mar 22, 2007 10:28 am
Location: Beijing, China

JFreechart in RCP: dynamic chart problems

Post by jinrf » Wed Mar 28, 2007 3:45 pm

HI, all!
I read the topic about HOW TO USE JFREECHART IN RCP posted here, but seems all solution is create one CLASS, including some static member and method(like createPieChart(){...}...), but when it comes to dynamic chart, these kind of solution will face a problem: SWTException: Invalid Thread Access, because a non UI thread cannot modify the UI component,

SO, here's the question, is there any approach or example to solve this problem, which enable us to display dynamic chart in RCP project...
P.R.China, now working with the Grid Project(http://www.crown.org.cn/en/).

silent
Posts: 50
Joined: Wed Mar 16, 2005 2:55 pm
Location: Korea
Contact:

Post by silent » Thu Mar 29, 2007 2:51 am

use original jfreechart with SWT_AWT or experiment SWT jfreechart?
and if you use experiment SWT jfreechart then what is your eclipse version?

in general thread, for update swing graphics using

Code: Select all

SwingUtilities.invokeLater(new Runnable() { 
 public void run() { 
    add(item); 
 } 
});
and for update SWT graphics using

Code: Select all

Display.getCurrent().asyncExec(new Runnable(){ 
 public void run(){ 
    add(item); 
 } 
});
and see this http://www.jfree.org/phpBB2/viewtopic.php?t=20736
I think it is same problem issue.
Tokdo belongs to Korea.

Not a 'sea of japan', But a 'East Sea(Dong hae)'

jinrf
Posts: 6
Joined: Thu Mar 22, 2007 10:28 am
Location: Beijing, China

Post by jinrf » Thu Mar 29, 2007 4:59 am

Thank you so much I'm using
experiment SWT. And my eclipse version is 3.2.2, I tried your code below
silent wrote:use original jfreechart with SWT_AWT or experiment SWT jfreechart?
and if you use experiment SWT jfreechart then what is your eclipse version?

and for update SWT graphics using

Code: Select all

Display.getCurrent().asyncExec(new Runnable(){ 
 public void run(){ 
    add(item); 
 } 
});
and i still got NullPointerException...

Code: Select all

Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException
	at cn.org.crown.mymeter.charts.MemChart.addTotalObservation(MemChart.java:92)
	at cn.org.crown.mymeter.model.DataGenerator.actionPerformed(DataGenerator.java:24)
	at javax.swing.Timer.fireActionPerformed(Unknown Source)
	at javax.swing.Timer$DoPostEvent.run(Unknown Source)
	at java.awt.event.InvocationEvent.dispatch(Unknown Source)
	at java.awt.EventQueue.dispatchEvent(Unknown Source)
	at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
	at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
	at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
	at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
	at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
	at java.awt.EventDispatchThread.run(Unknown Source)
P.R.China, now working with the Grid Project(http://www.crown.org.cn/en/).

silent
Posts: 50
Joined: Wed Mar 16, 2005 2:55 pm
Location: Korea
Contact:

Post by silent » Fri Mar 30, 2007 5:35 am

Tokdo belongs to Korea.

Not a 'sea of japan', But a 'East Sea(Dong hae)'

raghavan_26
Posts: 59
Joined: Fri Oct 13, 2006 11:35 am
Contact:

chart in eclipse rcp

Post by raghavan_26 » Wed Apr 04, 2007 10:41 am

Go thorugh the link u will know how to get the chart in eclipse rcp View

http://www.jfree.org/phpBB2/viewtopic.p ... hlight=swt

by
raghavan

Locked