Latest Tutorials| Questions and Answers|Ask Questions?|Site Map



Home Answers Viewqa Java-Beginners Regarding Gantt chart generation

Have Programming Question? Ask it here!
 
 
 


amrutha
Regarding Gantt chart generation
3 Answer(s)      5 years ago
Posted in : Java Beginners



Advertisement
View Answers

May 16, 2009 at 3:59 PM


Hi Friend,

To create a simple Gantt chart, try the following code:

import java.awt.Color;
import java.util.Date;
import java.util.Calendar;
import org.jfree.ui.ApplicationFrame;
import org.jfree.ui.RefineryUtilities;
import org.jfree.chart.ChartFactory;
import org.jfree.chart.*;
import org.jfree.chart.JFreeChart;
import org.jfree.data.category.IntervalCategoryDataset;
import org.jfree.data.gantt.Task;
import org.jfree.data.gantt.TaskSeries;
import org.jfree.data.gantt.TaskSeriesCollection;
import org.jfree.data.time.SimpleTimePeriod;


public class GanttChartExample {
private static Date date( int day, int month, int year) {

Calendar calendar = Calendar.getInstance();
calendar.set(year, month, day);
Date result = calendar.getTime();
return result;
}
public static void main( String[] args) {


TaskSeries schedule1 = new TaskSeries("Scheduled Tasks");
schedule1.add(new Task("Feasibility Study",
new SimpleTimePeriod(date(1, Calendar.JANUARY, 2008),
date(10, Calendar.JANUARY, 2008))));
schedule1.add(new Task("Requirement Analysis",
new SimpleTimePeriod(date(11, Calendar.JANUARY, 2008),
date(21, Calendar.JANUARY, 2008))));
schedule1.add(new Task("Designing",
new SimpleTimePeriod(date(22, Calendar.FEBRUARY, 2008),
date(21, Calendar.MARCH, 2008))));
schedule1.add(new Task("Coding",
new SimpleTimePeriod(date(22, Calendar.MARCH, 2008),
date(30, Calendar.MAY, 2008))));
schedule1.add(new Task("Testing",
new SimpleTimePeriod(date(2, Calendar.JUNE, 2008),
date(18, Calendar.JUNE, 2008))));
schedule1.add(new Task("Implementation",
new SimpleTimePeriod(date(19, Calendar.JUNE, 2008),
date(31, Calendar.JULY, 2008))));
schedule1.add(new Task("Post Implementation",
new SimpleTimePeriod(date(1, Calendar.AUGUST, 2008),
date(1, Calendar.NOVEMBER, 2008))));

TaskSeries schedule2 = new TaskSeries("Actual Done");
schedule2.add(new Task("Feasibility Study",
new SimpleTimePeriod(date(1, Calendar.JANUARY, 2008),
date(15, Calendar.JANUARY, 2008))));
schedule2.add(new Task("Requirement Analysis",
new SimpleTimePeriod(date(16, Calendar.JANUARY, 2008),
date(29, Calendar.JANUARY, 2008))));
schedule2.add(new Task("Designing",
new SimpleTimePeriod(date(22, Calendar.FEBRUARY, 2008),
date(30, Calendar.MARCH, 2008))));
schedule2.add(new Task("Coding",
new SimpleTimePeriod(date(1, Calendar.APRIL, 2008),
date(20, Calendar.JUNE, 2008))));
schedule2.add(new Task("Testing",
new SimpleTimePeriod(date(21, Calendar.JUNE, 2008),
date(8, Calendar.JULY, 2008))));
schedule2.add(new Task("Implementation",
new SimpleTimePeriod(date(9, Calendar.JULY, 2008),
date(23, Calendar.AUGUST, 2008))));
schedule2.add(new Task("Post Implementation",
new SimpleTimePeriod(date(1, Calendar.SEPTEMBER, 2008),
date(10, Calendar.DECEMBER, 2008))));


May 16, 2009 at 4:00 PM


continue..........

TaskSeriesCollection collection = new TaskSeriesCollection();
collection.add(schedule1);
collection.add(schedule2);
IntervalCategoryDataset dataset= collection;

JFreeChart chart = ChartFactory.createGanttChart(
"Gantt Chart Example", // chart Heading
"Task", // X-axis label
"Date", // Y-axis label
dataset, // dataset
true, // legend
true, // tooltips
false // urls
);
chart.setBackgroundPaint(new Color(0xff,0xff,0xcc));
ChartFrame frame=new ChartFrame("Gantt Chart",chart);
frame.setVisible(true);
frame.setSize(400,350);
}
}

Thanks


March 17, 2011 at 4:55 AM


How I can embed the Ganttchart on JSP page ???



Related Tutorials/Questions & Answers:
Regarding Gantt chart generation - Java Beginners
Regarding Gantt chart generation  how to generate a jdbc gantt chart..., To create a simple Gantt chart, try the following code: import...; JFreeChart chart = ChartFactory.createGanttChart( "Gantt Chart
regarding bill generation - JSP-Servlet
regarding bill generation  in this program it is connected with database in mysql.when a customer or user enters he can able to see his payable amount as well as what he paid before as bill
Advertisements
gantt charts - Swing AWT
gantt charts  Hello, i am doing project on project management tool there i need to generate a gantt chart for daily activity done by developer regarding how many hours they have spent for each activity. If the database contains
gantt charts - Java Beginners
gantt charts  Actually while generating the gantt chart it has...( "Gantt Chart Example", "Task", "Date...)); ChartFrame frame=new ChartFrame("Gantt Chart",chart); frame.setVisible
pdf generation.
pdf generation.  i want to generate the data which is stored in mysql data base in pdf format with php. how i will do
report generation
report generation  hi i found some source codes related to barchart and pie chart .when i try to run thise code its showing me the error as :- java.lang.NoSuchMethodError: org.jfree.text.TextBlock.setLineAlignment(Lorg/jfree/ui
Barcode generation
Barcode generation  hi, I am working on a project where there is a alias no. with symbology EAN-13 for generation of barcode... now i have to write the logic for one item no if their are two or more quantities it should
Doubt regarding charts and jsp
Doubt regarding charts and jsp  Hi, I successfully executed the bar chart in normal java application. But I want the Bar Chart to be executed...-jsppage.shtml http://www.roseindia.net/jsp/draw-statistical-chart-jsp.shtml
jfree chart
jfree chart  i need donut chart using jfree
pie chart
pie chart  how to create pie chart using struts2
report generation using jsp
report generation using jsp  report generation coding using jsp
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
regarding rev
regarding rev  write a prog. in java that display all the arguments passed at the command line in reverse order
Regarding repository
Regarding repository  How to check in and check out using SVN repository using eclipse
bar chart
bar chart  how to create a bar chart from values of the database and the string value should be the entities of the database??plzz help..needed badly
report generation - EJB
report generation   how to create the report in java
Regarding Hibernate
Regarding Hibernate  Both JDBC and Hibernate are used to connect to database then whats the need of going to hibernate? What are the main differences? And could you let me know please
Regarding Project
Regarding Project  sir, i am doing a project in java. my project is CITY GUIDE it is an web application. please give me documentation of my project
Regarding Project
Regarding Project  sir, i am doing a project in java. my project is CITY GUIDE it is an web application. please give me documentation of my project
Doubt regarding charts and jsp
Doubt regarding charts and jsp  Hi in the http://www.roseindia.net/chartgraphs/barchart-jsppage.shtml of the code (new StandardEntityCollection..."); ChartUtilities.saveChartAsPNG(file1, chart, 600, 400, info); } catch (Exception e
Regarding javascript
Regarding javascript  Hi, I want 4 upload buttons in HTML CODE and Among 4 browse buttons user is not selected any one then provide a prompt message like plz select any 1 file among 4 buttons.If user is selected either 1st
PDF Generation for unicode characters
PDF Generation for unicode characters  Hi, How a PDF file having unicode characters is generated in JSP
jaret timebars
containing rows of intervals. The viewer displays the intervals in a Gantt chart... (classic gantt) and vertical orientation addon package supports using
Regarding Datasource
Regarding Datasource  Hi friend, Good morning,how r u,i want to share 1 information to u,I got a job in VERIZON DATA SERVICES INDIA PVT.LTD,u help a lot when i am in academic project,with that project only i got a job
regarding jtable...
regarding jtable...  sir, im working with jtables. i wanted to populate a jtable from the database and when i click any row it should add a container below that row itself and show the required details of the row
barchart generation - Java Beginners
barchart generation  Please suggest me how to generate the bar chart for this type of query. JDBCCategoryDataset dataset=new JDBCCategoryDataset(co,"SELECT rsa,rors,dda from activity where pcode=? and taskname=? and date
regarding project
regarding project  OBJECTIVES OF THIS PROJECT: -Ability to test the programmer for basic interaction skills to understand the client requirement. -Ability of the programmer to ask the right questions and get
regarding project
regarding project  OBJECTIVES OF THIS PROJECT: -Ability to test the programmer for basic interaction skills to understand the client requirement. -Ability of the programmer to ask the right questions and get the relevant
regarding project
regarding project   sir we need help about project. we have idea about his project please guide me sir. OBJECTIVES OF THIS PROJECT: -Ability to test the programmer for basic interaction skills to understand the client
Table generation error - EJB
Table generation error  Hi friends I am using EJB3.0 with sun java system application server 9.1 with postgresql database. Actually when i make an EJB it gives the following exception and doesnt generate any table
Hibernate generation Id to postgreSQL
Hibernate generation Id to postgreSQL  Hi, I'm trying to implement a id generator in Hibernate, but I'm having a problem. Hibernate doesn't seems to reset the counting when the id is generated. For example: 1 - In PostgreSQL I
Query regarding JSP, JDBC
Query regarding JSP, JDBC  can I get the code for the question asked by me regarding JSP,JDBC
draw chart in web application
draw chart in web application  how to draw bar chat from the record store in database? i.e. draw the bar chart according to selected record
Chart & Graphs Tutorials in Java
Chart & Graphs Tutorials in Java  ... in Java. Our Chart and Graphs tutorials will help learn everything you need to learn about chart and graphs programming in Java. We have provided many examples
regarding jdbc - JDBC
regarding jdbc  how i can configure java with ms access
chart tutorial - Java3D
chart tutorial  Hi I need a JFree Chart class library in order to design a chart with java  Hi friend, For JFree Chart class library... information,Tutorials and Examples on JFree Chart visit to : http://www.roseindia.net
Automatic primary Generation in Hibernate - Hibernate
Automatic primary Generation in Hibernate   Hi, Ow primary key is generated automatically in hibernate.give me sample code.Thank u
Clickable chart with Tool Tip
Clickable chart with Tool Tip  Can we generate the charts with tooltip and onclick events using jfreechart in jsps and servlets
Bar chart implementation in PHP
Bar chart implementation in PHP  How to implements reports in bar graphs by using PHP
Regarding project - Applet
Regarding project  hi friend , iam doing project in Visual cryptography in Java so i need the Help regarding how to make a share of a original imahe into shares anu
Regarding weblogic portal
Regarding weblogic portal  Hi, My name is Ramanuja.i am working on weblogic portal.if u know any info regarding plz provide the materials or information to me.plz help me. Thanks in advance
regarding JTable - JDBC
regarding JTable  how to populate a JTable with mysql data after clicking JButton please explain with the example
regarding tags - Struts
regarding tags  What is the difference between html:submit and nested:submit and usage of tags based on the situation
regarding struts 2
regarding struts 2   is it not possible to get values from applicationresources.properties into our application in struts 2
Regarding GUI Applications
Regarding GUI Applications  How to create a save and open jmenu item in java desktop application
Regarding core java
Regarding core java  how do we find reverse of string with out using String functions
Play framework dynamic form generation
Play framework dynamic form generation  I want to generate dynamic forms using play framework can any one give me some idea about dynamic form generation using play framework
surface chart - Java3D
surface chart  i have to make a surface chart of a piece of land with data given for each point in the xy plane....the chart should be such that the areas with different data range should show up in different colour. seriously
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
regarding j2me - Java Beginners
regarding j2me  sir but i have to use the drawString u tell me how can i display two too long strings
Advertisements
 

 

 

DMCA.com