How can i create a pie chart
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.
STF
Thanks 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
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 -
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 -
How can I creat a dynamic chart legend?
Will,I want to show multi hosts' dynamic CPU performance (the host ip can be changed).I use those code below for a test:
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="horizontal" backgroundColor="0xFFFFFF" initialize="init()">
<mx:Script>
<![CDATA[
import mx.charts.ChartItem;
import mx.charts.chartClasses.IAxis;
import mx.charts.chartClasses.LegendData;
import mx.charts.chartClasses.Series;
import mx.charts.events.ChartItemEvent;
import mx.charts.series.LineSeries;
import mx.collections.ArrayCollection;
import mx.containers.Canvas;
import mx.containers.HBox;
import mx.controls.Alert;
import mx.graphics.SolidColor;
[Bindable]
private var dayTimeV:int = 0;
[Bindable]
private var legendDP:ArrayCollection = new ArrayCollection();
//for record whether the ip changed by using the length
private var latestIp2Length:Object = new Object();
[Bindable]
public var statsPpg:ArrayCollection = new ArrayCollection([
new ArrayCollection([{dayTime:dayTimeV,CPU:24.0, IP:"100.0.2.0"}]),
new ArrayCollection([{dayTime:dayTimeV,CPU:27.6, IP:"100.0.2.1"}]),
new ArrayCollection([{dayTime:dayTimeV,CPU:35.4, IP:"100.0.2.2"}]),
new ArrayCollection([{dayTime:dayTimeV,CPU:31.6, IP:"100.0.2.4"}]),
new ArrayCollection([{dayTime:dayTimeV,CPU:28.3, IP:"100.0.1.6"}]),
new ArrayCollection([{dayTime:dayTimeV,CPU:27.2, IP:"100.0.1.9"}])
private function init():void{
latestIp2Length["100.0.2.0"] = 1;
latestIp2Length['100.0.2.1'] = 1;
latestIp2Length['100.0.2.2'] = 1;
latestIp2Length['100.0.2.4'] = 1;
latestIp2Length['100.0.1.6'] = 1;
latestIp2Length['100.0.1.9'] = 1;
initLegend();
createLineSeries();
private function createLineSeries():void{
for(var i:int = 0 ;i < statsPpg.length ;i++){
var lineSeries:LineSeries = new LineSeries();
lineSeries.yField = "CPU";
lineSeries.displayName = "CPU";
lineSeries.dataProvider = statsPpg[i];
lineSeries.id = "lineSeries"+i;
lineSeries.setStyle("adjustedRadius",2);
lineSeries.setStyle("radius",40);
lineSeries.setStyle("fill","#55CC33");
var series:Array = chartPPG.series;
series.push(lineSeries);
chartPPG.series = series;
//find the record using ip
private function indexOf(ip:String):int{
for(var i:int = 0 ; i < statsPpg.length ;i++){
if(statsPpg[i].getItemAt(0).IP == ip)
return i;
return -1;
private function modifyData():void{
dayTimeV++;
//all new added data
var forAdded:ArrayCollection = new ArrayCollection([
{dayTime:dayTimeV,CPU:24.0+Math.random()*10, IP:"100.0.2."+dayTimeV},
{dayTime:dayTimeV,CPU:27.6+Math.random()*10, IP:"100.0.2."+(dayTimeV+1)},
{dayTime:dayTimeV,CPU:35.4+Math.random()*10, IP:"100.0.2."+(dayTimeV+2)},
{dayTime:dayTimeV,CPU:31.6+Math.random()*10, IP:"100.0.2."+(dayTimeV+3)},
{dayTime:dayTimeV,CPU:28.3+Math.random()*10, IP:"100.0.1."+(dayTimeV+4)},
{dayTime:dayTimeV,CPU:27.2+Math.random()*10, IP:"100.0.1."+(dayTimeV+5)}
//the data(IP) appear at first time
var waitedForAdded:ArrayCollection = new ArrayCollection();
for(var i:int = 0 ; i < forAdded.length ;i++){
var index:int = indexOf(forAdded[i].IP);
if(index != -1){//if we found,append it
statsPpg[index].addItem(forAdded[i]);
}else{//if not,
waitedForAdded.addItem(forAdded[i]);
var j:int = 0;
for(i = 0 ; i < statsPpg.length ;i++){
// if length not changed,delete old data and add new
if(latestIp2Length[statsPpg[i][0].IP] == statsPpg[i].length){
delete latestIp2Length[statsPpg[i][0].IP];
var legendIndex:int = findLegendDPData(statsPpg[i][0].IP);
statsPpg[i].setItemAt(waitedForAdded[j],0);
latestIp2Length[waitedForAdded[j].IP] = statsPpg[i].length;
legendDP.setItemAt(newLegendData(waitedForAdded[j].IP),legendIndex);
j++;
}else{//if length changed,the data appended already
latestIp2Length[statsPpg[i][0].IP] = statsPpg[i].length;
private function addData():void{
dayTimeV++;
newData();
private function newLegendData(ip:String):LegendData{
var legendData:LegendData = new LegendData();
legendData.label= ip;
legendData.marker= new HBox();
legendData.aspectRatio=1;
return legendData;
private function findLegendDPData(ip:String):int{
for(var i:int = 0;i < legendDP.length;i++){
if(legendDP[i].label == ip)
return i;
return -1;
/* [Bindable]
public function get legend():ArrayCollection
var legend:ArrayCollection = new ArrayCollection();
for (var i:int = 0; i < statsPpg.length; i++)
var dataObject:Object = statsPpg[i][0];
legend.addItem(newLegendData(dataObject.IP.toString()));
return legend;
[Bindable]
public function set legend(legendData:ArrayCollection):void
legend = legendData;
private function initLegend():void
for (var i:int = 0; i < statsPpg.length; i++)
var dataObject:Object = statsPpg[i][0];
legendDP.addItem(newLegendData(dataObject.IP.toString()));
private function yAxisLabel(value:Object, previousValue:Object, axis:IAxis):String
return value + ' %';
]]>
</mx:Script>
<mx:Panel width="790" title="CPU.IP" layout="horizontal">
<mx:LineChart id="chartPPG" name="Comparison" showDataTips="true">
<mx:horizontalAxis>
<mx:CategoryAxis dataProvider="{statsPpg[0]}" categoryField="dayTime" title="Days" id="categories"/>
</mx:horizontalAxis>
<mx:verticalAxis>
<mx:LinearAxis labelFunction="{yAxisLabel}" title="CPU" id="yAxis"/>
</mx:verticalAxis>
<!--<mx:series>
<mx:LineSeries id="CPU" yField="CPU" xField="dayTime" displayName="CPU "/>
<mx:LineSeries id="IP" yField="IP" xField="IP" displayName="IP " />
</mx:series>-->
</mx:LineChart>
<!--<mx:Legend dataProvider="{chartPPG}" markerWidth="50" markerHeight="4" legendItemClass="MyLegendItem" direction="vertical" width="174"/>-->
<!--<mx:Legend id="myActionScriptLegend" creationComplete="createDynamicLegend(event)" />-->
<mx:Legend id="userLegend" dataProvider="{legendDP}"/>
<mx:Button label="AddNewData" click="modifyData()"/>
</mx:Panel>
</mx:Application>
the result is here:
Question:
1.I using the binding ArrayCollection legendDP as the Legend's dataprovider, the Legend's showing not changed when the legendDP changed
2.How can I fill the Legend's color,the result has no color showed.Can anyone help?
-
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 . -
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. -
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 can I programmatically clear a chart?
Hi,
Could you please let me know how can I programmatically clear a chart? I would like to run a code multiple times and everytime I run it , the chart should be cleared . I tried to find a History property node but seems like there is no such properfy node for chartIf I have conceived your problem clearly, there is of course history data property node for charts. You may get one by right clicking on chart
create>>Property node>>History data(which is last on list)
CLAD
Passionate for LabVIEW -
How can I create JScrollPane in my swing application with scroll bars movin
Hi,
How can we create scrollpanes moving with scrollbars.I tried many times with custom layout.but it does not work if i set custom layout.I hope that I will get my problem solved.
Thanks and Regards,
Rameh RKThis means it is not possible to create a pure unicode file without the byte order mark?
You wouldn't happen to know how a file with byte order mark should read on a Linux system?
Or if this possible or not?
Regards
Christian -
How can i create a new usb connection (service) on my iMac for sharing internet from my iPhone5 ( i seem have to deleted it )
i know its not a problem whit my carrier o data plan or sharing preferences on the ipone because when i use it un my laptop it works perfectly through
the usb and even works on the Imac through wifi and bluethood tethering but NOT through usb!!.
the problem is that trying to make it work i deleted the "profile" usb iphone on the network prefereces panel. Now i only have 3 options: ethernet / wifi / bluetooth
but not the usb iPhone i used to have.
And when i try to add a new one i dont get a USB option.
can some one help me please??
this is how it looks (after the bluetooth PAN i used to have USB iPhone option)The question would be more appropriate in the Mac forums as it is not really related to the iPhone.
-
How can I create a new ring tone for my iPhone 4?
How can I create a new ring tone for my iPhone 4? I followed the Garage Band process and ended up with the ring tone I want as a AAC audio file. It got stored in my iTunes a a song rather than a ring tone. How do I make it a ring tone vs. a song? I tried dragging it t the Ring Tone category at the bottom of the ITunes list, but it won't alloow me to move it?
There's also an easy to use Applescript over at Doug's Applescripts for iTunes. It automates the whole thing. All you do is set the start and stop time on a file in iTuens and run the script. It will do everything else.
Make Ringable v1.1
http://dougscripts.com/475 -
How can I create a text pop up window in my Pages document? I want text to pop up when the reader hovers his/her cursor over a certain word in the document. I am teacher. So for example when a student came to word he/she did not know, if he/she hovered the cursor over the word, a defintion or other information would appear. You can do this in Word using bookmarks/hyperlinks but I can't figure this out in Pages. I can link it to another point in my Pages document but I just need the text to pop up - not take the reader to another location. THANK YOU!!!!!!
Have you tried Word for Mac?
You will need to test if links survive export or printing to .pdf
Peter -
How can I create an csv/excel file using pl/sql and then sending that file
How can I create an csv/excel file using pl/sql and then sending that file to a clients site using pl/sql?
I know how to create the csv/excel file but I can't figure out how I would get it to the clients site.968776 wrote:
How can I create an csv/excel file using pl/sql and then sending that file to a clients site using pl/sql?
I know how to create the csv/excel file but I can't figure out how I would get it to the clients site.You are trying to do it at a wrong place..
Whay do you want database (pl/sql) code to do these things?
Anyhow, you may be interested in :
{message:id=9360007}
{message:id=9984244} -
How can i create datasource on apache server for ADF application?
Hi All,
i my use case i have created simple adf application using ADF BC and want to deploy on Apache server 6.x.
So my question is that how can i create Data Source i have goggling and find two different way to do this.
1. write following line of code on apache server conf/Context.xml file.
<Resource name="jdbc/TestDB" auth="Container"
type="javax.sql.DataSource"
driverClassName="oracle.jdbc.OracleDriver"
url="jdbc:oracle:thin:@localhost:dst"
username="jagrandb" password="jagrantest" maxActive="20" maxIdle="10"
maxWait="-1"/>
but when i have used this way i got following exception.
org.apache.tomcat.dbcp.dbcp.PoolingDataSource$PoolGuardConnectionWrapper cannot be cast to oracle.jdbc.OracleConnection
check link-
https://forums.oracle.com/thread/2564233
2. write following line of code apache conf/Server.xml file
<GlobalNamingResources>
<!-- Editable user database that can also be used by
UserDatabaseRealm to authenticate users
-->
<Resource name="UserDatabase" auth="Container"
type="org.apache.catalina.UserDatabase"
description="User database that can be updated and saved"
factory="org.apache.catalina.users.MemoryUserDatabaseFactory"
pathname="conf/tomcat-users.xml" />
<Resource name="jdbc/TestDB" auth="Container"
type="oracle.jdbc.pool.OracleDataSource"
description="User database that can be updated and saved"
driverClassName="oracle.jdbc.driver.OracleDriver"
factory="oracle.jdbc.pool.OracleDataSourceFactory"
url="jdbc:oracle:thin:@//172.31.43.207:1521:dst"
username="jagrandb" password="jagrantest" maxActive="20" maxIdle="10"
maxWait="-1" />
</GlobalNamingResources>
and add this line in context.xml file inside <context> tag
<ResourceLink global="jdbc/TestDB" name="jdbc/TestDB" type="oracle.jdbc.pool.OracleDataSource"/>
but when i have run application i have got following error
log-
javax.servlet.jsp.JspException: Unable to get connection, DataSource invalid: "java.sql.SQLException: invalid arguments in call"
at org.apache.taglibs.standard.tag.common.sql.QueryTagSupport.getConnection(QueryTagSupport.java:298)
at org.apache.taglibs.standard.tag.common.sql.QueryTagSupport.doStartTag(QueryTagSupport.java:181)
at org.apache.jsp.test_jsp._jspx_meth_sql_005fquery_005f0(test_jsp.java:110)
at org.apache.jsp.test_jsp._jspService(test_jsp.java:63)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:374)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:342)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:267)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:286)
at org.apache.coyote.http11.Http11AprProcessor.process(Http11AprProcessor.java:857)
at org.apache.coyote.http11.Http11AprProtocol$Http11ConnectionHandler.process(Http11AprProtocol.java:565)
at org.apache.tomcat.util.net.AprEndpoint$Worker.run(AprEndpoint.java:1509)
at java.lang.Thread.run(Thread.java:662)
Aug 2, 2013 5:17:21 PM org.apache.catalina.core.StandardWrapperValve invoke
SEVERE: Servlet.service() for servlet jsp threw exception
javax.servlet.jsp.JspException: Unable to get connection, DataSource invalid: "java.sql.SQLException: invalid arguments in call"
at org.apache.taglibs.standard.tag.common.sql.QueryTagSupport.getConnection(QueryTagSupport.java:298)
at org.apache.taglibs.standard.tag.common.sql.QueryTagSupport.doStartTag(QueryTagSupport.java:181)
at org.apache.jsp.test_jsp._jspx_meth_sql_005fquery_005f0(test_jsp.java:110)
at org.apache.jsp.test_jsp._jspService(test_jsp.java:63)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:374)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:342)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:267)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:286)
at org.apache.coyote.http11.Http11AprProcessor.process(Http11AprProcessor.java:857)
at org.apache.coyote.http11.Http11AprProtocol$Http11ConnectionHandler.process(Http11AprProtocol.java:565)
at org.apache.tomcat.util.net.AprEndpoint$Worker.run(AprEndpoint.java:1509)
at java.lang.Thread.run(Thread.java:662)
so what is the solution how to create datasource on apche server which suitable for adf application?
when i test data source using following code used 1. way as i mentioned above its running fine bt not for second.
<%@ taglib uri="http://java.sun.com/jsp/jstl/sql" prefix="sql" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<sql:query var="rs" dataSource="jdbc/TestDB">
select empname from pay_emphdr where empcd='JK1306'
</sql:query>
<html>
<head>
<title>DB Test</title>
</head>
<body>
<h2>Results</h2>
<c:forEach var="row" items="${rs.rows}">
Foo ${row.empname}<br/>
</c:forEach>
</body>
</html>
please help me. it is very urgent.
thanks in Advance
ManishHi Lindalnci
i have already tried this tutorial and in my post i have defined first way to do using this procedure.
in that case i have got following exception as i have mentioned above
org.apache.tomcat.dbcp.dbcp.PoolingDataSource$PoolGuardConnectionWrapper cannot be cast to oracle.jdbc.OracleConnection
Maybe you are looking for
-
Error while unmarshalling the IDOC using an IDOC OTD in JCAPS
Hi, I've created an OTD from SAP IDOC Type in SeeBeyond JCAPS 5.1.2. And when I'm trying to unmarshal the IDOC payload using OTD tester in eDesigner. And the same error is thrown at runtime also. I've tried with multiple IDOCs but no use. And when I
-
Problem in Customer Master Upload using LSMW
Hi, I am using LSMW direct input method to upload customer master. I have used ZSOURCE structure as parent structure and for multilple entries like Bank details and contact details i have used other child structure like ZBANK and ZCONTACT. I am using
-
Reuse image file from another DC
Hi everyone, Is it possible to re-use image file stored in the mimes folder of a component in a DC from another DC ? If it is possible, how do we access the image? Thanks, Johannes
-
Mac not connecting with PC network
I'm attempting to connect my Mac to a wireless internet network through a PC. The PC is connected through Qwest with a D-link router. The PC connection is working fine. The Mac sees the network and requests a password. I type the password, but nothin
-
Hi Gurus, How do I generate interfaces generated in SmartForms and generate PDF. I want to play each iteration of my loop on one page of PDF?