How to use XY chart of JFreeChart? Or any other choice?!

Like the title, THX!

import java.awt.*;
import java.text.*;
import javax.swing.*;
import org.jfree.chart.*;
import org.jfree.chart.axis.*;
import org.jfree.chart.labels.*;
import org.jfree.chart.plot.*;
import org.jfree.chart.plot.*;
import org.jfree.chart.renderer.xy.*;
import org.jfree.chart.title.*;
import org.jfree.data.time.*;
import org.jfree.data.xy.*;
import org.jfree.ui.*;
public class XYBarChartDemo1 extends ApplicationFrame{
    public XYBarChartDemo1(String s){
        super(s);
        IntervalXYDataset intervalxydataset = createDataset();
        JFreeChart jfreechart = createChart(intervalxydataset);
        ChartPanel chartpanel = new ChartPanel(jfreechart);
        chartpanel.setPreferredSize(new Dimension(500, 300));
        setContentPane(chartpanel);
    private static JFreeChart createChart(IntervalXYDataset intervalxydataset){
        JFreeChart jfreechart = ChartFactory.createXYBarChart("State Executions - USA", "Year", true, "Number of People", intervalxydataset, PlotOrientation.VERTICAL, true, false, false);
        jfreechart.addSubtitle(new TextTitle("Source: http://www.amnestyusa.org/abolish/listbyyear.do"));
        jfreechart.setBackgroundPaint(Color.white);
        XYPlot xyplot = jfreechart.getXYPlot();
        XYItemRenderer xyitemrenderer = xyplot.getRenderer();
        StandardXYToolTipGenerator standardxytooltipgenerator = new StandardXYToolTipGenerator("{1} = {2}", new SimpleDateFormat("yyyy"), new DecimalFormat("0"));
        xyitemrenderer.setToolTipGenerator(standardxytooltipgenerator);
        xyplot.setBackgroundPaint(Color.lightGray);
        xyplot.setRangeGridlinePaint(Color.white);
        DateAxis dateaxis = (DateAxis)xyplot.getDomainAxis();
        dateaxis.setTickMarkPosition(DateTickMarkPosition.MIDDLE);
        dateaxis.setLowerMargin(0.01D);
        dateaxis.setUpperMargin(0.01D);
        return jfreechart;
    private static IntervalXYDataset createDataset(){
        TimeSeries timeseries = new TimeSeries("Executions", "Year", "Count", org.jfree.data.time.Year.class);
        try{
            timeseries.add(new Year(1976), new Integer(0));
            timeseries.add(new Year(1977), new Integer(1));
            timeseries.add(new Year(1978), new Integer(0));
            timeseries.add(new Year(1979), new Integer(2));
            timeseries.add(new Year(1980), new Integer(0));
            timeseries.add(new Year(1981), new Integer(1));
            timeseries.add(new Year(1982), new Integer(2));
            timeseries.add(new Year(1983), new Integer(5));
            timeseries.add(new Year(1984), new Integer(21));
            timeseries.add(new Year(1985), new Integer(18));
            timeseries.add(new Year(1986), new Integer(18));
            timeseries.add(new Year(1987), new Integer(25));
            timeseries.add(new Year(1988), new Integer(11));
            timeseries.add(new Year(1989), new Integer(16));
            timeseries.add(new Year(1990), new Integer(23));
            timeseries.add(new Year(1991), new Integer(14));
            timeseries.add(new Year(1992), new Integer(31));
            timeseries.add(new Year(1993), new Integer(38));
            timeseries.add(new Year(1994), new Integer(31));
            timeseries.add(new Year(1995), new Integer(56));
            timeseries.add(new Year(1996), new Integer(45));
            timeseries.add(new Year(1997), new Integer(74));
            timeseries.add(new Year(1998), new Integer(68));
            timeseries.add(new Year(1999), new Integer(98));
            timeseries.add(new Year(2000), new Integer(85));
            timeseries.add(new Year(2001), new Integer(66));
            timeseries.add(new Year(2002), new Integer(71));
            timeseries.add(new Year(2003), new Integer(65));
        catch(Exception exception){
            System.err.println(exception.getMessage());
        TimeSeriesCollection timeseriescollection = new TimeSeriesCollection(timeseries);
        timeseriescollection.setDomainIsPointsInTime(false);
        return timeseriescollection;
    public static JPanel createDemoPanel(){
        return new ChartPanel(createChart(createDataset()));
    public static void main(String args[]){
        XYBarChartDemo1 xybarchartdemo1 = new XYBarChartDemo1("State Executions - USA");
        xybarchartdemo1.pack();
        RefineryUtilities.centerFrameOnScreen(xybarchartdemo1);
        xybarchartdemo1.setVisible(true);
}

Similar Messages

  • How to use the chart option in bex analyzer

    Hi Expert
    i want to know how to use the Chart in Bex Analyzer.
    Next week i hve End user Training. my user wanthow to use the chart option in Analyzer.
    plz let me know how to use chart & any Document on that plz reply me.
    Reagards
    siva
    Edited by: patel siva on Sep 16, 2008 4:34 PM

    Check here:
    https://reporting.uky.edu/BWBExContextMenu.pdf
    http://help.sap.com/saphelp_nw70/helpdata/EN/8b/4ffd9b07474279b3bbee75a60db41f/content.htm
    http://help.sap.com/erp2005_ehp_03/helpdata/EN/5b/30d43b0527a17be10000000a114084/frameset.htm
    Thanks..
    Shambhu

  • How to Use LABVIEW charts with Mathscript

    Hi,
       I recently tried to work on Mathscript and it is really amazing. what I tried to figure out is:
        Instead of plotting using traditional "plot" statement, how to use LabVIEW chart ( I know how to Add output but the graph were not as expected
    Is there any mean to get rid of this "Lengthy" delay that "ALL MATLAB User know" for first time compilation?
    Thanks in advance
    Waleed El-Badry MSc.,MCPD, ISTQB Certified Tester
    Assistant Lecturer
    Mechatronics Department
    Faculty of Engineering
    Misr University for Science & Technology

    Well Chris,
             I was about to post the solution, but as I said, I'm in a middle of experts
    It took me 3 hours to figure it out. I should've checked your answer . I resolved to the same suggesstion of yours. I only added some functionality to get the newbies like me being acquainting with how easy to work with LABVIEW mathscript based on MATLAB knowledge.
    Waleed El-Badry MSc.,MCPD, ISTQB Certified Tester
    Assistant Lecturer
    Mechatronics Department
    Faculty of Engineering
    Misr University for Science & Technology
    Attachments:
    Play with Mathscript.vi ‏35 KB

  • I am very new to mac products, I have a Mac Pro 13" I  need to learn how to use it ? looking video courses any will helpI

    I am very new to mac products, I have a Mac Pro 13" I  need to learn how to use it ? looking video courses any will help .....

    Go to www.apple.com for a start. See, also, Mac Basics.

  • I have a 60 inch Sony XBR TV that has DVI input but not HDMI. I am using an adapter to get the video from my Apple TV, but the screen flashes a lot. Do I have any other choices other than buying a new TV?

    I have a 60 inch Sony XBR TV that has DVI input but not HDMI. I am using an adapter to get the video from my Apple TV to the Sony, but the screen flashes a lot. Do I have any other choices other than buying a new TV?

    Is this an iphone question?
    You have posted in the iphone forum.

  • When trying to upload a PDF to an interactive site I get the announcement:"The attached PDF file references a non-embedded font Tahoma. Please remove file, embed the font and reattach." How do I embed this, or in fact any other font ?

    When trying to upload a PDF to an interactive site I get the announcement: "The attached PDF file references a non-embedded font Tahoma. Please remove file, embed the font and reattach."
    I could not get rid of the Tahoma font in the WORD file.
    How do I embed this, or in fact any other font ?

    Thank you very much !
    Indeed, I was unaware of the enormous number of options that can be selected when converting a WORD file to PDF.
    I went thru the settings and found the right one for embedding the fonts.
    Thanks again !
    Oren

  • If I buy contract free iPhone 6 from T-Mobile in USA, will I be able to use that phone in India with any other provider?

    If I buy contract free iPhone 6 from T-Mobile in USA, will I be able to use that phone in India with any other provider?

    Yes!! the contract free mean that it's GSM+CDMA so you can use it all over the world

  • Photoshop elements quit working, I uninstalled it, tried to re-install using the cd, but getting errorPhotoshop elements quit working, I uninstalled it, tried to re-install using the cd, but getting error, any other way to re-install it without the disk ?

    Photoshop elements quit working, I uninstalled it, tried to re-install using the cd, but getting error, any other way to re-install it without the disk ?

    Yes.
    Download Photoshop Elements products | 13, 12, 11, 10
    However, the real issue is why the program is not working. Did you install anything recently?
    When you tried to re-install from the disk, did you shut off the antivirus program temporarily?
    Have you tried a system restore to a point in time when the program was working properly?

  • How to use Google Chart in OBIEE

    Hi Experts,
    How we can use google chart in OBIEE 10g or OBIEE 11g.
    Thanks

    Hi ,
    If you refer to Google Maps then refer the following link.
    http://obiee101.blogspot.in/search?q=google
    Google organization Chart
    Oracle Business Intelligence by Sandeep Venu: Google Organization Chart in OBIEE 11G
    Google Chart
    Oracle BI Solutions: OBIEE - Google Charts
    Thanks,
    Pavani

  • How to use waveform chart for slow data

    For slow data acquisition (e.g. 1 sample / sec) in the case of using DMM, how to display those data in a chart / graph?
    For this sampling rate, there will be only 1 point in the chart. 
    How to buffer them and display them in a sequence?
    Or, any other method?
    thanks

    Here is a quick example showing chart, graph and XY graph.  All YOU need to do is use a chart and wire your DMM reading right to it.  Charts have their own built in history (you can change the buffer size by right-clicking > Chart History Length)
    For more info see the Examples...  Building User Interfaces > Displaying Data > Graphs and Charts
    Using LabVIEW: 7.1.1, 8.5.1 & 2013
    Attachments:
    MultiGraphs.vi ‏17 KB

  • How to use Gannt Chart

    Hi all. I have a requirement to make an application using Gannt chart to display the status through time in daysu2026
    In me application I have embed tree in table and each row consists of project task and its subtask. And this shud display its start and end date through Gannt chart in calendar format...Well I have tried to use BussinessGraphics using Gannt Chart type in that but clearly not able to configure or use this Gannt chart to meet my needs for start and end date for each row in the tableu2026
    If anybody knows detail / proper setting to use Gannt chart of BusssinessGraphics plz share with me...
    Anxiously waiting for reply..
    Thanx in advance.
    Regards:
    Hanif.

    Hi Hanif,
    Look at the following threads :
    Re: IWDTable
    Re: Using IGS Gantt Chart from Web Dynpro?
    These may help you.
    Regards.
    Rajat

  • When/How to use - "search" parameter type in parameter like other types.

    We recently upgraded BI Publisher to 10.1.3.4. I saw new parameter type "search" in parameter section, when creating report. whats the use of it? How to use it ? like other parameter type Text, Menu,Hidden, Date.
    I couldn't find any help or release notes on this !
    Thanks
    Ayaps

    I started looking into this parameter type when our drop-down for customer numbers went from 13,000 (manageable) to 45,000 (completely unmanageable).
    I imagine this is supposed to mimic the effects of a "Long List" type LOV in Oracle Applications (as I had inquired about in [this thread|http://forums.oracle.com/forums/thread.jspa?threadID=895521&stqc=true|Large List of Values (LoV) hangs. Is there an equivalent for a long list?]), but performance-wise, "Search" does not seem to be any more efficient that using the "Menu" type LOV. Even with the help of having a partial string with a wildcard to match, the "Search" still takes too long to pull up to be of any use to us.

  • How to use OEM grid control to find any database not in archivelog mode?

    Hello,
    currently we have 130 databases, say, if I want to pick out any database currently NOT in archivelog mode, is there a quick way to find out ?
    by using OEM grid control
    or
    some trick similar,
    but really don't need to check each database manually.
    thank you very much!

    This query works in 12c - please run as SYSMAN.
    It is based on undocumented assumptions though +( AND key_value = 'NOARCHIVELOG')+.
      SELECT *
      FROM SYSMAN.MGMT$GROUP_DERIVED_MEMBERSHIPS O ,
        SYSMAN.MGMT$TARGET T ,
        sysman.MGMT$AVAILABILITY_CURRENT st
      WHERE
      o.member_target_type     IN ('oracle_database', 'rac_database')
      AND ( t.target_type           ='rac_database'
      OR (t.target_type             ='oracle_database'
      AND t.type_qualifier3        != 'RACINST'))
      AND o. member_target_guid     = t.target_guid
      AND t.target_guid             = st.target_guid
      AND st.availability_status    = 'Target Up'
      AND ( EXISTS
        (SELECT *
        FROM sysman.mgmt$metric_current i
        WHERE I.TARGET_GUID = O.MEMBER_TARGET_GUID
        AND metric_name     = 'archFull'
        AND Metric_Column   = 'archTotal'
        AND metric_label    = 'Archive Area'
        AND column_label    = 'Total Archive Area (KB)'
        AND key_value       = 'NOARCHIVELOG'
        ));Another way to achieve the goal is to push extended metrics (SELECT LOG_MODE FROM V$DATABASE) on each DB, and monitor the values they return to the repository. This is an example for a (slightly) different problem - http://iiotzov.wordpress.com/2012/08/08/how-to-use-the-new-oem-12c-metric-extensions-to-enforce-enterprise-wide-custom-policies .
    OEM Repository has many other great uses as well - http://iiotzov.files.wordpress.com/2012/05/oem-repository-a-second-look.doc , http://iiotzov.files.wordpress.com/2011/08/iotzov_oem_repository.pdf
    Iordan Iotzov
    http://iiotzov.wordpress.com/

  • How to use MRP for generate PO? any samlpe?

    I want to know how to using the MRP for generate purchase order.
    have any documents for showing the steps by using MRP?
    Thanks.
    On

    MRP will generate Order Recommendation only, not actual PO.  You may need to learn general knowledge about MRP first before actually run the MRP Wizard.  Actually, if you have clear knowledge about what MRP covers, many steps have self explained well on the online help.
    Thanks,
    Gordon

  • How to use AET in a system without any masterdata?

    Hello,
    we know how to use the AET in general.
    But we have a developmentsystem where it is not allowed to create masterdata or documents.
    Therefore it is not possible in this system to open for example an existing customer in WebU and enhance a new field to BP_HEAD\details for example.
    Is there a way to use the AET without having master data available in the dev-system?
    Thank you.
    Kind regards
    Manfred

    Hi,
    thank you for this very helpfull answer.
    This works for the most components like BP_HEAD.
    It does for some reason not work for component ERP_H.
    "Exception during toolbar processing".
    The component is displayed but without buttons - also no configuration button for AET.
    Any ideas.
    Kind regards
    Manfred

Maybe you are looking for

  • I am having many problems with the CC 2014 application manager update

    I have 2 seats. Thus I have CC 2014 installed on four computers. All four are high end desktops with Windows 7 Ultimate 64 bit installed, all four with the latest patches. All four also use high end nvidia graphics cards all with the latest drivers.

  • 1st Generation Ipod Touch 32GB

    I have a 32gb 1st generation Ipod Touch. It was a gift purchased at the Navy Exchange(military store). The sound has gone out. I can no longer hear any music. Is it worth trading in for a new one at bestbuy? Or can the sound be fixed. Everytime I pla

  • Txt message notification

    a cross between question/comment/complaint... on my alias 2 i was able to assign a ringtone to all txt messages Q.  why can't this be done on my new Samsung Galaxy Note ll under the message setting I can select notification setting with a ck mark and

  • Current date as default value in scaffolding

    I added a datefield to scaffolding and I'd like to populate it with a default value set to current date.  How can I do that?

  • Error when  importing xml data

    I am getting the following error when loading xml datafile to my Oracle XE database table. This data I exported from htmldb.oracle.com. ORA-31011: XML parsing failed ORA-19202: Error occurred in XML processing LPX-00222: error received from SAX callb