Home Answers Viewqa Java-Beginners Regarding Gantt chart generation

 
 


amrutha
Regarding Gantt chart generation
3 Answer(s)      4 years and a month ago
Posted in : Java Beginners

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 Pages:
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
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
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
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
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
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
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
jaret timebars
containing rows of intervals. The viewer displays the intervals in a Gantt chart... (classic gantt) and vertical orientation addon package supports using
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
JFreechart Stacked Bar Chart
JFreechart Stacked Bar Chart JFreechart provides a way to create various... chart, pie chart, line chart,area chart etc. Here we are going to create a Stacked Bar Chart. This chart actually displays the result of multiple queries stacks
graph generation using jfreechart and retrieving values from the database
graph generation using jfreechart and retrieving values from the database ... jfreechart API .This whole retrieval and display of chart is to be done in a servlet...="org.jfree.data.jdbc.JDBCCategoryDataset"%> <% String query="SELECT * from chart
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
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
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
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 rev
regarding rev  write a prog. in java that display all the arguments passed at the command line in reverse order
PDF Generation for unicode characters
PDF Generation for unicode characters  Hi, How a PDF file having unicode characters is generated in JSP
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
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
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 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
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
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 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

Ask Questions?

If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.

Ask your questions, our development team will try to give answers to your questions.