Creating a Pie Chart?
How can I...
1. Display the number of vowels, consonants, other characters,
2. Display the percent of vowels, consonants, other characters,
3. Display a pie chart using the above information,
4. All of this must be done in an applet.
5. Here is the program that does #1 and #2.
import java.text.DecimalFormat;
public class TextAnalyser
//String inputString =new inputString();
String inputString = new String();
int totalCharacters = inputString.length();
int numVowels = 0;
int numConsonants = 0;
int numOtherChars = 0;
double getPercentVowel;
double getPercentConsonants;
double getPercentOtherChars;
DecimalFormat threeDigits =new DecimalFormat("0.###");
public void main(String args[])
for(int i = 0; i < totalCharacters; i++)
char ch = inputString.charAt(i);
if ((ch == 'a') || (ch == 'A') || (ch == 'e') || (ch == 'E') || (ch == 'i') || (ch == 'I')
|| (ch == 'o') || (ch == 'O') || (ch == 'u') || (ch == 'U'))
numVowels++;
else if (Character.isLetter(ch))
numConsonants++;
else
numOtherChars++;
public int getNumberVowels()
return numVowels;
public double getPercentVowel()
double percentV = numVowels/totalCharacters;
percentV= Double.parseDouble(threeDigits.format(percentV));
return percentV;
public int getConsonants()
return numConsonants;
public double getPercentConsonants()
double percentC = numConsonants/totalCharacters;
percentC= Double.parseDouble(threeDigits.format(percentC));
return percentC;
public int getNumberOthers()
return numOtherChars;
public double getPercentOtherChars()
double percentO = numOtherChars/totalCharacters;
percentO= Double.parseDouble(threeDigits.format(percentO));
return percentO;
}
It has no public static void main( String args[] ) method.
How do you plan on executing this program anyway?
Similar Messages
-
How can we create dynamic pie chart in jsp
hi im a new jsp programmer and i just want to know how can i create dynamic pie chart in jsp
http://sourceforge.net/projects/jfreechart
- Saish -
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.
-
Creating a pie chart based on Pop-up Menu in Numbers
I would like to be able to select a persons name from the Pop-up menu in the F column to chose who has bought an item. I would then like to create a pie chart showing how much money each person has spent on buying the items and have this update automatically. I have no idea how I would go about doing this. Any help would be greatly appreciated.
Thanks1) make sure the pop-up has all the people in the list before you start.
2) eter the data in the table as you have shown then
3) add a new summary table (called "Summary"). Let's assume your existing table is titled "LOUNGE".
Add a new column (G) to your existing table, titled "Lounge":
G2=IF(ISBLANK(F2), "",IF(IFERROR(MATCH(F2, $F$1:F1, 0), 0)=0, MAX($G$1:G1)+1, ""))
select G2 and fill down as needed
Now make a new table (and call it "Summary"):
the first row and first column are headers.
A2=IF(ROW()-1<=MAX(Lounge :: G), OFFSET(Lounge :: $F$2, SMALL(Lounge :: G, ROW()-1)-1, 0, 1, 1), "")
select A2 and fill down as needed
B2=IF(LEN(A2)>0, SUMIF(Lounge :: F, "="&A2, Lounge :: D), "")
select B2 and fill down as needed
now select the cells B2 thu the end of the column then select the pie chart from the charts menu -
Anybody successfully created a Pie-chart?
I have tried with all the default options and keep getting
an "x"( the one that's shown by browser when it can't find an image file).
I understand the fact that Pie-Charts are still in Beta.
But at least they should work to have a successful look at them.
Or am I missing some important settings in Apache/Portal/Admin
that are masking this output?
These charts are one of the important criteria for us to continue using Portal.
Thank you verymuch.
MadhavHi Madhav ,
I agree with you
Pie charts is a beta version even in 3.0.9 .It is not possible to create the pie chart(you can create other charts) .If some body has any version more than 3.0.9 ,i don't know .the only way to show up pie charts may be to use seperate table and up load the pie charts and view them ,but not through the regular create components way.
Thanks
Vishnu Singireddy -
How to create a pie chart from a pop-up menu in Numbers?
I would like to be able to select a persons name from the Pop-up menu in the E column to chose who has bought an item. I would then like to create a pie chart showing how much money each person has spent on buying the items and have this update automatically. I have no idea how I would go about doing this. Any help would be greatly appreciated.
ThanksCosts per person, with "Ali & Baker" as a separate entity (since no provision for separating costs)
The formula is this:
=SUMIFS($Cost, $Who Bought it?, "="&$Who Bought it?, $Bought?, "=TRUE")
The reasoning is:
Sum all Costs, if the following conditions are true:
$Who Bought it?, "="&$Who Bought it?
Group items in the 'Who Bought it? column that match the item in the same row as the formula.
$Bought?, "=TRUE"
Only include items that have actually been bought.
Screenshot
I have highlighted the selected cell in red.
The coloured columns show which ones are relevant to the formula.
To create the totals, I added Footer rows to the table.
You could make a separate table if you prefer.
To create the pie chart, I selected just the costs in the footer rows, and clicked on Charts. -
How to Create a PIE chart with PPR
Hi All,
Can you please help me to achieve the below.
Can we create any Pie Chart. In Pie chart If we have 5 Parts when I click on any part of Pie chart It should display my new region below to the chart in the same page Page)?
Regards,
Mahendra.Hi
For Creation of pie- chart Please refer to dev guide under the section pie-graph
and as per ur req use the normal ppr for diff sections of pie-graph
regards
SasiKasyap . -
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. -
How can I create a Pie charts ?
HI all,
I'm a beginner in java and i'm investigate in a web project (website) which should display statistical charts. I did a beans to generate basic bar charts, but it is most difficult to build a Pie chart. That's why i need help to put me on the rigth way to build Pie Charts beans (this pie charts should be filled up with db query).
Every kind of help will be appreciated.
Thanks in advance
Hope someone can help me.
STFI take it you constructed the bar graphs using html and images together?
Obviously it's a little more difficult to make a pie chart with html. Chances are that it will have to be an image rendered by a Servlet or JSP. I suggest looking at how to create images using AWT or swing. This will allow you to create a circle with different color slices and what not. Then you need a Servlet or JSP that will send the image out the output stream. You can then place an image tag in your html page like this <img src="http://myserver.com/PieChartServlet>
I'm actually working on an API myself that will render pretty histograms (line graphs), and hopefully pie charts down the road. It's going to be an open source project. I decided to make my own API when I looked at some others out there who were charging an arm and a leg for theirs. Chart Builder for example, it's like $6K for their java based API <choke>.
So if you're interested, or anyone else is, shoot me an email and I'll let you know when the beta is ready. [email protected]
-Derek -
Business Graphics:Create multiple Pie charts dynamically
Hi Experts,
I have a requirement to create 10 different pie chart in a view in a Grid layout.
The charts will be created dynamically because the data will be known at runtime.
Any type of help will be appreciated
Regards.Hi,
Here is a simple example:
you must write this code in wdDoModfy() method, in if (firstTime){}
in the layout there is already created one transperent container with id BG_CONTAINER
//add a node
IWDNodeInfo loDynNode = wdContext.getNodeInfo().addChild("DynNode", null, true, false, true, false, false, true, null, null, null);
//add some attributes to it
loDynNode.addAttribute("DynAttr1Str", "ddic:com.sap.dictionary.string");
loDynNode.addAttribute("DynAttr2Int", "ddic:com.sap.dictionary.integer");
//get the node
IWDNode node = wdContext.getChildNode("DynNode", 0);
//fill the node with some values
for (int i = 0; i < 10; i ++){
IWDNodeElement element = node.createElement();
element.setAttributeValue("DynAttr1Str", "Str value " + i);
element.setAttributeValue("DynAttr2Int", new Integer(i));
// Add to the content
node.addElement(element);
//get the attributes, we will use the attrinfo to bind them to the series
IWDAttributeInfo loDynAttr1StrInfo = loDynNode.getAttribute("DynAttr1Str");
IWDAttributeInfo loDynAttr2IntInfo = loDynNode.getAttribute("DynAttr2Int");
//create the graphics
IWDBusinessGraphics loGraphics = (IWDBusinessGraphics)view.createElement(IWDBusinessGraphics.class,"bg1");
//set the type to pie
loGraphics.setChartType(WDBusinessGraphicsType.PIE);
//create a simple series and bind the integer attribute to it
IWDSimpleSeries loSSeries = (IWDSimpleSeries)view.createElement(IWDSimpleSeries.class, "Series1");
loSSeries.bindValue(loDynAttr2IntInfo);
//create the category and bind the string attribute to it
IWDCategory loCategory = (IWDCategory)view.createElement(IWDCategory.class,"Category1");
loCategory.bindDescription(loDynAttr1StrInfo);
//add series and category
loGraphics.addSeries(loSSeries);
loGraphics.setCategory(loCategory);
//I assume that there is a transperent container already created design time to put the graphics there
//container with id BG_CONTAINER
IWDTransparentContainer loContainer = (IWDTransparentContainer)view.getElement("BG_CONTAINER");
//add the graphics
loContainer.addChild(loGraphics);
If this is the type of graphics you need then you must simply do a for cycle and supply the graphics with the right node elements and you are ready.
Best regards,
Anton -
Flash AS3.0, Create bar, pie chart.
hi
how to create flash bar and pie chart in actionscript3.0. any ideas about this, any refference file.
any samples file give me
thnksHi Ned,
I found a AS3 tutorial for Bar Chart.
http://code.tutsplus.com/tutorials/create-a-dynamic-bar-graph-generator-using-xml-as3--act ive-2639
How do I modify the height of the Graph Bar?
How do i create increase or decrease the spacing between the Graph Bar? -
How to create a pie chart with jsp/servlet?
I want to create a servlet which can be used like below:
<img src="pieservlet?param1=<%=x%>¶m2=<%=y%>&..." width="100" height="100" >
can you give me some guide?Hai ,
I have implemented a trial working pie chart , dynamically created from jsp using ServletOutputStream , BufferedImage & JPEGImageEncoder (found in com.sun.image.codec.jpeg.* package & bundled along with jdk ) .
<%
ServletOutputStream sout = response.getOutputStream();
response.setContentType("image/jpeg");
BufferedImage img = new BufferedImage(400,400,BufferedImage.TYPE_INT_RGB);
Graphics2D gr = img.createGraphics();
/* Actually this will be got as values of request.getParameter */
Vector values = new Vector();
values.addElement(new String("45") );
values.addElement(new String("125") );
values.addElement(new String("75") );
values.addElement(new String("25") );
values.addElement(new String("90") );
// my demo class
temp.pieChart fr = new temp.pieChart(400,400,values);
/* This pieChart is class extends JFrame , in paint method of it all Drawing of pie chart using graphics2D fillArc done */
fr.paint(gr);
JPEGImageEncoder encoder = JPEGCodec.createJPEGEncoder(sout);
encoder.encode(img);
sout.flush();
%>
Hope this helps to build your own custom pie chart .
Let me know if details needed on pieChart class
rakesh
-
Create a pie chart autoshape and specify exact angles
I am able to use the Pie Chart autoshape tool to create a new pie chart with segments. Is it possible to specify the exact angles I want for these segments?
You can customize the segments with the AutoShape Properties panel.
-
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 -
Hi all,
I'm a beginner in java and i'm investigate in a web project (website) which should display statistical charts. I did a beans to generate basic bar charts, but it's most difficult to build a pie chart. That's why i need help to put me on the right way of building a Piechart beans.
All kind of help will be precious
Thanks in advance.
STFThanks a lot for your reply.
But it shall works in a beans and this was set up only for applications or applet. Besides it seems (i'm really not sure but i have found lot of thread)that an applet can't be run into a jsp page that is searching data into db (thanks to sql query)
: there is a problem of buffer (tomcat can't generate the jsp page in the same time as it execute the applet).
Let me know if i'm wrong or not please ?
Regards
STF
Maybe you are looking for
-
How to Move from One Apple ID to Another
My wife and I use the same Apple ID on our separate iPhones. How can she disconnect from using that ID and establish her own?
-
Safari will not let me login to facebook.
I've had this problem for a while now, and every time I try to login to facebook, I get this error message: Safari can't open the page. Safari can't open the page "https://login.facebook.com/login.php" because it couldn't establish a secure connectio
-
URGENT Please: Problem after run autoconfig patch(Advanced_Inbound 5505631)
Hi First I must say that I am new on applying patches on Oracle applications. I have just applied a patch for Advance Inbound 5505631. The patch went well with no error. I check the Applications and the patch was already in place. But when i run the
-
WONDERING IF ANYBODY OUT THERE HAS RESOLVED THE BUFFER OVER RUN PROBLEM WITH QUICKTIME ON VISTA SYSTEMS. SOMEBODY HELP. CAN'T PLAY MY DIGITAL VIDEOS.
-
How do I get rid of ad track king?
How do I get rid of ad track king for good?