Pie Chart Dimensions
When I select the Pie Chart tool and click/enter the dimensions in the fields, for example width: 80 x height: 80mm, the pie chart is created at 69.691mm.
Why does the a pie chart never appear at the dimensions enter into the width and height fields?
Is there a preference somewhere that I'm missing? I have a lot of pie charts to produce at exact sizes and this is a bit of a pain.
That’s just the way Illie’s primitive graphs work. They need some serious re-thinking.
The best thing you can do is to scale the pie to the size you want. If you need to create other pies in the same size, make a copy of the first one and then change the data.
It is indeed strange that the Transform panel doesn’t work on graphs.
Similar Messages
-
Pie chart with two measures and date dimension navigation not working
Hi Experts,
Pie chart with two measures and date dimension navigation not working. Any help is appreciated.
Thanks
VHi Deepak,
I had time dimension in the RPD.
I have stacked bar chart with same time dim like year & month in the report. when I go to legand and set navigation it is working fine. But not with pie chart.
I am not not sure what is the problem. When I click on Pie chart it is not navigating to the target report. Can it be any other issues..??? -
Error while creating a Pie Chart
Hi Experts,
I have prepared a spreadsheet in Web Analysis in which two dimensions are appearing in Rows, one dimension in Columns and one dimension in Page View.
When I convert this spreadsheet into a Pie Chart, or any other chart for that matter, no data is displayed. If I remove one dimension from Rows to POV, data starts appearing in the chart. But it is not a relevant chart as the data shown in it is not in the format in which it is required.
Kindly help in resolving this issue.
Regards,
SYRHi Sa'ad
Its been a little while since I used Web Analysis but I remember that there are issues if you have more than 1 dimension in rows or columns. What I cannot remember is whether it automatically shifts a dimension to the page or whether as you suggest it just doesn't display.
Pie charts can only display data from two dimensions (1 rows, 1 columns), you can filter using dimensions on pages. If that doesn't give you what you need then I'm afraid you need to stick to a different chart type.
Hope this helps
Stuart -
Create Multiple Pie Charts with Drill Down capability(foreach in mainreport
Hello All,
i need to create a report with 4 pie charts, which should have drilldown capability. i tried to do that, and i can do only for two charts. i need for the rest 2 also.
Please help.
ThanksSee this thread:
BO Design studio Chart Component issue ...!! | SCN
If Chart is bound to DS_1 and On Select event of chart is as below:
DS_2.setFilter(dimension, CHART_1.getSelectedMember(dimension));"
This works when you click a value on one chart it will select another.
I haven't tried it with hierarchies. -
Display the value as percentage in pie-chart in WEBI
Hi Experts,
I have two measures No. of Sales Transactions and Customer Visit. And I created a measure named CustomerConversionRate.
ie, CustomerConversionRate = ([No. of Sales Transactions]/[Customer Visit])*100.
So my requirement is that CustomerConversionRate is to be display into a pie chart in WEBI . CustomerConversionRate always a percentage.I
hereby attached a sample pie-chart based on my requirement.
Eg:CustomerConversionRate=79.27 and Remaining = 20.73
I want to display CustomerConversionRate=79.27 and Remaining = 20.73 into a pie chart in WEBIHi ,
Add 1 more Query with dimension that will have values
Completed Or X
Remaining Or Y
Duplicate your Query And Keep only 1 Dimension [Extra_Dim]( Remember this Dim Name you have to use it in different way so it would be better if use any Dimension which is not there in First Query )
Go To--> View Script --> Custom SQL
write below code in Query Script Editor
SELECT
'Completed' As "CATEGORY"
FROM
"YOUR_TABLE" Table__1
Union
SELECT
'Remaining' As "CATEGORY"
FROM
"YOUR_TABLE" Table__2
And Save this Query .
Now Rename this Query as Pie Dimension .
Now You can Use [Extra_Dim] As [Achievment_Status]
Create Measure Variable [Achievment_Val] as mention above .
And use it -
Hey Experts,
I have a small issue but cannot seem to find the solution. I have a pie chart with legends which I want to show side by side (horizontally). First pie chart and then legends. My requirement is that when the window is resized, the pie chart should also resize. I am able to show the chart and legends horizontally but when the legends list is long, the pie chart is always aligned in the center vertically. I tried setting all properties such as verticalAlign = "top", verticalCenter = "false", tried putting pie chart and legends in a separate VBox but nothing seems to work. Below is the code snippet.
I believe others would have faced this problem. Can someone help?
<mx:HBox width="100%" height="100%" verticalAlign="top" verticalCenter="false">
<mx:VBox width="100%" verticalAlign="top" verticalCenter="false">
<mx:PieChart id="pieChart" width="100%" height="100%" showDataTips="true" minWidth="200" minHeight="200" verticalCenter="false"/>
</mx:VBox>
<mx:VBox width="100%" verticalAlign="top" verticalCenter="false">
<mx:Legend width="100%" height="100%" dataProvider="{pieChart}"/>
</mx:VBox>
</mx:HBox>Hi Dajji,
Here is the code which resolves the problem...
Note: In the code below I have removed the percentage width and height for PieChart.....that resolves the problem.....but the thing here is as you resize
your browser window the piechart width and height will not change accordingly...? Do you need PieChart to change its dimensions as your browser window
resizes...???
However if you specify width="100%" and height="100%" for PieChart you never gonna acheive the PieChart to be vertically alined to top.....why because
as you specified width="100%" and height="100%" for PieChart it occupies the total dimensions of the VBox but the actual visible portion dimensions are
less... because within the VBox you also have the legends so Flex will assign the sizes proportionately....for PieChart and Legends..
Hope you got my point...So you should remove the width="100%" and height="100%" for PieChart then you can acheive what you needed...
<?xml version="1.0"?>
<!-- Simple example to demonstrate the PieChart control. -->
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" height="100%" width="100%">
<mx:Script>
<![CDATA[
import mx.collections.ArrayCollection;
[Bindable]
private var medalsAC:ArrayCollection = new ArrayCollection( [
{ Country: "USA", Gold: 35, Silver:39, Bronze: 29 },
{ Country: "China", Gold: 32, Silver:17, Bronze: 14 },
{ Country: "Russia", Gold: 27, Silver:27, Bronze: 38 },
{ Country: "USA", Gold: 35, Silver:39, Bronze: 29 },
{ Country: "China", Gold: 32, Silver:17, Bronze: 14 },
{ Country: "Russia", Gold: 27, Silver:27, Bronze: 38 },
{ Country: "USA", Gold: 35, Silver:39, Bronze: 29 },
{ Country: "China", Gold: 32, Silver:17, Bronze: 14 },
{ Country: "Russia", Gold: 27, Silver:27, Bronze: 38 },
{ Country: "USA", Gold: 35, Silver:39, Bronze: 29 },
{ Country: "China", Gold: 32, Silver:17, Bronze: 14 },
{ Country: "Russia", Gold: 27, Silver:27, Bronze: 38 },
{ Country: "USA", Gold: 35, Silver:39, Bronze: 29 },
{ Country: "China", Gold: 32, Silver:17, Bronze: 14 },
{ Country: "Russia", Gold: 27, Silver:27, Bronze: 38 },
{ Country: "USA", Gold: 35, Silver:39, Bronze: 29 },
{ Country: "China", Gold: 32, Silver:17, Bronze: 14 },
{ Country: "Russia", Gold: 27, Silver:27, Bronze: 38 },
{ Country: "USA", Gold: 35, Silver:39, Bronze: 29 },
{ Country: "China", Gold: 32, Silver:17, Bronze: 14 },
{ Country: "Russia", Gold: 27, Silver:27, Bronze: 38 },
{ Country: "USA", Gold: 35, Silver:39, Bronze: 29 },
{ Country: "China", Gold: 32, Silver:17, Bronze: 14 },
{ Country: "Russia", Gold: 27, Silver:27, Bronze: 38 },
{ Country: "USA", Gold: 35, Silver:39, Bronze: 29 },
{ Country: "China", Gold: 32, Silver:17, Bronze: 14 },
{ Country: "Russia", Gold: 27, Silver:27, Bronze: 38 },
{ Country: "USA", Gold: 35, Silver:39, Bronze: 29 },
{ Country: "China", Gold: 32, Silver:17, Bronze: 14 },
{ Country: "Russia", Gold: 27, Silver:27, Bronze: 38 },
{ Country: "USA", Gold: 35, Silver:39, Bronze: 29 },
{ Country: "China", Gold: 32, Silver:17, Bronze: 14 },
{ Country: "Russia", Gold: 27, Silver:27, Bronze: 38 },
{ Country: "USA", Gold: 35, Silver:39, Bronze: 29 },
{ Country: "China", Gold: 32, Silver:17, Bronze: 14 },
{ Country: "Russia", Gold: 27, Silver:27, Bronze: 38 },
{ Country: "USA", Gold: 35, Silver:39, Bronze: 29 },
{ Country: "China", Gold: 32, Silver:17, Bronze: 14 },
{ Country: "Russia", Gold: 27, Silver:27, Bronze: 38 },
{ Country: "USA", Gold: 35, Silver:39, Bronze: 29 },
{ Country: "China", Gold: 32, Silver:17, Bronze: 14 },
{ Country: "Russia", Gold: 27, Silver:27, Bronze: 38 },
{ Country: "USA", Gold: 35, Silver:39, Bronze: 29 },
{ Country: "China", Gold: 32, Silver:17, Bronze: 14 },
{ Country: "Russia", Gold: 27, Silver:27, Bronze: 38 },
{ Country: "USA", Gold: 35, Silver:39, Bronze: 29 },
{ Country: "China", Gold: 32, Silver:17, Bronze: 14 },
{ Country: "Russia", Gold: 27, Silver:27, Bronze: 38 },
{ Country: "USA", Gold: 35, Silver:39, Bronze: 29 },
{ Country: "China", Gold: 32, Silver:17, Bronze: 14 },
{ Country: "Russia", Gold: 27, Silver:27, Bronze: 38 },
{ Country: "USA", Gold: 35, Silver:39, Bronze: 29 },
{ Country: "China", Gold: 32, Silver:17, Bronze: 14 },
{ Country: "Russia", Gold: 27, Silver:27, Bronze: 38 },
{ Country: "USA", Gold: 35, Silver:39, Bronze: 29 },
{ Country: "China", Gold: 32, Silver:17, Bronze: 14 },
{ Country: "Russia", Gold: 27, Silver:27, Bronze: 38 },
{ Country: "USA", Gold: 35, Silver:39, Bronze: 29 },
{ Country: "China", Gold: 32, Silver:17, Bronze: 14 },
{ Country: "Russia", Gold: 27, Silver:27, Bronze: 38 } ]);
private function displayGold(data:Object, field:String, index:Number, percentValue:Number):String {
var temp:String= (" " + percentValue).substr(0,6);
return data.Country + ": " + '\n' + "Total Gold: " + data.Gold + '\n' + temp + "%";
]]>
</mx:Script>
<mx:Panel title="Olympics 2004 Medals Tally Panel" height="100%" width="100%" layout="horizontal" verticalAlign="top">
<mx:VBox verticalAlign="top" height="100%" width="100%">
<mx:PieChart id="chart"
showDataTips="true"
dataProvider="{medalsAC}">
<mx:series>
<mx:PieSeries
nameField="Country"
field="Gold"
labelFunction="displayGold">
</mx:PieSeries>
</mx:series>
</mx:PieChart>
</mx:VBox>
<mx:Legend dataProvider="{chart}"/>
</mx:Panel>
</mx:Application>
Thanks,
Bhasker Chari -
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 -
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,
SeawallDid 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 -
Creating a pie chart from a list of indicators
Hello:
I'm working with WebIntelligence XI R2 and I have created a table that displays a list of indicators:
Indicator 1 15
Indicator 2 35
Indicator 3 40
Indicator 4 10
The problem is that I want to create a pie chart from this table but it seems that Webi is unable to convert a list of numbers in a pie chart.
Is there any workaround to make this chart, without having to change the universe? ( I suppose that if I convert the four indicators into a single dimension it will be possible, but I would like to avoid that).
Thanks in advance and regards,
Joaquín CastellanoPlease disregard. i went back to the original blog code and started over, and figured this out.
-
I have requirement to add specific color to each element in pie-chart.
Below is my code for pie-chart with static json.
Instead of the default colors given by the viz charts, I want to have red, green, orange and blue color in the pie-chart.
Has someone changed the colors successfully?
var oModel = new sap.ui.model.json.JSONModel({
businessData : [
{Country :"Canada",revenue:2410.87, color: "red"},
{Country :"China",revenue:638.29, color: "green"},
{Country :"France",revenue:487.66, color: "orange"},
{Country :"Germany",revenue:170.23, color: "blue"}
var oDataset = new sap.viz.ui5.data.FlattenedDataset({
dimensions : [ {axis : 1, name : 'Country', value : "{Country}" } ],
measures : [ { name : 'Revenue', value : '{revenue}' } ],
data : { path : "/businessData" }
var oBarChart = new sap.viz.ui5.Pie({
width : "80%", height : "400px",
plotArea : {
'colorPalette' : d3.scale.category20().range()
title : { visible : true, text : 'Revenue By Country' },
dataset : oDataset
oBarChart.setModel(oModel);
oBarChart.placeAt("sample1");
Thanks,
ShashiAfter lot of permutation and combination, I figured it out how to change the color.
Changing colorPalette to 'colorPalette' : ['#00B050','#CCFF66','#FF0000','#FFC300'], it worked
var oBarChart = new sap.viz.ui5.Pie({
width : "80%", height : "400px",
plotArea : {
'colorPalette' : ['#00B050','#CCFF66','#FF0000','#FFC300']
title : { visible : true, text : 'Revenue By Country' },
dataset : oDataset -
OBIEE 11g pie chart showing the slices by different measures
Hi,
We are using OBIEE 11g. We have a requirement to show PO Met Count , PO Under Count, PO Over Count as a slices in a pie chart. However Pie graph in 11 g is slicing only by a dimension and not by the above measures. This was possible in 10g. I want to know if this a limitation in 11g or is there a way around this.
Regards
Purvi
Edited by: user13054333 on Dec 1, 2010 11:20 PMHI,
I tried to slice by measure by dragging the column to slice size section. I have 3 metrics PO Under Count and PO Over Count which add up to total PO count. So I want my pie to ahve 2 slices one for PO Under Count and other for PO Over count. However when I drag the 2 metrics, it shows me 2 pies, one for Over and the other for Under count.
Regards'
Purvi -
Hi all
I have created a pie chart.
Its all working fine.
Here in the above image we can see one section is selected and the message is in circle shape.
And here we can also deselect the selected section.
But the problem here is when i use the same application in my colleague's system then message is not in circle shape
and here he is not able to deselect the selected section.
u can see the difference in the below image.
I think this is an version problem, but i don't exactly where the problem is.
Please suggest me on how to make it work.
Thanks
Sathish.Hi Sakthi
In the below code
var oEvDataSet = new sap.viz.ui5.data.FlattenedDataset("EV_REPORT_DATASET",{
dimensions : [
name : "ZONE",
axis : 1,
value : "{Key}"
measures : [
name : "NUMBER",
value : "{Number}"
data : {
path: "EVENTREPORT>/ZONE"
//path: "EVENTREPORT>/Category"
From the dropdown if select zone i'm using the above dataset for piechart.
But we have the option to select pie chart criteria as STATE also.
Now how do i dynamically change the name(dimension) and path(data) of the above dataset.
How can i do that...??
Thanks
Sathish -
Custom built field to be used as lable in pie chart having multiple values
Hi All,
I have a requirement and if someone can throw some light, then I could try the same as I am stuck now.
I have a list of Cities and I have to show the Top 5 Cities and remaining all should be "All Others". I have used Rank and was able to Show Top 5 and combine rest everything into "All Others" through a logic.
e.g:
City Sales Rev
Belarus 1000
Delhi 2000
Melbourne 2500
Sydney 2000
Singapore 1500
All Others 4500
Now I have to show this new dimension combined like below and use New_City as Dim and Sales Rev as Measure in a Pie Chart. The Pie chart will be shown on Sales Rev as measure and the New_City which is a combination of a lot of other fields will show them as labels
New_City Sales Rev
Belaruschar(10)[Qty Sold] 1000
Delhichar(10)[Qty Sold] 2000
Melbournechar(10)[Qty Sold] 2500
Sydneychar(10)[Qty Sold] 2000
Singaporechar(10)[Qty Sold] 1500
All Otherschar(10)[Qty Sold] 4500
This is my requirement and I am stuck at combining City like Belaruschar(10)[Qty Sold] to form New_City because as and when I do this and remove City column from the table it starts throwing multivalue error or in some other style gives me a summation of the entire Sales Rev in each row.
If I can achieve the same in some other approach also, I would highly appreciate the same if someone can share their ideas.
RegardsGreetings,
Normally you can create a variable with a formula depending on the city's that you want to have.
For example using efashion, the following formula would give you two lines:
=If([City]="Miami";[City]Char(10)"1000";"Others")
Result would be something like
Miami
1000 1500
Others 20000
Please note this is only an example and then you can apply your ranking. However bear in mind due to aggregation the Others will be the sum of all the other City which are not included in your condition.
Regards,
Rico. -
Pie chart with resizable slice ?
Hello All,
Is it possible to create a pie chart with re-sizable slice.. ie user should be able to decrease and increase the area of any slice by just using mouse drag. If I increase area of any particular slice, other adjacent slice should automatically get reduced. Please provide me some pointers on this .
Regards,
DharmendraHi Deepak,
I had time dimension in the RPD.
I have stacked bar chart with same time dim like year & month in the report. when I go to legand and set navigation it is working fine. But not with pie chart.
I am not not sure what is the problem. When I click on Pie chart it is not navigating to the target report. Can it be any other issues..??? -
Drill does not work for pie chart in OBIEE 10.1.3.4
Request has a table and a pie chart. Dimension has 7-level hierarchy. Request has column from top level of dimension.
Table can drill down all 7 levels. Pie chart drills down two levels; third attempt to drill on chart brings back first level in both chart and table.
Anyone else experience this? I can find no bug report, but I have not been very successful at finding known bugs in MetaLink.Well, by Total - I mean next-to-total. Don't worry about it. I just wanted to make sure your hierarchy had no problems.
Here's what I've done (remember my version is different). I've selected Drill-In-Place in Dashboard properties (unless I do that - it goes to table view after drill). Then I've clicked in an area on pie chart. After this, I wasn't able to drill further down, until I went to another Dashboard page and back (previous drill level was still there) and then drilled again. Rinse and repeat. Browser - IE 7. I'm going to test it in Firefox now.
UPD: Firefox has no problem drilling through 4 levels of pie-chart. I guess the problem is IE's slow and buggy JS implementation.
Edited by: wildmight on Jan 27, 2009 8:21 AM
Maybe you are looking for
-
I cannot sync my iphone with my computer
I cannot sync my iphone with my computer. The laptop wont even recognise the iphone on itunes. I have had the phone for almost over2 years now. Its a 3GS iPhone. How do I fix this?? I have tried hooking up the iphone to various computers and they als
-
Uix passing page's view object as a parm to another page
I want to pass a VO used on one uix page for use as the view object on another page. I'm using 9.0.5.2 and bc4j. I'm trying code as follows: <bc4j:registryDef> <bc4j:rootAppModuleDef name="SmGoalsViewAppModule" definition="
-
Reg: Profit Center Group Upload Prog
Hi, In profit center group upload program im using FM: BAPI_PROFITCENTERGRP_CREATE, when im trying to upload data, in the flat file, if Hierarchy level '0' is appearing once means i can able to upload, but Hierarchy level '0' appears n number of time
-
How can I add new sites to the "Most Visited"-Latest Headlines baqr?
In Windows XP I had a bar in Firefox where I could add frequently accessed sites such as news websites and brokerages. == I got a new computer with Windows 7.
-
How to change the geometry dynamicly
Hello, I'm a newbie for java3d. I'm developing a degning tool with java3d, and need to change the geometry frequently therefore. However, the 3d result always shows the initial data only. Can someone gives me a hint about what's the problem, and how