Pie chart on jsp

Pie chart on jsp

how can i create a pie chart on a jsp page using jfreechart which takes values from my databaase??

View Answers

July 3, 2012 at 4:56 PM

Here is a jsp code that creates a pie chart using JFreechart api and takes the value from the database.

<%@page import="java.sql.*"%>
<%@page import="java.io.*%>
<%@page import="org.jfree.ui.*%>
<%@page import="org.jfree.chart.ChartPanel%>
<%@page import="org.jfree.chart.ChartFactory%>
<%@page import="org.jfree.chart.ChartUtilities%>
<%@page import="org.jfree.chart.JFreeChart%>
<%@page import="org.jfree.data.*%>
<%@page import="org.jfree.data.jdbc.JDBCPieDataset%>

<%
                String query = "SELECT * from result";
                JDBCPieDataset dataset = new JDBCPieDataset(
                                "jdbc:mysql://localhost:3306/test", "com.mysql.jdbc.Driver",
                                "root", "root");

                dataset.executeQuery(query);
                JFreeChart chart = ChartFactory.createPieChart("Test", dataset, true,
                                true, false);
                ChartPanel chartPanel = new ChartPanel(chart);
                chartPanel.setPreferredSize(new java.awt.Dimension(500, 270));
                ApplicationFrame f = new ApplicationFrame("Chart");
                f.setContentPane(chartPanel);
                f.pack();
                f.setVisible(true);
%>

For the above code, we have created a database table named result which consists of two fields, id and marks.









Related Tutorials/Questions & Answers:
Pie chart on jsp
Pie chart on jsp  how can i create a pie chart on a jsp page using jfreechart which takes values from my databaase??   Here is a jsp code that creates a pie chart using JFreechart api and takes the value from
Create a Pie Chart in jsp Page using JFree Chart
Create a Pie Chart in jsp Page using JFree Chart  Hello Sir I followed ur tutorial on "CREATE A PIE CHART IN JSP PAGE USING JFREE CHART... the pie chart report and after that save it to the desired location.Kindly help me
Advertisements
pie chart
pie chart  how to create pie chart using struts2
Pie chart
Pie chart  hi................. In my project i want to create a pie-chart by taking values at run time. As want to display it in pie chart form....   Java Swing PIE Chart
Create a pie chart in jsp page using JFreeChart
Create a pie chart in jsp page using JFreeChart... to create a pie chart in jsp page using JFreeChart. Code given below creates a simple pie chart for given values. In the code given below we have extended class
pie chart
pie chart  hii..how to display data from database and show it in piechart according to different data that is present in database..plzz help
3d pie chart - Java3D
3d pie chart  Dear Sir, i want to create 3d pie chart using jsp, i have some code for 2d pie chart in jsp and 3d pie chart in applet. for 2d pie chart my jsp page is running properly but for 3d i used some code from applet
Create pie chart
Create pie chart  hi............. In my project i want to create a pie chart to display the result. i require a very simple code in java swings were i can edit the code and put my values... so plz help me
How to draw pie chart in J2ME
How to draw pie chart in J2ME  Hi, I'm developing a program using J2ME and I want to draw a pie chart but it seems J2ME language hasn't available chart component like JFreeChart in Java! could any one help me how can I draw a pie
Pie Chart
Pie Chart       In this section we are providing you an example to create a Pie Chart. Description of Example   For creating a Pie Chart we use PieDataset
Pie Chart - Java Beginners
Pie Chart  How to Draw a Pie chart using graphics in java  Hi friend, I am going to post complete running code. import java.awt.... ChartPanel(values, names, "Simple Pie Chart")); WindowListener wndCloser = new
Pie chart Jfree create error
Pie chart Jfree create error  hi........... thanks 4 ur help but when i am using the code which has a import file import org.jfree.chart.*; its giving me an error that " package org.jfree.chart does not exists " can u help me
3D Pie Chart
3D Pie Chart       In this section we are providing you an example to create a 3D Pie Chart. Description of Program :    For creating a 3D Pie Chart we use
Draw Pie Chart
Draw Pie Chart       This Java Pie Chart example is going to show you how to draw Pie Charts in Java. This Java Pie Chart example is drawing a pie chart to show
pie chart flex and sum from hql request
pie chart flex and sum from hql request  hi, i work with flex and j2ee project.i have to make a function wich return list of value: print("public... to show the result in the pie shart but the probleme is i don't have a field
PHP GD Pie Chart
_ARC_PIE); imagefilledarc($image, 150, $i, 200, 100, 45, 75 , $darkgray, IMG_ARC_PIE);ADS_TO_REPLACE_4 imagefilledarc($image, 150, $i, 200, 100, 75, 360 , $darkred, IMG_ARC_PIE); } imagefilledarc($image, 150, 150, 200, 100
Create Pie Chart using database values
Create Pie Chart using database values Java provides JFreeChart library which... a pie chart by retrieving the values from the database. Here is the code...*; import org.jfree.data.jdbc.JDBCPieDataset; public class Chart { public static
Bar Chart in JSP - JSP-Servlet
Bar Chart in JSP  Hi I am creating Bar chart using Jfree charts in JSP. Please advise me how to customize it. Like controlling the colors, width for each bar, showing values above the bar .  hi friend, Use
line chart from database in jsp
line chart from database in jsp  how can i create line chart from database in jsp code
create chart - JSP-Servlet
.jrxml report. I want to create a chart using ireport software. I m using sql...(primary key) title status I want to show chart of field "date" only... and free hours is green are filled that chart So pls help me to solve
Create multiple pie chart in single frame using JFreeChart
Create multiple pie chart in single frame using JFreeChart... you how to create a multiple pie charts in a single frame in jsp page using JFreeChart. Code given below creates a simple pie charts for given values
Dynamin Jfree chart in jsp---error
Dynamin Jfree chart in jsp---error   While compiling this CODE...); JFreeChart chart = ChartFactory .createBarChart3D( "Stock Update", "runs...); try { ChartUtilities.saveChartAsJPEG(new File("c:\\chart.jpg"), chart
How to export chart(graph) generated by jsp into a excel?
How to export chart(graph) generated by jsp into a excel?  How to export chart(graph) generated by jsp into a excel? I have a jsp page which generates charts . Now I need those charts to be exported into an excel.please help
Bar Chart using JSP and tooltip to be implemented
Bar Chart using JSP and tooltip to be implemented  Hi Deepak, I have generated a bar chart in JSP using JFreeCharts but I could not get the tool tip for that. Please any one suggest me how to do that or provide some code. Help
generate charts using JSP
generate charts using JSP  any one know coding for generate bar chart or pie chart using JSP
JFreechart multi line chart help in JSP
JFreechart multi line chart help in JSP  Hi, I am am looking for and help in getting multi line chart with Jfree chart, i had manage to write a singe line chart but i need multy line can you please help. <%@page
create bar chart in jsp using msaccess database
create bar chart in jsp using msaccess database  thanks for reply...) org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:758) org.apache.jsp.bar<em>jsp.</em>...) org.apache.jsp.bar<em>jsp.</em>jspService(bar_jsp.java:57
design chart takes data from database and through jsp page
design chart takes data from database and through jsp page  how can I design chart takes data from database and through in jsp page
create bar chart in jsp using msaccess database
create bar chart in jsp using msaccess database  type Exception... to compile class for JSP An error occurred at line: 8 in the jsp file: /bar.jsp...\work\Catalina\localhost\chetana\org\apache\jsp\bar_jsp.java:57: cannot find symbol
display combination of a stacked area chart and line chart in one iframe using jfree - JSP-Servlet
display combination of a stacked area chart and line chart in one iframe using jfree  hello i have a problem related to jfree chart, i want to display combination of a stacked area chart and line chart in one iframe
JFree 3D Bar Chart not displaying in JSP - Java3D
JFree 3D Bar Chart not displaying in JSP  Hi I am trying to run JFree 3D bar chart written in your site under link: http://www.roseindia.net/chartgraphs/3Dbarchart-in-jsppage.shtml This is not working. PNG file
how to create a bar chart in jsp by fetching value from oracle databse?
how to create a bar chart in jsp by fetching value from oracle databse?  i want to show the population of various states in a bar chart in my jsp page by fetching the data from my oracle table. i am using my eclipse as my IDE
Draw Statistical chart in jsp
Draw Statistical chart in jsp   ... chart in jsp by getting values from database.. To draw a bar chart, we have.../jsp/bar.jsp to the address bar and hit enter. The image of chart is displayed
how to create bar chart in jsp using msaccess database
how to create bar chart in jsp using msaccess database  type...: Unable to compile class for JSP An error occurred at line: 10 in the jsp file...\Tomcat 5.0\work\Catalina\localhost\chetana\org\apache\jsp\bar_jsp.java:61: cannot
Create area chart in JSP page using JFreeChart
Create area chart in JSP page using JFreeChart... to create a area chart in JSP page using JFreeChart. Code given below creates a area chart of runs of two teams in different matches. In the code given below we
jsp - JSP-Servlet
jsp  Q) I need code to generate pie chart in JSP? Thanks for answering prevoius questions. Thank u  Hi friend, Code to solve the problem : Thanks
Create a bar chart in JSP page using JFreeChart
Create a bar chart in JSP page using JFreeChart... to create a bar chart in JSP page using JFreeChart. Code given below creates a bar chart...(): This method is used to save chart in to png format. jspbarchart.jsp
Chart & Graphs Tutorials in Java
Category Plot chart using JFreeChart.   Create a pie chart in jsp page using JFreeChart This Example shows you how to create a pie chart in jsp... Chart Example In this section we are providing you an example to create a Pie
ModuleNotFoundError: No module named 'pie'
ModuleNotFoundError: No module named 'pie'  Hi, My Python program is throwing following error: ModuleNotFoundError: No module named 'pie' How to remove the ModuleNotFoundError: No module named 'pie' error
Create a 3D bar chart in JSP page using JFreeChart
Create a 3D bar chart in JSP page using JFreeChart... to create a 3D bar chart in jsp page using JFreeChart. Code given below creates a bar chart of scores of two teams in matches. In the code given below
how to fetch data from mysql database table and draw a bar chart on that data using in jsp
how to fetch data from mysql database table and draw a bar chart on that data using in jsp  how to create bar chart fetch data from mysql database using in jsp.please give me a right code. yhanks in advance
ModuleNotFoundError: No module named 'nlp-pie'
ModuleNotFoundError: No module named 'nlp-pie'  Hi, My Python...-pie' How to remove the ModuleNotFoundError: No module named 'nlp-pie... to install padas library. You can install nlp-pie python with following command
ModuleNotFoundError: No module named 'pie-extended'
ModuleNotFoundError: No module named 'pie-extended'  Hi, My Python... 'pie-extended' How to remove the ModuleNotFoundError: No module named 'pie-extended' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'pie-jerry'
ModuleNotFoundError: No module named 'pie-jerry'  Hi, My Python... 'pie-jerry' How to remove the ModuleNotFoundError: No module named 'pie... have to install padas library. You can install pie-jerry python with following
ModuleNotFoundError: No module named 'pie_time'
ModuleNotFoundError: No module named 'pie_time'  Hi, My Python program is throwing following error: ModuleNotFoundError: No module named 'pie_time' How to remove the ModuleNotFoundError: No module named 'pie_time
ModuleNotFoundError: No module named 'savory-pie'
ModuleNotFoundError: No module named 'savory-pie'  Hi, My Python... 'savory-pie' How to remove the ModuleNotFoundError: No module named 'savory-pie' error? Thanks   Hi, In your python environment you
ModuleNotFoundError: No module named 'django-pie'
ModuleNotFoundError: No module named 'django-pie'  Hi, My Python... 'django-pie' How to remove the ModuleNotFoundError: No module named 'django-pie' error? Thanks   Hi, In your python environment you
ModuleNotFoundError: No module named 'flask-pie'
ModuleNotFoundError: No module named 'flask-pie'  Hi, My Python... 'flask-pie' How to remove the ModuleNotFoundError: No module named 'flask-pie' error? Thanks   Hi, In your python environment you
ModuleNotFoundError: No module named 'kiwis-pie'
ModuleNotFoundError: No module named 'kiwis-pie'  Hi, My Python... 'kiwis-pie' How to remove the ModuleNotFoundError: No module named 'kiwis-pie' error? Thanks   Hi, In your python environment you
how to generate a bar chart on a JSP PAGE using the arraylist object passed form the servlet.(using jfreechart)
how to generate a bar chart on a JSP PAGE using the arraylist object passed... the database.now i have to pass this arraylist object to a jsp page and on that jsp page... it.please reply soon.I am attaching my servlet and jsp page beneath. please reply

Ads