File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Swing / AWT / SWT and the fly likes Interactive Charts Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Interactive Charts" Watch "Interactive Charts" New topic
Author

Interactive Charts

J Fae
Greenhorn

Joined: Oct 10, 2011
Posts: 6
Hellow!

Do you know about any library that has built in funcitions for interactive charts in Swing/AWT.
Something like a "drag-drop" line chart. So that user can change the graph dynamically.

Or an idea how to do that in Java.

Tnx.
Jeremy Wilson
Ranch Hand

Joined: Feb 18, 2003
Posts: 166
have you checked out JFreeChart


Jeremy Wilson
J Fae
Greenhorn

Joined: Oct 10, 2011
Posts: 6
yes, but the graphs are not "clickable"
Tim Moores
Rancher

Joined: Sep 21, 2011
Posts: 2408
... by which you mean what, exactly?
J Fae
Greenhorn

Joined: Oct 10, 2011
Posts: 6


At first you have blue, than by clicking on an dragging, you could change it
Tim Moores
Rancher

Joined: Sep 21, 2011
Posts: 2408
JFreeChart comes with a subclass of JPanel (called ChartPanel if memory serves); that might be extendable to do this.
J Fae
Greenhorn

Joined: Oct 10, 2011
Posts: 6
final XYSeries series = new XYSeries("XYGraph");
series.add(1, 1);
series.add(1, 2);
series.add(2, 1);
series.add(3, 9);
series.add(4, 10);
...

panel.addChartMouseListener(new ChartMouseListener() {

@Override
public void chartMouseMoved(ChartMouseEvent arg0) {


}

@Override
public void chartMouseClicked(ChartMouseEvent arg0) {
// TODO Get location where user clicked and add coordination to data
// series.add(new Random().nextInt(10), new Random().nextInt(10));

//Returns the underlying mouse event (never null) that triggered the generation of this event.
//This contains information about the mouse location, among other things.
System.out.println("point:"+arg0.getTrigger().getPoint()); //<--doesnt help to identify the location of chart line



}
});
Ranganathan Kaliyur Mannar
Bartender

Joined: Oct 16, 2003
Posts: 1076
    
  10

The ChartMouseEvent object has a method getEntity() which in this case returns an instance of 'XYItemEntity'. This class has methods like getSeries() and getItem() which gives back the data about which item on which series was clicked.


Ranga.
SCJP 1.4, OCMJEA/SCEA 5.0.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Interactive Charts
 
Similar Threads
how to install extra packages to JDK?
Real time javascript web charts
Interactive charts for website
charts
The chart problem