Posted by: Vaibhav Choudhary on: June 5, 2009
We are welcoming JavaFX 1.2 with tons of new feature. Noticeable once :
1. Control UI API
2. Chart API
3. Persistence and Storage
4. Speed Improvement
5. Yes, its for Linux and Solaris as well.
Details of it can be read at http://javafx.com. I will put here some codes for Chart API.
One of the most effective API’s got introduced into the Marina(JavaFX 1.2) release are Control and Chart API’s. As there are lot of questions on chart API, here is the small code for making some charts, it almost follow the same protocol with all chart API’s.
We can do hell lot of things with it. I have just used the default and shown how action() can be written on slices.
Source code : Here
Here goes the bubble chart, basic funda is same, insert the number array into BubbleChart.Data. Get all the Data into series and get that series into the Chart API. For more, please see the source Code.
More will be posted soon, or a jumbo one with all of it in one go ! You can download the latest SDK from here. Please let me know if there is any issue. Enjoy FX.
[...] JavaFX 1.2 + Chart API’s Posted June 5, 2009 [...]
Ah thanks ! No, first time when I started with chart API, I find it quite tough to use, so I decided to post some examples. Even I will post some more. After sometime I release it all logic written.
[...] Another link I found the other day to a blog posting by Vaibhav Choudhary on using the JavaFX 1.2 Charting APIs. [...]
On the pie chart sample, I get this error:
missing initial moveto in path definition
java.awt.geom.IllegalPathStateException: missing initial moveto in path definition
at java.awt.geom.Path2D$Float.needRoom(Path2D.java:280)
at java.awt.geom.Path2D$Float.lineTo(Path2D.java:350)
at sun.java2d.pisces.PiscesRenderingEngine$1.lineTo(PiscesRenderingEngine.java:99)
at sun.java2d.pisces.Stroker.emitLineTo(Stroker.java:740)
I’m using Ubuntu 9.04 x64 with:
OpenJDK Runtime Environment (IcedTea6 1.4.1) (6b14-1.4.1-0ubuntu10)
OpenJDK 64-Bit Server VM (build 14.0-b08, mixed mode)
Any ideas?
Hi vaibhav,
I’m getting this warning when i tried to run the pieChart code.Any idea on how to resolve this?
WARNING * WARNING * WARNING * WARNING * WARNING
An attempt has been made to add node to a new group without
first removing it from its current group. See the class
documentation for javafx.scene.Node for further information.
This request will be granted temporarily but it will
be refused in the future. Please change your code now.
node=Path oldgroup=Group newgroup=Group
Stack trace follows.
java.lang.IllegalArgumentException
at javafx.scene.Group$_SBECL.onChange(Group.fx:162)
at com.sun.javafx.runtime.location.SequenceVariable.notifyListeners(SequenceVariable.java:157)
at com.sun.javafx.runtime.location.SequenceVariable.setAsSequence(SequenceVariable.java:259)
at javafx.scene.chart.PieChart3D$1.lambda(PieChart3D.fx:86)
at javafx.scene.chart.PieChart3D$1.invoke(PieChart3D.fx:79)
at javafx.scene.chart.PieChart3D$1.invoke(PieChart3D.fx:79)
at javafx.scene.Node.impl_processMouseEvent(Node.fx:1683)
at javafx.scene.Node.preprocessMouseEvent(Node.fx:1705)
at javafx.scene.Scene$MouseHandler.process(Scene.fx:632)
at javafx.scene.Scene$MouseHandler.process(Scene.fx:550)
at javafx.scene.Scene.impl_processMouseEvent(Scene.fx:368)
at javafx.scene.Scene$ScenePeerListener.mouseEvent(Scene.fx:496)
at com.sun.javafx.tk.swing.SwingScene$SwingScenePanel.doMouseEvent(SwingScene.java:388)
at com.sun.javafx.tk.swing.SwingScene$SwingScenePanel.mouseMoved(SwingScene.java:416)
at java.awt.Component.processMouseMotionEvent(Unknown Source)
at javax.swing.JComponent.processMouseMotionEvent(Unknown Source)
at java.awt.Component.processEvent(Unknown Source)
at java.awt.Container.processEvent(Unknown Source)
at java.awt.Component.dispatchEventImpl(Unknown Source)
at java.awt.Container.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)
at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)
at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)
at java.awt.Container.dispatchEventImpl(Unknown Source)
at java.awt.Window.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(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)
yes, this exception will be solved in next release. This is a bad one !
2 | Mohamed Sanaulla
June 6, 2009 at 1:11 pm
This is what i was looking for- Some simple example! Thanks Vaibhav. Btw its different of u posting a simple sample