Pie chart implemented

Pie chart implemented

Originally posted by: jasonweathersby.alltel.net
There is an action to click a legend element and highlight the bar/slice
but not the other way. It works is SVG, but SWT has a bug in it currently.
Jason
Raheel Ashraf wrote:
> I was wondering if this feature is already implemented in BIRT.
> Selecting a bar or pie chart slice highlights the corresponding legend
> entry. If so, does it work for SWT?
>

Similar Messages

  • How do I link to a table from a slice of a pie chart?

    My project manager is after me to add a feature to a pie chart built on one of my tables. The code that selects from the table for the pie chart is this:
    select 'http://apexdevapp1.ci.raleigh.nc.us:7777',activity_type,count(ID) total FROM eba_ver2_cust_activity
    where ACTIVITY_DATE BETWEEN NVL(TRIM(:P23_START_DATE), '01-JAN-2001') AND NVL(TRIM(:P23_END_DATE),
    '31-DEC-2099')
    group by activity_type,'http://apexdevapp1.ci.raleigh.nc.us:7777';
    She wants to be able to click on a slice of the pie ("activity_type") and link to another page showing a report limited to that activity_type, selected from the same table. I know how to link from one interactive report to another, but I don't know how to do it from a slice of a pie chart. Does anybody know how?
    I'd appreciate some guidance on this.
    Steve the n00b in Raleigh NC

    Denes Kubicek wrote:
    Have you compared that link with any of your apex application links in the browser? ;) :)
    Denes Kubicek
    http://deneskubicek.blogspot.com/
    http://www.opal-consulting.de/training
    http://apex.oracle.com/pls/otn/f?p=31517:1
    http://www.amazon.de/Oracle-APEX-XE-Praxis/dp/3826655494
    -------------------------------------------------------------------I may be missing the point of your question, Denes, but all my links are implemented from the Link Column section under Report Attributes. They are not mentioned anywhere in the Select statement, unlike yours.
    Steve "the n00b" in Raleigh NC

  • Pie Chart: How to capture data pertianing to the section  whereUser clicked

    In the UI there is a 1) Pie chart and a 2) table with search fields below the pie chart both displaying related information.
    we have a requirement to allow the user to click on various sections of the pie chart lets say it has two sections 1) one showing number of people with insurance as 75% and 2) another people without insurance as 25%. when the user clicks on the area representing 75% then the search fields related to the table should be automatically populated with the data related to that region of the pie chart (75%) lets say if there is drop down that allows the user to search for people "with" and "without" insurance then it should be set to "with insurance" since the user had clicked the area in the pie chart that pertains to percentage of people with insurance. basically, looking for some examples that would help us find out how to implement this feature since new to ADF?

    Use clickListener in Pie Chart.
    For details, check the documentation:
    http://jdevadf.oracle.com/adf-richclient-demo/docs/dvt/tagdoc/dvt_pieGraph.html
    Thanks,
    Navaneeth

  • Histogram works, Pie Chart doesn't :(

    I have a simple form, which has 1 block, a block level "when-new-block-instance" trigger and 2 bean_area under the block (beans don't have any trigger code). This simple form is called from within another form when a button is pressed. The histogram (bar chart) works, but the simple pie chart doesn't work (only displays a single circle - not the slices on the pie). The related trigger code is below. Can anybody see what is wrong with the pie chart code ?
    Appreciated.
    =====================================================================
    -- Set the bean area properties
    SET_CUSTOM_PROPERTY('BLOCK1.BEAN_AREA1',1,'CLEAR_BLOCK','');
    SET_CUSTOM_PROPERTY('BLOCK1.BEAN_AREA1',1,'GRAPHTYPE','VERTICAL_BAR');
    SET_CUSTOM_PROPERTY('BLOCK1.BEAN_AREA1',1,'ENABLE_TOOLTIPS','VALUES');
    SET_CUSTOM_PROPERTY('BLOCK1.BEAN_AREA1',1,'SET_DELIMITER','#');
    SET_CUSTOM_PROPERTY('BLOCK1.BEAN_AREA1',1,'SET_TITLE','Order Count By WHIP#red#b#14');
    SET_CUSTOM_PROPERTY('BLOCK1.BEAN_AREA1',1,'SET_FOOTER','WHIP Name#blue#12');
    SET_CUSTOM_PROPERTY('BLOCK1.BEAN_AREA1',1,'SET_DELIMITER',',');
    SET_CUSTOM_PROPERTY('BLOCK1.BEAN_AREA1',1,'SET_Y_LABEL','Move Your Mouse To View The Value For Each Bar');
    -- Use the following for a nice 3D look (if users want)
    -- SET_CUSTOM_PROPERTY('BLOCK1.BEAN_AREA1',1,'SET_DEPTH','20,45');
    -- This should populate and display the data on the graph by using the related PJC
    DECLARE
    ordercount NUMBER(10);
    whipname VARCHAR2(25);
    vData VARCHAR2(200);
    vDelimiter VARCHAR2(1);
    cursor c1 is select distinct interface_name from pps_order order by interface_name;
    BEGIN
    vDelimiter := ',';
    open c1;
    fetch c1 into whipname;
    while (c1%found) loop
    select count(*) into ordercount from pps_order where interface_name=whipname;
    vData := 'Total Order Count Per WHIP'||vDelimiter||whipname||vDelimiter||ordercount;
    SET_CUSTOM_PROPERTY('BLOCK1.BEAN_AREA1',1,'ADD_ROWDATA',vData);
    fetch c1 into whipname;
    end loop;
    SET_CUSTOM_PROPERTY('BLOCK1.BEAN_AREA1',1,'ADD_DATA_TO_GRAPH','');
    close c1;
    END;
    -- THIS SECTION IS FOR THE PIE CHART
    SET_CUSTOM_PROPERTY('BLOCK1.BEAN_AREA2',1,'CLEAR_BLOCK','');
    SET_CUSTOM_PROPERTY('BLOCK1.BEAN_AREA2',1,'GRAPHTYPE','PIE_GRAPH');
    SET_CUSTOM_PROPERTY('BLOCK1.BEAN_AREA2',1,'SHOW_PIE_LABELS','VALUE');
    SET_CUSTOM_PROPERTY('BLOCK1.BEAN_AREA2',1,'SET_DELIMITER','#');
    SET_CUSTOM_PROPERTY('BLOCK1.BEAN_AREA2',1,'SET_TITLE','Order Count By WHIP#red#b#14');
    SET_CUSTOM_PROPERTY('BLOCK1.BEAN_AREA2',1,'SET_FOOTER','WHIP Name#blue#12');
    SET_CUSTOM_PROPERTY('BLOCK1.BEAN_AREA2',1,'SET_DELIMITER',',');
    -- This should populate and display the data on the graph by using the related PJC
    DECLARE
    ordercount NUMBER(10);
    whipname VARCHAR2(25);
    vData VARCHAR2(200);
    vDelimiter VARCHAR2(1);
    cursor c2 is select distinct interface_name from pps_order order by interface_name;
    BEGIN
    vDelimiter := ',';
    open c2;
    fetch c2 into whipname;
    while (c2%found) loop
    select count(*) into ordercount from pps_order where interface_name=whipname;
    vData := 'Total Order Count Per WHIP'||vDelimiter||whipname||vDelimiter||ordercount;
    SET_CUSTOM_PROPERTY('BLOCK1.BEAN_AREA2',1,'ADD_ROWDATA',vData);
    fetch c2 into whipname;
    end loop;
    SET_CUSTOM_PROPERTY('BLOCK1.BEAN_AREA2',1,'ADD_DATA_TO_GRAPH','');
    close c2;
    END;
    GO_ITEM('BLOCK1.CLOSE');
    This uses the FormsGraph.jar file implementation as you can see. I know Frank Nimphius is the only expert when it comes to FormsGraph.jar at Oracle, but currently he is on vacation - so no official support to an unofficial (unsupported) charting implementation - but I thought there might be others who have done this before.
    Can someone who implemented a pie chart share his/her code here - a simple pie chart, nothing fancy (like the one that comes with the graph90.fmb file, which I followed but did not figure out why my implementation is not working). Something with the vData string or number of vData strings requirement? no explanation in the FormsGraph.jar doc and I am not a java programmer to figure it out from the java source code. I am looking for a simple trigger code for the pie chart - not like "look at the forms90.fmb that comes with the demo package" kinda answer.
    Thanx
    Message was edited by:
    zaferaktan
    Message was edited by:
    zaferaktan

    Any idea ?

  • Pie chart to a tabular report

    I have develop a pie chart for Category Sales. If i click on one of the pie (Category) it should open a tabular report where it shows the sale of products in that category. How can i implement this in OBIEE dashboard?

    Hi,
    For your senario you can use Master Detail event feture to implement your solutions.
    Master-detail linking of views allows you to establish a relationship between two or more views such that one view, called the master view, will drive data changes in one or more other views, called detail views.
    More detail refer below linke;
    http://gerardnico.com/wiki/dat/obiee/master_detail
    Mark Helpful/Correct as applicable.
    Regards,
    Kashi

  • Top 10 Pie Chart in Webi 3.1 with "Others"

    Hi,
    I need to implement a Pie Chart in Web Intelligence 3.1., which must show the sales values only for the Top 10 countries with the highest number of sales.
    However there is an extra requirement: I must include the option "Others" including the other countries (from 11th to the last).
    I've been searching but I have not found any solution. Does anyone know the way to achieve this requirement? Using a Pie Chart is mandatory.
    Thank you in advance!!

    Hi,
    you may refer to the following links:
    Consolidating dimension values under the tag "All Others"
    http://scn.sap.com/thread/3390881

  • Pdf generated through API's does not display pie chart

    I'm using BIP 10.1.3.4, running on Oracle Linux 5 connecting to a 11g database.
    I developed an RTF using the word template builder and included a pie chart. Previewing from within Word works fine, running the report directly from BIP works fine. I then used the API's to generate the pdf programmatically to have more control.
    I use RTFProcessor to convert my RTF into a XSL, DataProcessor to generate the xml data and FOProcessor to generate the final PDF. This works fine running from local JDeveloper, connecting through to the remote database.
    I've now loaded the java class with the API's into the database, and as per http://download.oracle.com/docs/cd/E12844_01/doc/bip.1013/e12188/T421739T517850.htm#T520954, loaded up the following jar's
    xdocore.jar - the core BI Publisher library
    aolj.jar - although this is an Oracle E-Business Suite library, it is required for standalone implementations as well
    i18nAPI_v3.jar - the i18n library used for localization functions
    xdoparser.jar - the scalable XML parser and XSLT 2.0 engine
    xmlparserv2-904.jar - the main XML parser/XSLT engine
    bipres.jar - a charting library
    bicmn.jar - a charting library
    jewt4.jar - a charting support library
    share.jar - a charting support library
    collections.jar - you only need this if you are working with the delivery APIs or bursting engine.
    The report works fine, all data tabels are shown but the pie chart is missing. I originally got the jar files from the TemplateBuilder/jlib directory. I also tried using the jar files from the BIP/xmlpserver\WEB-INF\lib directory as well. Problem remains - everything works fine except for the lack of the pie chart !
    Any help would be greatly appreciated :)
    Cheers,
    Brent

    bump .... anyone had similar problems ?

  • How to show top 20 values in a Pie Chart

    Hi
    We have a requirement to develop a Pie chart for top 20 Order value locations.but i am not able to plug in top 20 logic in a pie chart.This functionality (TOP N) is avilable in bar chart , but it is not avilable in Pie chart. Could some help me to implement this logic in a Pie chart.
    Your help in this regard is highly appreciated.
    Thanks
    Laj

    Not sure what you are saying here.  Obviously you have to have a place to place the distinct values, whether in another column or in the same column. That's not really a drawback, just a fact of life.
    I'm curious about what you mean by "multiple columns to dynamically select some records with specific criteria from different columns."  If you can give a specific example of what you are trying to do, I there may be a solution.  Are you trying to do something like Excel's filtering on multiple columns?
    If you are you can click the disclosure triangle by the column letter to get a dropdown like this:
    Similar to Excel.
    SG

  • Pie Chart is not visible

    I cannot get my pie chart to show in my JPanel. I am not sure why that is or how to get it to display. Everything compiles fine...I feel like an idiot. Anyway, could you look at this and let me know what I could be doing wrong. My piechart starts on line 302.
    import javax.swing.*;
    import javax.swing.event.*;
    import java.awt.*;
    import java.awt.event.*;
    import java.io.*;
    import java.text.*;
    public class MortCalcWeek5p extends JFrame implements ActionListener
         DecimalFormat twoPlaces = new DecimalFormat("#,###.00");//number format
         int L[] = {7, 15, 30};
         double I[] = {5.35, 5.5, 5.75};
         double P, M, J, H, C, Q;
         boolean manual = true;
         JPanel panel = new JPanel ();
         JRadioButton opt1 = new JRadioButton ("Manual Input", true);
         JRadioButton opt2 = new JRadioButton ("Menu Selections", false);
         ButtonGroup radioSelect = new ButtonGroup();
         JLabel PLabel = new JLabel("Enter the mortgage amount: ");
         JTextField PField = new JTextField(10);//field for obtaining user input for mortgage amount
         JLabel LLabel1 = new JLabel("Enter the term in years: ");
         JTextField LField = new JTextField(3);//field for obtaining user input for term in years
         JLabel ILabel1 = new JLabel("Enter the interest rate: ");
         JTextField IField = new JTextField(5);//field for obtaining user input for interest rate
         JLabel choices = new JLabel ("Or Choose the Interest Rate and Term in Years");
         JButton calcButton = new JButton("Calculate");
         JButton clearButton = new JButton("Clear");
         JButton exitButton = new JButton("Exit");
         JTextField payment = new JTextField(10);
         JLabel ILabel2 = new JLabel("Interest Rate: choose one");
         String [] IChoice = {I[0] + "", I[1] + "", I[2] + ""};
         JComboBox IBox = new JComboBox(IChoice);
         JLabel LLabel2 = new JLabel("Term (in years): choose one");
         String [] LChoice = {L[0] + "", L[1] + "", L[2] + ""};
         JComboBox LBox = new JComboBox(LChoice);
         JLabel amortBox = new JLabel("Amortization Table");
         JTextArea ta = new JTextArea();//<----------------------added
         //JScrollPane amortScroll = new JScrollPane();//
         JScrollPane amortScroll = new JScrollPane(ta, ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED);
         public MortCalcWeek5p () //creates the GUI window
                        super("Mortgage Calculator Week 5");
                        setSize(500, 400);
                        panel.setBackground (Color.white);
                        panel.setLayout(null);
                        panel.setPreferredSize(new Dimension(900, 500));
                        setResizable(false) ;
                        setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
                        //Creates the container
                        Container contentPane = getContentPane();
                        FlowLayout fresh = new FlowLayout(FlowLayout.LEFT);
                        panel.setLayout(fresh);
                        //identifies trigger events
                        calcButton.addActionListener(this);
                        clearButton.addActionListener(this);
                      exitButton.addActionListener(this);
                        PField.addActionListener(this);
                        LField.addActionListener(this);
                        IField.addActionListener(this);
                        opt1.addActionListener(this);
                        opt2.addActionListener(this);
                        panel.setLayout(fresh);
                        //Options
                        radioSelect.add(opt1);
                        radioSelect.add(opt2);
                        panel.add(opt1);
                        opt1.setBackground (Color.white);
                        panel.add(opt2);
                        opt2.setBackground (Color.white);
                        //Manual Entries
                        panel.add(PLabel);
                        panel.add(PField);
                        panel.add(LLabel1);
                        panel.add(LField);
                        panel.add(ILabel1);
                        panel.add(IField);
                        //Pre-set Entries
                        panel.add(choices);
                        panel.add(ILabel2);
                        panel.add(IBox);
                        IBox.setBackground (Color.white);
                        panel.add(LLabel2);
                        panel.add(LBox);
                        LBox.setBackground (Color.white);
                        //Buttons
                        panel.add(calcButton);
                        calcButton.setBackground (Color.white);
                        panel.add(payment);
                        payment.setBackground (Color.white);
                        panel.add(clearButton);
                        clearButton.setBackground (Color.white);
                        panel.add(exitButton);
                        exitButton.setBackground (Color.white);
                        //Amortization Table
                        panel.add(amortBox);
                        payment.setEditable(false);
                        panel.add(amortScroll);
                        amortScroll.setPreferredSize(new Dimension(600,300));//<----------added
                        setContentPane(panel);
                        //Pie Chart
                        //panel.add(PieChart);
                        setVisible(true);
         }// end of GUI info
              public void actionPerformed(ActionEvent e)
                   Object source = e.getSource();
                   if (source == calcButton)
                        try
                        if (manual)
                             Calculations_manual();
                        else Calculations_menu();
                   catch(NumberFormatException event)
                        JOptionPane.showMessageDialog(null, "You did not enter a number.\n\nYou're not too bright are you?\n\nTry again.", "ERROR", JOptionPane.ERROR_MESSAGE);
                   if (source == clearButton)
                   reset();
                   if (source == exitButton)
                   end();
                   if (source == opt1)
                   IBox.setEnabled(false);
                   LBox.setEnabled(false);
                   LField.setEnabled(true);
                   LField.setEditable(true);
                   IField.setEnabled(true);
                   IField.setEditable(true);
                   manual = true;
                   if (source == opt2)
                   IBox.setEnabled(true);
                   LBox.setEnabled(true);
                   LField.setEnabled(false);
                   LField.setEditable(false);
                   IField.setEnabled(false);
                   IField.setEditable(false);
                   manual = false;
              public void Calculations_menu() //performs the calculations from user input
                   double P = Double.parseDouble(PField.getText());
                   double I = Double.parseDouble((String) IBox.getSelectedItem());
                   double L = Double.parseDouble((String) LBox.getSelectedItem());
                   double J = (I  / (12 * 100));//monthly interest rate
                   double N = (L * 12);//term in months
                   double M = (P * J) / (1 - Math.pow(1 + J, - N));//Monthly Payment
                 String showPayment = twoPlaces.format(M);
                 payment.setText(showPayment);
                   int month = 1;
                             while (month <= N)
                                  //performs the calculations for the amortization
                                  double H = P * J;//current monthly interest
                                  double C = M - H;//monthly payment minus monthly interest
                                  double Q = P - C;//new balance
                                  P = Q;//sets loop
                                  month++;
                                  //String showAmort = twoPlaces.format(H + C + Q);
                                  //amortScroll(showAmort);
                                //ta.append("Month " + month);
                                ta.append("Interest Paid: " + twoPlaces.format(H));
                                ta.append("\tPrincipal Paid: " + twoPlaces.format(C));
                                ta.append("\tNew Balance: " + twoPlaces.format(Q) + "\n");
              public void Calculations_manual() //performs the calculations from user input
                   double P = Double.parseDouble(PField.getText());
                   double I = Double.parseDouble(IField.getText());
                   double L = Double.parseDouble(LField.getText());
                   double J = (I  / (12 * 100));//monthly interest rate
                   double N = (L * 12);//term in months
                   double M = (P * J) / (1 - Math.pow(1 + J, - N));//Monthly Payment
                 String showPayment = twoPlaces.format(M);
                 payment.setText(showPayment);
                   int month = 1;
                             while (month <= N)
                                  //performs the calculations for the amortization
                                  double H = P * J;//current monthly interest
                                  double C = M - H;//monthly payment minus monthly interest
                                  double Q = P - C;//new balance
                                  P = Q;//sets loop
                                  month++;
                                  //String showAmort = twoPlaces.format(H + C + Q);
                                  //amortScroll(showAmort);
                                //ta.append("Month " + month);
                                ta.append("Interest Paid: " + twoPlaces.format(H));
                                ta.append("\tPrincipal Paid: " + twoPlaces.format(C));
                                ta.append("\tNew Balance: " + twoPlaces.format(Q) + "\n");
              // resets GUI for another calculation
              public void reset ()
              PField.setText(null);
              payment.setText(null);
              ta.setText(null);
              LField.setText(null);
              IField.setText(null);
              // ends GUI and exits program
              public void end()
              System.exit(0);
    public class PieChart extends JComponent {
        // Class to hold a value for a slice
        class PieSlice
            //private variables
            double value;
            Color color;
            public PieSlice(double value, Color color)
                this.value = value;
                this.color = color;
            }//end Constructor
           } //end class PieSlice
        //private variable slices are array of PieSlice
        PieSlice[] slices = new PieSlice[2];
        //constructor
        PieChart(double C, double H)
            slices[0] = new PieSlice(C, Color.red);
            slices[1] = new PieSlice(H, Color.green);
            setVisible(true);
        // This method is called whenever the contents needs to be painted
        public void paintComponent(Graphics g) {
            // Draw the pie
            this.drawPie((Graphics2D)g, getBounds(), slices);
         // slices is an array of values that represent the size of each slice.
         public void drawPie(Graphics2D g, Rectangle area, PieSlice[] slices)
                 // Get total value of all slices
                 double total = 0.0;
                 for (int p=0; p<slices.length; p++) {
                     total += slices[p].value;
                 // Draw each pie slice
                 double curValue = 0.0;
                 int startAngle = 0;
                 for (int p=0; p<slices.length; p++)
                     // Compute the start and stop angles
                     startAngle = (int)(curValue * 360 / total);
                     int arcAngle = (int)(slices[p].value * 360 / total);
                     // Ensure that rounding errors do not leave a gap between the first and last slice
                     if (p == slices.length-1) {
                         arcAngle = 360 - startAngle;
                 } //end if
                 // Set the color and draw a filled arc
                 g.setColor(slices[p].color);
                 g.fillArc(area.x, area.y, 200, 200, startAngle, arcAngle);
                 RenderingHints renderHints = new RenderingHints(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
                   g.setRenderingHints(renderHints);
                   //int border=10;
                   //Ellipse2D.Double elb = new Ellipse2D.Double(area.x - border/2, area.y - border/2, pieWidth + border, pieHeight + border);
                 //g.fillArc(area.x, area.y, area.width, area.height, startAngle, arcAngle);
                 curValue += slices[p].value;
                 } //end for
            }//end drawPie
            public void resetPieChart(double capital, double interest)
                             slices[0] = new PieSlice(capital, Color.red);
                             slices[1] = new PieSlice(interest, Color.green);
                             this.repaint();
              }//end resetPieChart
        }//end class PieChart
              public static void main(String[] args)
                   MortCalcWeek5p app = new MortCalcWeek5p();
                   app.pack();
              }//end main
    }//end the programI am sorry for putting all this code here. I just wanted you to see the entire picture. I won't post all of this again unless requested.
    Thanks,
    Seawall

    Did you write this? :)
    Anyways, here you go. You never instantiated the pie chart or added it to gui. I created a separate JFrame and put pie chart in it. Also added PieChart.resetPieChart in actionHandler method. This should get you started.
    import javax.swing.*;
    import javax.swing.event.*;
    import java.awt.*;
    import java.awt.event.*;
    import java.io.*;
    import java.text.*;
    public class MortCalcWeek5p extends JFrame implements ActionListener
         DecimalFormat twoPlaces = new DecimalFormat("#,###.00");//number format
         int L[] = {7, 15, 30};
         double I[] = {5.35, 5.5, 5.75};
         double P, M, J, H, C, Q;
         boolean manual = true;
            PieChart pc = null;
         JPanel panel = new JPanel ();
         JRadioButton opt1 = new JRadioButton ("Manual Input", true);
         JRadioButton opt2 = new JRadioButton ("Menu Selections", false);
         ButtonGroup radioSelect = new ButtonGroup();
         JLabel PLabel = new JLabel("Enter the mortgage amount: ");
         JTextField PField = new JTextField(10);//field for obtaining user input for mortgage amount
         JLabel LLabel1 = new JLabel("Enter the term in years: ");
         JTextField LField = new JTextField(3);//field for obtaining user input for term in years
         JLabel ILabel1 = new JLabel("Enter the interest rate: ");
         JTextField IField = new JTextField(5);//field for obtaining user input for interest rate
         JLabel choices = new JLabel ("Or Choose the Interest Rate and Term in Years");
         JButton calcButton = new JButton("Calculate");
         JButton clearButton = new JButton("Clear");
         JButton exitButton = new JButton("Exit");
         JTextField payment = new JTextField(10);
         JLabel ILabel2 = new JLabel("Interest Rate: choose one");
         String [] IChoice = {I[0] + "", I[1] + "", I[2] + ""};
         JComboBox IBox = new JComboBox(IChoice);
         JLabel LLabel2 = new JLabel("Term (in years): choose one");
         String [] LChoice = {L[0] + "", L[1] + "", L[2] + ""};
         JComboBox LBox = new JComboBox(LChoice);
         JLabel amortBox = new JLabel("Amortization Table");
         JTextArea ta = new JTextArea();//<----------------------added
         //JScrollPane amortScroll = new JScrollPane();//
         JScrollPane amortScroll = new JScrollPane(ta, ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED);
         public MortCalcWeek5p () //creates the GUI window
                        super("Mortgage Calculator Week 5");
                        setSize(500, 400);
                        panel.setBackground (Color.white);
                        //panel.setLayout(null);
                        panel.setPreferredSize(new Dimension(900, 500));
                        setResizable(false) ;
                        setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
                        //Creates the container
                        //Container contentPane = getContentPane();
                        FlowLayout fresh = new FlowLayout(FlowLayout.LEFT);
                                    BorderLayout bl = new BorderLayout();
                        panel.setLayout(fresh);
                        //identifies trigger events
                        calcButton.addActionListener(this);
                        clearButton.addActionListener(this);
                                    exitButton.addActionListener(this);
                        PField.addActionListener(this);
                        LField.addActionListener(this);
                        IField.addActionListener(this);
                        opt1.addActionListener(this);
                        opt2.addActionListener(this);
                        //panel.setLayout(fresh);
                        //Options
                        radioSelect.add(opt1);
                        radioSelect.add(opt2);
                        panel.add(opt1);
                        opt1.setBackground (Color.white);
                        panel.add(opt2);
                        opt2.setBackground (Color.white);
                        //Manual Entries
                        panel.add(PLabel);
                        panel.add(PField);
                        panel.add(LLabel1);
                        panel.add(LField);
                        panel.add(ILabel1);
                        panel.add(IField);
                        //Pre-set Entries
                        panel.add(choices);
                        panel.add(ILabel2);
                        panel.add(IBox);
                        IBox.setBackground (Color.white);
                        panel.add(LLabel2);
                        panel.add(LBox);
                        LBox.setBackground (Color.white);
                        //Buttons
                        panel.add(calcButton);
                        calcButton.setBackground (Color.white);
                        panel.add(payment);
                        payment.setBackground (Color.white);
                        panel.add(clearButton);
                        clearButton.setBackground (Color.white);
                        panel.add(exitButton);
                        exitButton.setBackground (Color.white);
                        //Amortization Table
                        panel.add(amortBox);
                        payment.setEditable(false);
                        panel.add(amortScroll);
                        amortScroll.setPreferredSize(new Dimension(600,300));//<----------added
                        setContentPane(panel);
                                    setVisible(true);
                        //Pie Chart
                                    pc = new PieChart(C,H);
                        JPanel piePanel = new JPanel();
                                    piePanel.setLayout(new BorderLayout());
                                    piePanel.add(pc);                               
                                    JFrame pieFrame = new JFrame("Pie Chart");
                                    pieFrame.setSize(210,230);
                                    pieFrame.getContentPane().add(piePanel);
                                    pieFrame.setVisible(true);
         }// end of GUI info
              public void actionPerformed(ActionEvent e)
                   Object source = e.getSource();
                   if (source == calcButton)
                                    pc.resetPieChart(C, H);
                        try
                        if (manual)
                             Calculations_manual();
                        else Calculations_menu();
                   catch(NumberFormatException event)
                        JOptionPane.showMessageDialog(null, "You did not enter a number.\n\nYou're not too bright are you?\n\nTry again.", "ERROR", JOptionPane.ERROR_MESSAGE);
                   if (source == clearButton)
                   reset();
                   if (source == exitButton)
                   end();
                   if (source == opt1)
                   IBox.setEnabled(false);
                   LBox.setEnabled(false);
                   LField.setEnabled(true);
                   LField.setEditable(true);
                   IField.setEnabled(true);
                   IField.setEditable(true);
                   manual = true;
                   if (source == opt2)
                   IBox.setEnabled(true);
                   LBox.setEnabled(true);
                   LField.setEnabled(false);
                   LField.setEditable(false);
                   IField.setEnabled(false);
                   IField.setEditable(false);
                   manual = false;
              public void Calculations_menu() //performs the calculations from user input
                   double P = Double.parseDouble(PField.getText());
                   double I = Double.parseDouble((String) IBox.getSelectedItem());
                   double L = Double.parseDouble((String) LBox.getSelectedItem());
                   double J = (I  / (12 * 100));//monthly interest rate
                   double N = (L * 12);//term in months
                   double M = (P * J) / (1 - Math.pow(1 + J, - N));//Monthly Payment
                 String showPayment = twoPlaces.format(M);
                 payment.setText(showPayment);
                   int month = 1;
                             while (month <= N)
                                  //performs the calculations for the amortization
                                  double H = P * J;//current monthly interest
                                  double C = M - H;//monthly payment minus monthly interest
                                  double Q = P - C;//new balance
                                  P = Q;//sets loop
                                  month++;
                                  //String showAmort = twoPlaces.format(H + C + Q);
                                  //amortScroll(showAmort);
                                //ta.append("Month " + month);
                                ta.append("Interest Paid: " + twoPlaces.format(H));
                                ta.append("\tPrincipal Paid: " + twoPlaces.format(C));
                                ta.append("\tNew Balance: " + twoPlaces.format(Q) + "\n");
              public void Calculations_manual() //performs the calculations from user input
                   double P = Double.parseDouble(PField.getText());
                   double I = Double.parseDouble(IField.getText());
                   double L = Double.parseDouble(LField.getText());
                   double J = (I  / (12 * 100));//monthly interest rate
                   double N = (L * 12);//term in months
                   double M = (P * J) / (1 - Math.pow(1 + J, - N));//Monthly Payment
                 String showPayment = twoPlaces.format(M);
                 payment.setText(showPayment);
                   int month = 1;
                             while (month <= N)
                                  //performs the calculations for the amortization
                                  double H = P * J;//current monthly interest
                                  double C = M - H;//monthly payment minus monthly interest
                                  double Q = P - C;//new balance
                                  P = Q;//sets loop
                                  month++;
                                  //String showAmort = twoPlaces.format(H + C + Q);
                                  //amortScroll(showAmort);
                                //ta.append("Month " + month);
                                ta.append("Interest Paid: " + twoPlaces.format(H));
                                ta.append("\tPrincipal Paid: " + twoPlaces.format(C));
                                ta.append("\tNew Balance: " + twoPlaces.format(Q) + "\n");
              // resets GUI for another calculation
              public void reset ()
              PField.setText(null);
              payment.setText(null);
              ta.setText(null);
              LField.setText(null);
              IField.setText(null);
              // ends GUI and exits program
              public void end()
              System.exit(0);
    public class PieChart extends JComponent {
        // Class to hold a value for a slice
        class PieSlice
            //private variables
            double value;
            Color color;
            public PieSlice(double value, Color color)
                this.value = value;
                this.color = color;
            }//end Constructor
           } //end class PieSlice
        //private variable slices are array of PieSlice
        PieSlice[] slices = new PieSlice[2];
        //constructor
        PieChart(double C, double H)
            slices[0] = new PieSlice(C, Color.red);
            slices[1] = new PieSlice(H, Color.green);
            setVisible(true);
        // This method is called whenever the contents needs to be painted
        public void paintComponent(Graphics g) {
            // Draw the pie
            this.drawPie((Graphics2D)g, getBounds(), slices);
         // slices is an array of values that represent the size of each slice.
         public void drawPie(Graphics2D g, Rectangle area, PieSlice[] slices)
                 // Get total value of all slices
                 double total = 0.0;
                 for (int p=0; p<slices.length; p++) {
                     total += slices[p].value;
                 // Draw each pie slice
                 double curValue = 0.0;
                 int startAngle = 0;
                 for (int p=0; p<slices.length; p++)
                     // Compute the start and stop angles
                     startAngle = (int)(curValue * 360 / total);
                     int arcAngle = (int)(slices[p].value * 360 / total);
                     // Ensure that rounding errors do not leave a gap between the first and last slice
                     if (p == slices.length-1) {
                         arcAngle = 360 - startAngle;
                 } //end if
                 // Set the color and draw a filled arc
                 g.setColor(slices[p].color);
                 g.fillArc(area.x, area.y, 200, 200, startAngle, arcAngle);
                 RenderingHints renderHints = new RenderingHints(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
                   g.setRenderingHints(renderHints);
                   //int border=10;
                   //Ellipse2D.Double elb = new Ellipse2D.Double(area.x - border/2, area.y - border/2, pieWidth + border, pieHeight + border);
                 //g.fillArc(area.x, area.y, area.width, area.height, startAngle, arcAngle);
                 curValue += slices[p].value;
                 } //end for
            }//end drawPie
            public void resetPieChart(double capital, double interest)
                             slices[0] = new PieSlice(capital, Color.red);
                             slices[1] = new PieSlice(interest, Color.green);
                             this.repaint();
              }//end resetPieChart
        }//end class PieChart
              public static void main(String[] args)
                   MortCalcWeek5p app = new MortCalcWeek5p();
                   app.pack();
              }//end main
    }//end the program

  • Pie chart in combintion with a Slider control in Dashboards 4.0

    Hi,
    Following the my requirement for creating a dashboard.
    1) i have to display employee count for different regions in a pie char for a particular month.
    2) This month needs to be selected from a slider control(Horizontal).
    3) The slider control needs to show Month and year (MON-YYYY format) for the last 13 months.6 months above the slider and 7 months below the slider.
    4) So when a user selects a particular month by dragging to the particular month in slider, then the pie chart should display employee count for the selected month.
    5) And Also the slider control by default should show last month employee count in pie chart when the dashboard is opened every time.
    So Any body knows how to implement this requirement please send me the solution in a step by step approch.
    Thanks in Advance,
    Regards,
    Nanda Kishore.

    Hi,
    Set up your data like this
    For the months we just use 0 for the selected month and we mark our min & max.
    (I just took a few months, just as test, in real, you have to have all your months, off course)
    Link the slider component, data to B2, min to B3 and max to B7
    Create combobox, link labels to cell B3:B7
    setup of data insertion, see screenshot below. (destination: j4:J7)
    for behaviour column do as follows...
    Your pie chart component
    results in
    now you have to put some makup on your dashboard, (hide the combobox - hide the values -6,0and 7), create some textcomponents to show the correct months (create a key row (-6 >0>7) and a month-text row), you can use vlookup or via a combobox to fetch the correct month-text
    Have fun with it

  • Insert Pie Chart to Excel Using OpenXml

    I managed to implement the code(I got from MSDN) to create a bar graph in excel, I am however facing challenges in creating a piechart, I had thought that I can manipulate the code a little bit and  produce a pie chart-but I have spent nights and
    nights still can't find my way to create a pie chart. I need help on this, I would appreciate if you can help me through this.
    F.Shumba

    Hi F.Shuba,
    From the description, you want to create a piechart using Open XML.
    A recommend way is that create a pie chart manually and use Open XML SDK 2.5 Productivity Tool to open this workbook. Then you can get the code for creaing the chart for reference.
    If you still have issue, please feel free to let me know.
    Regards & Fei
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

  • Bar and Pie chart  display with values

    Hi All...
    I want implement the my swing application Bar and Pie chart functionality with vales, If both are disply same veues.
    Thanx to Advance
    Arjun

    www.jfree.org

  • Drawing pie chart in applet

    Hi,
    The following is an applet I've written as an assignment in school. The applet runs well on appletviewer (here I mean drawing the pie chart). But when I run it on my browser, the pie chart is not drawn. Hope you can help me. Thanks in advance.
    import java.applet.*;import java.text.*;import java.awt.*;import java.awt.event.*;import java.awt.Graphics;public class x2 extends Applet implements ActionListener {               private Button draw,reset;        private TextField thigh,tmedium,tlow,tno;     private Label banner,l1, l2, l3, l4;     double rhigh,rmedium,rlow,rno;     double high, medium, low, no, total, high2=0, medium2=0, low2=0, no2=0,low3, no3;     String something="";          public void paint(Graphics g){     setBackground(Color.white);               if(something=="in"){     try {               rhigh=Double.parseDouble(thigh.getText());     rmedium=Double.parseDouble(tmedium.getText());     rlow=Double.parseDouble(tlow.getText());     rno=Double.parseDouble(tno.getText());     } catch (NumberFormatException nfe) {     }     total=rhigh+rmedium+rlow+rno; high=(rhigh/total)*100; medium=(rmedium/total)*100; low=(rlow/total)*100; no=(rno/total)*100; high2=high*360/100;     medium2=medium*360/100;     low2=low*360/100;     no2=no*360/100;          low3=high2+medium2;     no3=low3+low2;               g.setColor(Color.red);     g.fillArc(100,100,200,200,0,(int)high2);     g.setColor(Color.blue);     g.fillArc(100,100,200,200,(int)high2,(int)medium2);     g.setColor(Color.green);     g.fillArc(100,100,200,200,(int)low3,(int)low2);     g.setColor(Color.pink);     g.fillArc(100,100,200,200,(int)no3,(int)no2);     }     }          public void init(){          draw=new Button("Draw pie chart");     reset=new Button("Reset");     thigh=new TextField("",10);     tmedium=new TextField("",10);     tlow=new TextField("",10);     tno=new TextField("",10);     l1=new Label("High Risk  :$");     l2=new Label("Medium Risk:$");     l3=new Label("Low Risk   :$");     l4=new Label("No Risk    :$");     banner=new Label("Welcome");           add(banner);           add(l1);     add(thigh);          add(l2);     add(tmedium);     add(l3);     add(tlow);     add(l4);     add(tno);                         add(draw);     add(reset);                   draw.setActionCommand("Draw");     draw.addActionListener(this);        reset.setActionCommand("Reset");     reset.addActionListener(this);     }          public void actionPerformed(ActionEvent e){          if(e.getActionCommand() == "Draw") {               something="in";               repaint();                    } else if(e.getActionCommand()== "Reset") {               something="";               thigh.setText("");               tmedium.setText("");               tlow.setText("");               tno.setText("");               repaint();          }     }}

    <code>
    import java.applet.*;
    import java.text.*;
    import java.awt.*;
    import java.awt.event.*;
    import java.awt.Graphics;
    public class x2 extends Applet implements ActionListener {
         private Button draw, reset;
         private TextField thigh, tmedium, tlow, tno;
         private Label banner, l1, l2, l3, l4;
         double rhigh,rmedium,rlow,rno;
         double high, medium, low, no, total, high2=0, medium2=0, low2=0, no2=0,low3, no3;
         String something="";
         public void paint(Graphics g) {
              setBackground(Color.white);
              if(something=="in"){
                   try {
                        rhigh=Double.parseDouble(thigh.getText());
                        rmedium=Double.parseDouble(tmedium.getText());
                        rlow=Double.parseDouble(tlow.getText());
                        rno=Double.parseDouble(tno.getText());
                   catch (NumberFormatException nfe) { }
                   total=rhigh+rmedium+rlow+rno; high=(rhigh/total)*100;
                   medium=(rmedium/total)*100;
                   low=(rlow/total)*100;
                   no=(rno/total)*100;
                   high2=high*360/100;
                   medium2=medium*360/100;
                   low2=low*360/100;
                   no2=no*360/100;
                   low3=high2+medium2;
                   no3=low3+low2;
                   g.setColor(Color.red);
                   g.fillArc(100,100,200,200,0,(int)high2);
                   g.setColor(Color.blue);
                   g.fillArc(100,100,200,200,(int)high2,(int)medium2);
                   g.setColor(Color.green);
                   g.fillArc(100,100,200,200,(int)low3,(int)low2);
                   g.setColor(Color.pink);
                   g.fillArc(100,100,200,200,(int)no3,(int)no2);
         public void init(){
              draw=new Button("Draw pie chart");
              reset=new Button("Reset");
              thigh=new TextField("",10);
              tmedium=new TextField("",10);
              tlow=new TextField("",10);
              tno=new TextField("",10);
              l1=new Label("High Risk :$");
              l2=new Label("Medium Risk:$");
              l3=new Label("Low Risk :$");
              l4=new Label("No Risk :$");
              banner=new Label("Welcome");
              add(banner);
              add(l1);
              add(thigh);
              add(l2);
              add(tmedium);
              add(l3);
              add(tlow);
              add(l4);
              add(tno);
              add(draw);
              add(reset);
              draw.setActionCommand("Draw");
              draw.addActionListener(this);
              reset.setActionCommand("Reset");
              reset.addActionListener(this);
         public void actionPerformed(ActionEvent e) {
              if(e.getActionCommand() == "Draw") {
                   something="in";
                   repaint();
              } else if(e.getActionCommand()== "Reset") {
                   something="";
                   thigh.setText("");
                   tmedium.setText("");
                   tlow.setText("");
                   tno.setText("");
                   repaint();
    </code>

  • Bar Chart and Pie Chart

    Hi!
    In My application i want to create few bar and pie chart.
    If is there any code for generating bar and pie chart,
    pl send me.
    If third party software is available tell me the details of it.

    Sure, this functionality would be nice to have right
    out of the box, but when you think about it: should
    Sun be distributing a reporting SDK and promoting bad
    practices anyhow? Implementing your reporting in
    disparate and distributed manners is just plain messy
    and definitely translates to a bad practice. Turning
    to a centralized reporting mechanism, driven by a
    reporting server that can handle the needs for 80% of
    your requirements is a helluva lot more thoughtful and
    mindful than implementing separate mini reporting
    engines encapsulated within each and every application
    that you deploy.Elegantly stated! On a practical point, my company built an Enterprised based reporting solution on top of Java technology within the windows environment (please be kind). Specifically we used Java, ASP and Javascript (no VBScript), and delivered the information using the Microsoft IE 4 and 5.
    However, since Microsoft chose to elminate Java from it's current browser (IE6), we have to throw two years of coding away. We are now in the process of moving backward (technically speaking) to a desktop reporting model using Java (no browser technology) that accesses an Enterprise database, or embedded Java database. None of our customers are using Netscape, so that was never an option. Microsoft's and Sun's inablity to cooperate almost decimated our company's product line (and it still may).
    So I agree with you that an Enterprise server based reporting solution is the best architecture, and yet here I am running away from it after a two year struggle with competing standards. Sometimes the best solution loses for reasons that are simply not technical in nature.

  • In a ADG is it possible to have a pie chart in a summary row?

    In a ADG is it possible to have a pie chart in a summary row?
    The segments would be worked out from a funtion applied to the data
    in that grouping.
    Thanks :)

    The JTable is a tabular component. So it will always have enough columns to display the maximum row length. you don't have to pur a value in every cell.
    There are methods in JTable to remove horizontal and vertical lines and you could implement a renderer to make empty cells look like the background.
    Cheers
    DB

Maybe you are looking for

  • IT0023 - report to fetch overlapping records

    Hi All, In IT0023 time constraint 3 was maintained, which allowed over lapping records to be maintained. Now, we have changed the time constraint to '2' which will not allow overlapping dates to be maintained. Hence, my client would have to clean the

  • Find the Missing font text content in indesign document

    How to find and get the missing font content in the indesign documents by using the SDK. give a tips and techniques. Anybodys help me.

  • Accounting Integration Error

    I have setup Accounting Integration for Internal Order Automatic on saving. However when I run calculate Button it says There is no internal order for project I didnt find anything in cockpit COCPCPR PPM and ERP are on same server. I have maintained

  • Unsatisfied Link Error when using Oracle OCI (Type II) driver

    Using Oracle OCI (Type II) driver on HPUX with Oracle 9.2.0.4. If when creating a connection pool via the console, using the Oracle OCI (Type II) driver, you get the error "Unsatisfied link error with library libocijdbc9.sl or format error" then chec

  • How to create these shapes in photoshop?

    For my PhD research, I would like to construct 3 kinds of images on  photoshop. I want to transfer it to the piece of glass where I will  conduct some experiments.  If you please help me to construct such kind  of images on photoshop, I will remain t