How to create a bar chart in java

hi,
i want to draw a bar chart in a java application can anybody suggest any package with all sufficient information to draw a chart
manish

using jfreechart, the code will be like this:
    public ChartPanel BarReport( int month, int year, String typeBarChart ) {
        JFreeChart chart1;
        DefaultCategoryDataset dataset = new DefaultCategoryDataset();
        dataset.setValue( 5, "Value", "Kobe Bryant" );
        dataset.setValue( 6, "Profit", "Kobe Bryant" );
        dataset.setValue( 9, "Value", "Paolo Maldini" );
        dataset.setValue( 7, "Profit", "Paolo Maldini" );
        dataset.setValue( 10, "Value", "Thierry Henry" );
        dataset.setValue( 8, "Profit", "Thierry Henry" );
        dataset.setValue( 9, "Value", "Maradona" );
        dataset.setValue( 5, "Profit", "Maradona" );
        dataset.setValue( 3, "Value", "Beckham" );
        dataset.setValue( 12, "Profit", "Beckham" );
        chart1 = ChartFactory.createBarChart3D( "Comparison between Salesman",
                "Salesman", "Achievement", dataset, PlotOrientation.VERTICAL,
                true, true, false );
        ChartPanel panel1 = new ChartPanel( chart1 );
        return panel1;
    }

Similar Messages

  • How to create stack bar chart on answers that shows % and counts?

    Hello guys
    I currently have a table that have several columns, each column represent one product name, and one column name "units" indicating how each product is sold...
    The requirement is to create a chart view with stack bar that shows the percentage of each product''s unit sales.
    Now we are discussing whether we should customize the table to consolidate all these product columns into one "product desc" column with all the product names as row in order to fulfill this requirement..
    PLease let me know whether this is needed or not... ALso, how would I be able to create stack bar charts that shows the total sales against each product sales in percentage and counts?
    Please let me know, I really appreciate it

    I tried to do this and was a bit successful. I used the paint catalog. Created a a request with 6 columns assuming units and dollars be stacked and Year ago units to be a line:
    Brand Units Dollars 0 Year_Ago_units 1
    Added a new request (Combined with similar request and selected paint subject area): Now in this request my columns are:
    Brand 0 0 Year_Ago_Dollars Year_Ago_units 2
    Assuming Year_Ago_Dollars be standard in your case.
    Created a chart view with brand and 1 on x axis and Units, Dollars, Year_Ago_Dollars on y axis and line as Year_Ago_units.
    Now able to see what I am expecting. May be you need to tweak a bit more according to your requirement.
    Let me know if this is of any help!
    Thanks.
    Edited by: Venkata on Sep 30, 2010 12:11 PM

  • How to create progress bar in web page!!!

    Dear,
    I do not know how to create progress bar in web page?
    Please show me the way to solve it.
    Best regards,
    Huy

    God your lucky/lazy
    import java.awt.*;
    import java.awt.event.*;
    import java.applet.*;
    import javax.swing.*;
    import java.util.*;
    import java.io.*;
    public class ProgressBar extends Applet
      private boolean isStandalone = false;
      private int width;
      private int height;
      private double percentComplete;
      private double fundsTarget;
      private double fundsRaised;
      private Properties values;
      private String propertiesFile;
      private JPanel jPanel1 = new JPanel();
      private JProgressBar PB_FUNDS_PROGRESS = new JProgressBar();
      private GridLayout gridLayout1 = new GridLayout();
      private BorderLayout borderLayout1 = new BorderLayout();
      private JPanel jPanel2 = new JPanel();
      private JLabel jLabel1 = new JLabel();
      private JLabel jLabel2 = new JLabel();
      private JLabel jLabel3 = new JLabel();
      private GridBagLayout gridBagLayout1 = new GridBagLayout();
      private JPanel jPanel3 = new JPanel();
      private JLabel jLabel4 = new JLabel();
      //Construct the applet
      public ProgressBar()
      //Initialize the applet
      public void init()
        try
          jbInit();
        catch(Exception e)
          e.printStackTrace();
      //Component initialization
      private void jbInit()
      throws Exception
        fundsTarget = new Double( 100 ).doubleValue();
        fundsRaised = new Double( 50 ).doubleValue();
        PB_FUNDS_PROGRESS.setBackground(Color.green);
        PB_FUNDS_PROGRESS.setForeground(Color.red);
        this.setLayout(gridLayout1);
        jPanel1.setLayout(borderLayout1);
        jPanel2.setLayout(gridBagLayout1);
        jPanel1.setBackground(Color.white);
        jPanel2.setBackground(Color.white);
        jPanel3.setBackground(Color.white);
        jLabel2.setBackground(Color.white);
        jLabel1.setBackground(Color.white);
        jLabel3.setBackground(Color.white);
        jLabel4.setText(" ");
        jLabel1.setText(" ");
        jLabel2.setText(" ");
        jLabel3.setText(" ");
        this.setBackground(Color.white);
        this.add(jPanel1, null);
        jPanel1.add(PB_FUNDS_PROGRESS,  BorderLayout.CENTER);
        jPanel1.add(jPanel2, BorderLayout.SOUTH);
        jPanel2.add(jLabel2, new GridBagConstraints(1, 0, 1, 1, 0.0, 0.0,
         GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(5, 0, 5, 0), 0, 0));
        jPanel2.add(jLabel1, new GridBagConstraints(2, 0, 1, 1, 0.0, 0.0,
         GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(5, 150, 5, 5), 0, 0));
        jPanel2.add(jLabel3, new GridBagConstraints(0, 0, 1, 1, 0.0, 0.0,
         GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(6, 5, 4, 150), 0, 0));
        jPanel1.add(jPanel3, BorderLayout.NORTH);
        jPanel3.add(jLabel4, null);
        propertiesFile = this.getCodeBase().getFile().replaceAll("%20", " ")+"funds.properties";
        System.out.println("Properties file at " + propertiesFile);
        values = new Properties();
        try
          values.load(new FileInputStream(propertiesFile));
          fundsTarget = new Double( values.getProperty("TARGET", "100").toString() ).doubleValue();
          fundsRaised = new Double( values.getProperty("RAISED", "50").toString() ).doubleValue();
          System.out.println("target: " + fundsTarget + " raised: " + fundsRaised);
        catch (IOException ioe)
          System.err.println(ioe.getMessage());
        percentComplete = (fundsRaised/fundsTarget)*100;
        System.out.println(percentComplete);
      //Start the applet
      public void start()
        PB_FUNDS_PROGRESS.setMaximum(new Double(fundsTarget).intValue());
        PB_FUNDS_PROGRESS.setMinimum(0);
        repaint();
      //Stop the applet
      public void stop()
      public void paint(Graphics g)
        Graphics2D g2 = (Graphics2D)g;
        PB_FUNDS_PROGRESS.setValue(new Double(fundsRaised).intValue());
        String percent = Double.toString(percentComplete).substring(0, 4);
        jLabel4.setText("Currently At " + percent + "%");
        jLabel1.setText("100%");
        jLabel2.setText("50%");
        jLabel3.setText("0%");
      //Destroy the applet
      public void destroy()
      public String getAppletInfo()
        return "Funds progress applet by A really nice person";
    }

  • How to create the custom charts?

    how to create a custom charts? for example the donut shapes, but for the data can be automatically adjust (like a available charts on keynote)

    Keynote and Numbers do not have a tool for making Donut Graphs. There are ways to make them using HTML, but I prefer to cheat:
    1 Create your first graph as a pie chart and add a circle of solid color to the center
    2. If you need more, take a screenshot of the pie chart with the center fill  and drag the screenshot into Preview - in Preview > Select Tool (pulldown from Toolbar) > Instant Alpha and remove the inner filled circle and outer fill then Save As > PNG with Alpha
    3. Drag your new hollow shape into Keynote. This chart can be placed over another pie chart with a filled center (the fill should match the background)
    Not as graceful as a special tool but can get the job done quickly - changing the data requires starting it over since at least one of your donuts my be an image rather than a pie chart with variable data.
    Try it. If you need more specific tools, Google Donut Shaped Charts for starts.
    Good luck

  • How to create a "Explorer" like in java

    i'm just wonderin if there's a way on how to create "Windows Explorer" like in Java wherein you can view all your directories with yellow folder icon and also you can view all your files and drives....
    And when you double click the yellow folder icon it will then expand and will show all the subfolders and files ...
    How????
    Thanks!

    Yes, there is a way. Look up JTree in the API.-can you post some code.... i cant figure out on how to use JTree...
    i'm still confused on where will i get the entire directories of my drives...
    thanks

  • How to create a Batch file for java application  ?

    HI,
    How to create a Batch file for java application ?
    And whats the use of creating batch file ?
    Thanks in advance

    [http://static.springsource.org/spring-batch/]
    Assuming you want to develop a batch application rather than actually just create a .bat file ..

  • HOw to create a Batch file for java application and whats the use of this ?

    HI,
    How to create a Batch file for java application ?
    And whats the use of creating batch file ?
    Thanks in advance

    First of all, you're OT.
    Second, you can find this everywhere in the net.
    If you got a manifest declaring main class (an classpath if needed), just create a file named whatever.bat, within same directory of jar file, containing:
    javaw -jar ./WhateverTheNameOfYourJarIs.jar %*By the way, assuming a Windows OS, you can just double click the jar file (no batch is needed).
    Otherwise use:
    javaw -cp listOfJarsAndDirectoriesSeparedBySemiColon country/company/application/package/className %*Where 'country/company/application/package/' just stands for a package path using '/' as separator instead of '.'
    Don't specify the .class extension.
    Javaw only works on Windows (you asked for batch, I assumed .BAT, no .sh), in Linux please use java.exe (path may be needed, Windows doesn't need it 'cause java's executables are copied to system32 folder in order to be always available, see PATH environment variable if you don't know what I'm talking about) and use ':' as classpath (cp) separator.
    The '%***' tail is there in order to pass all parameters, it only works on Windows, refer to your shell docs for other OSs (something like $* may work).
    This way you have a command you can call to launch your code (instead of opening NetBeans just to see your app working). You could schedule tasks on it or just call it in any command prompt (hope you know what it is 'cause there have been people in this very same forum with no clue about it, if not just hold the 'Windows button' and press 'R', then type 'cmd' and run it).
    Finally add dukes and give 'hem away.
    Bye.

  • Adobe premiere elements 12 - how to create menu bar action for my inserted image button

    adobe premiere elements 12 - how to create menu bar action for my inserted image button without using their movie menu theme

    forbemag
    I do not think that I am completely focused into this completely, so let us see if the following is going to help.
    You are going to need a base for your button. When you mention "image" button, I am assuming that you are using that term to differentiate between a text button and a thumbnail type button.
    The menus (main and scene) take their origin in .psd files on the hard drive and strict nomenclature and structure for Layers Palatte. And, the buttons on the menus trace back to the menu markers on the Timeline, main menu marker and order of placement of scene markers. The scene thumbnail will only appear when there is a scene marker on the Timeline to which it.
    In view of all that
    Where have you already inserted this "image (button)"...into the Layers Palette of a Photoshop document or other? Is this "image (button)" in a structured Layer Group in the Layers Palette with sublayer groups, text layers, graphic/background layer"?
    Let me give you an example
    If you have a button (with thumbnail) on the main menu and you want that to open to a specific scene in your movie, then you use a main menu marker on the Timeline at the spot that you want that button to target.
    If I am getting closer to what you seek, then please further clarify the DVD navigational envisioned scheme.
    Thanks.
    ATR
    Add On...I did not see the exchanges between us and SG until after I had posted mine. I thought that your discussions were concluded. Please excuse the interruption.

  • How to create the exe file for java project.

    How to create the exe file for java project.
    am done the project in java swing , i like to create the project in exe format, so any one help for me,
    send the procedure for that.
    thanking u.

    How to create the exe file for java project.Have you ever heard of google? I pasted your exact "question" into a google search:
    http://www.google.com/search?q=How+to+create+the+exe+file+for+java+project.
    and got several useful links.
    Better search terms might yield even better results.
    Sheesh.

  • How to create a  schedule program in java

    Hello Friends ,
    Can any one provide me with an example how to create a schedule program using java.util.timer etc . I am in need of a program which should run as a schedule job that searches for a file in a directory and read the latest files from that directory in every minute of time as a schedule job .
    Thanks
    mahesh

    I don't feel like writing my own example, but google will be happy to provide you with an example.

  • How to create WorkBook and Chart

    Hi Experts,
    Good Morning.
    I am facing big problem is How to create WorkBook and Chart in BI 7.0.
    My Requirement is following below..............
    1. How create work book, then how to add the Company LOGO,  End of report footer message.
    2. How to Create Chart, then how to design.
    Please provide me Solutions Asap, its very critical issue.
    Thanks & Regards,
    Bharathi.
    <Moderator Message: Before posting a question you should read the help as suggested in the answer you got. Additionally I would strongly recommend to read the rules of engagement. Your question violated a few of the rules like a) search the forums before posting; b) read the documentation before posting; c) do not request anything asap, nothing is more important than our own work...>
    Edited by: Siegfried Szameitat on Jul 15, 2010 8:25 AM

    Hi
    1) Please check the following URL.
        [http://www.researchsummary.ca/bw/Sample_Ch10.pdf]
         Hope it will help you.
    2) Default chart option is available in BEx please check and let me know in case any questions.
    Regards
    YuvaraajP

  • How to create a packet by using java?

    Hi, i am currently working on a research and i have some problems here.
    1) how to create a packet by using java programming ?
    2) How can i set the packet's information (e.g: packet's length, size of its header, etc) by using java?
    I am currently in a midst of this now and i hope that someone is willing to correspond to my questions and help me out of it.
    Thank you!

    I wan to create a customize packet where the user can
    define the header size, the packet's length etc. in
    the program......Then you get to write it to the connection yourself. Look at the OutputStream classes to see how to write low level output to a connection.

  • How to create a oracle database by java code?

    how to create a oracle database by java code?
    please give some ways then that way's code

    I'm not sure what you mean with "database". Do you mean an Oracle instance or an Oracle user/schema (probably the latter, because that's the equivalent to a MS SQL Database).
    Creating an instance is definitely not possible from within Java. To create a new user this should be possible, as this can be done with SQL:
    GRANT connect,resource TO <newuser> IDENTIFIED BY <password>;
    I'm always cautious with questions like this. In 90% of the cases there is something wrong with the initial design. Creating a database shouldn't be something the application is doing.
    Thomas

  • How to create progress bar?

    pls,can anyone tell me? how to create progress bar?
    thanks,
    screen410099

    it is well documented how to create progressbars on page 173 in Solutions.pdf
    also you can find sample code in InDesign SDK\sources\sdksamples
    Regards
    Bartek

  • How to create a SAS Dataset with Java

    Hello All,
    The subject line says it all. Does anyone out there know how to create a SAS Dataset using Java? I Googled it and searched here with no luck.
    Thanks
    KP

    Some parts of SAS appear to have been exposed via a Java API through this product:
    http://support.sas.com/rnd/app/da/workshop/faq.html
    Hope that helps
    Lee

Maybe you are looking for