Latest Tutorials| Questions and Answers|Ask Questions?|Site Map



Home Answers Viewqa JSP-Servlet chartMouseClicked(ChartMouseEvent event)

Have Programming Question? Ask it here!
 
 
 


latha
chartMouseClicked(ChartMouseEvent event)
1 Answer(s)      3 years and 6 months ago
Posted in : JSP-Servlet


Hi deepak ihave draw a piechart using jfreechart with tooltip.Now i need click event (chartMouseClicked(ChartMouseEvent event)) in this chart. can u help me plz....


Advertisement
View Answers

February 18, 2011 at 3:40 PM


Java JFreechart MouseEvent

import java.awt.*;
import javax.swing.*;
import org.jfree.ui.*;
import org.jfree.chart.*;
import org.jfree.chart.plot.*;
import org.jfree.data.general.*;
import org.jfree.chart.entity.*;

public class PieChart extends ApplicationFrame implements ChartMouseListener {
private JFreeChart chart; 
private PiePlot plot;
private int angle=270;
private static double explodePercent = 0.99;
private static long count=0;

public PieChart(String title){
    super(title);
        this.chart = ChartFactory.createPieChart("Pie Chart Demo",createDataset(),  true,  true, false);
        this.plot = (PiePlot) chart.getPlot();
        this.plot.setSectionOutlinesVisible(false);
        this.plot.setNoDataMessage("No data available");
        this.plot.setBackgroundAlpha(0.2f);
        this.plot.setBackgroundPaint(Color.WHITE); 
        this.angle=270;
        ChartPanel chartpanel = new ChartPanel(chart, false, false, false, false, false);   
        chartpanel.setVisible(true);
        chartpanel.addChartMouseListener(this);
        chartpanel.setPreferredSize(new Dimension(500, 270));
        setContentPane(chartpanel);
}
private static PieDataset createDataset() {
    DefaultPieDataset dataset = new DefaultPieDataset();
    dataset.setValue("One", new Double(10.0));
    dataset.setValue("Two", new Double(20.0));
    dataset.setValue("Three", new Double(30.0));
    dataset.setValue("Four", new Double(40.0));
    dataset.setValue("Five", new Double(10.0));
    return dataset;
}
private static JFreeChart createChart(PieDataset dataset) {

    JFreeChart chart = ChartFactory.createPieChart3D("Pie Chart Demo",dataset, true, true,false);

    PiePlot plot = (PiePlot) chart.getPlot();
    plot.setSectionOutlinesVisible(false);
    plot.setNoDataMessage("No data available");
    plot.setBackgroundAlpha(0.2f);
    return chart;
}
public static JPanel createDemoPanel() {
    JFreeChart chart = createChart(createDataset());
    ChartPanel chartpanel = new ChartPanel(chart, false, false, false, false, false);   
    chartpanel.setVisible(true);      
    chartpanel.setPreferredSize(new Dimension(500, 270));
    return new JPanel();
}
public static void main(String[] args) {
    PieChart demo = new PieChart("Pie Chart");
    demo.pack();
    RefineryUtilities.centerFrameOnScreen(demo);
    demo.setVisible(true);
}
public void chartMouseClicked(ChartMouseEvent chartmouseevent){
ChartEntity chartentity = chartmouseevent.getEntity();
if (chartentity != null){
   System.out.println("Mouse clicked: " + chartentity.toString());
}
else
System.out.println("Mouse clicked: null entity.");
}

public void chartMouseMoved(ChartMouseEvent chartmouseevent){
}
}


Related Tutorials/Questions & Answers:
chartMouseClicked(ChartMouseEvent event)
chartMouseClicked(ChartMouseEvent event)  Hi deepak ihave draw a piechart using jfreechart with tooltip.Now i need click event (chartMouseClicked(ChartMouseEvent event)) in this chart. can u help me plz
event handling
event handling  diff btwn event handling in ASP.net and in HTML
Advertisements
Event management
Event management   Hi, I want event management application like maintaining email notifications while task creation and update in broader way using spring java
Event in flex
Event in flex  Hi..... can you tell me about that How do you make component participate in event mechanism? Thanks   Ans: Extend EventDispatcher or any subclass of it or implement IEventDispatcher
Flex event
Flex event  Hi.... please tell me about How does Flex event system works? Thanks  Ans: When event are triggered there are three...: In the capturing phase, Flex examines an event target?s ancestors in the display list to see
Event in flex
Event in flex  Hi..... I want to know about What does calling preventDefault() on an event do? How is this enforced? please give me an example for that Thanks   Ans: The methods of the Event class can be used
Flex event
Flex event  hi...... How to capture and event if the component is disabled? please give an example..... Thanks in advance
Flex event
Flex event  Hi.... Please tell me about How to create your own event in flex? Thanks
Flex event
Flex event  Hi... please give me the answer with example What is event Bubbling? Thanks in advance  Event Bubbling: In the bubbling phase, Flex examines an event?s ancestors for event listeners. Flex starts
Click event
Click event  hi............ how to put a click event on a particular image, so that it can allow to open another form or allow to display result in tabular form????????/ can u tell me how to do that????????/ using java swings
Event helpers
Event helpers       Event helpers As we all know events are actions or occurrences detected by a program. And event handlers are methods which handles
handling Button Event in iphone
handling Button Event in iphone  handling Button Event in iphone
How to Handle Event Handlers?
How to Handle Event Handlers?  How to Handle Event Handlers
Java event handling
Java event handling  What event results from the clicking of a button
Java event delegation model
Java event delegation model  What is the highest-level event class of the event-delegation model
Java event-listener
Java event-listener  What is the relationship between an event-listener interface and an event-adapter class
Event listener in JavaScript with example
Event listener in JavaScript with example  What is event listener in JavaScript? Can anyone please post an example of Event listener?? Thanks in Advance
Event handling on an image
Event handling on an image  I want to divide an image into frames and want to do event handling on the frames
Java event handling
Java event handling  Which java.util classes and interfaces support event handling
Java event-delegation model
Java event-delegation model  What is the advantage of the event-delegation model over the earlier eventinheritance model
delegation event model
delegation event model  What is delegation event model?   delegation event model In the event-delegation model, specific objects are designated as event handlers for GUI components. These objects implement event
event calendar sample
event calendar sample  creating a event calendar for my small app in PHP.. can any one explain about it's design with example php event calendar script
Java AWT event hierarchy
Java AWT event hierarchy  What class is the top of the AWT event hierarchy?  The java.awt.AWTEvent class is the highest-level class in the AWT event-class hierarchy
Java event handling
Java event handling  What is the purpose of the enableEvents() method
event tracking code
event tracking code  a javascript written that will help us to track sitewide, even tracking in Google Analytics
Event listeners in mxml
Event listeners in mxml  hi.. just tell me about How do you add event listeners in mxml components. Now AS3 components? Please give... for add a event listner in flex using action script. 1. addEventListener(type:String
javascript event handling examples
javascript event handling examples  javascript event handling examples   var handleClick = function(e) { // Older IEs set the `event... event listeners. document.attachEvent('onclick', handleClick); } else
KEY EVENT HANDLING
KEY EVENT HANDLING  I am trying to write a program that receives every key stroke even when the window is not active or it's minimized. Is there anyway to do
jquery href onclick event
jquery href onclick event  jquery href onclick event   $('a').click(function (event) { event.preventDefault(); //here you can also do all sort of things });   <script type="text/javascript
onmouseover event in jsf
onmouseover event in jsf  hello friends, I am in the middle of the project, I have a requirement in my project. I am using jsf ,spring, hibernate... want to dispaly the list of some documents by using onmouseover event in jsf
iphone button click event
iphone button click event  Hi, How to write iphone button click event? Thanks   Hi, Here the method declaration: -(IBAction) myMetod:(id) sender; and implementations is: -(IBAction) myMetod:(id) sender
JQuery date change event
JQuery date change event  JQuery date change event I have been designing a date form in HTML and JQuery, wher i need two different date vales start date and end date for any event. I have already writen a function that allows
uibutton touch up event
uibutton touch up event   UIButton event "Touch up inside" under Gesture is not working in my app ..   [button addTarget:self action:@selector(BtnPressed:) forControlEvents:UIControlEventTouchUpInside];   
event handling in jsp
event handling in jsp  i am developing a web application. i am getting a problem in event handing in jsp. in this web application there is a file... to generate event on each row of retrieved row from the database
Need an Example of calendar event in java
Need an Example of calendar event in java  can somebody give me an example of calendar event of java
mouse event - Java Beginners
=getContentPane(); setLayout(new FlowLayout()); setTitle("Mouse Event... Event"); f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); f.add(btnClose
calling setInterval() on onclick event
calling setInterval() on onclick event  Hi all, I am trying to call setInterval() on onclick event. But it is executing the code only once. Following is my code. <script type="text/javascript" language="javascript">
The Window Event - Swing AWT
void actionPerformed(ActionEvent event) { } public static void
Event handling - Java Beginners
Event handling  Hi, This is a similar kind of question i had asked before, with a little difference. Two JCombobox and a JtextField. When I select an Item from the first Combo(i.e.,Select,First,Second or Third),the set
JQuery-event working new element
JQuery-event working new element  I want to know- why not an event(in JQuery) works on my created element through jQuery
Text event in jsp
Text event in jsp  Hi I am doing project in jsp with mysql as database.My quens is ,in my webform when I enter value (numeric) in 1st textbox then remaing below textbox must be fill with value that coming from database. So
Event Handling - Java Beginners
Event Handling  import javax.swing.*; import java.awt.*; import java.awt.event.*; public class Calculator extends JFrame { JLabel lblNumber=new JLabel("Number"); JLabel lblSquareRoot=new JLabel("Square Root
JavaScript onkeypress event
JavaScript onkeypress event...; This section illustrates you the use of onkeypress event in JavaScript... the onkeypress event. It occurs when a keyboard key is pressed or held down. Here is the code
JavaScript Key Event
JavaScript onkeyup Event...; This section illustrates you the use of onkeyup event in JavaScript. In the given... by using the onkeyup event. It occurs when a keyboard key is released. Following
JavaScript onkeyup event
JavaScript onkeyup event This section illustrates you the onkeyup event. It occurs when the user releases a key from its depressed position. Here we have created two textboxes. As the user user enter the text in first textbox, the same
Hibernate Event System
Hibernate Event System In this tutorial you will learn about the Event system in Hibernate. As concerned to Event it can be said that Event has replace.... Hibernate 4 event architecture allows to work with the particular events
Using the jQuery event object
Using the jQuery event object       Using the jQuery event object JQuery has a event system which follows the w3c standards. According
java swing button click event
java swing button click event  java swing button click event   public void doClick()   Java Swing Tutorials
Event Adapters
Event Adapters       There are some event listeners that have multiple methods to implement. That is some of the listener interfaces contain more than one method. For instance
jQuery change event
jQuery change event In this tutorial , we will discuss about 'change' event of jQuery. In given below example ,the change event is fired when there is change in the element (on which event is set).When the second option
Advertisements
 

 

 

DMCA.com