mpetek Posted May 5, 2010 Share Posted May 5, 2010 Is it possible to create this type of chart with iReport?Example:/uploads/projects/ireport/image/gantt_example.jpg The colored areas should be specified by begin and end datetime, the colors should be set from the datatable.With a gantt chart, I cannot place the different tasks into a single bar. Is there a way to "flatten" a gantt chart to a single bar or can this somehow be achieved with a stacked bar chart? thanks in advance,michael Link to comment Share on other sites More sharing options...
jrot Posted May 4, 2011 Share Posted May 4, 2011 I also am trying to make a gantt chart...I tried using the report here http://code.google.com/p/jaspertest/source/browse/trunk/reports/ganttchart.jrxml to work as a template, and I can't get it to Preview/generate the report.But from trying a few things, it looks as if I cannot chart time periods over a one-day schedule - What I need is to chart the scheduled shifts of users, and their logins and pauses against that. Each user will have one or more scheduled intervals, one or more login sessions, and zero or more pause intervals. I want the scheduled intervals all in line horizontally, the login sessions all in line horizontally, and the pauses all in line horizontally.Is it possible to do this with a gantt chart? I looked all over for tutorials on gantt charts, even excel ones, and nothing seems to deal with this scenario...Can anybody help me? attached is a mockup of what the chart should look like. Link to comment Share on other sites More sharing options...
jrot Posted May 4, 2011 Share Posted May 4, 2011 Okay I played around with it some more, and I can get times to work.However, it is doing something strange with the start and end times - see the attached pic:1) I set the category up like this, since the chart seemed to want a date range: <fw:startExpression><![CDATA[new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").parse("2011-05-02 00:00:00")]]></fw:startExpression> <fw:endExpression><![CDATA[new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").parse("2011-05-02 23:59:59")]]></fw:endExpression> - but as you can see by the data records, the bars go to the right hand side. did I set the range wrong? how can I set the range dynamically? eventually I want to have a user-input start and end date for the report, so start and end would be parameters... there is this wording in the dialog box:"You can specify the entire list of Categories providing an expression. It must return a List of CategoryData objects. The expression can not be used if you specify the Categories manually."I don't know what they mean by a List of CategoryData objects.2) you can't see it in the pic, but the mouseover/tooltip for each bar is showing the start and end wrong:for example, for user1, the pause goes from 14:02:15 - 14:31:05, however when I mousover, it shows 14:2:15 - 14:2:05. In fact for ALL the tooltips, the time is displayed as HH:2:ss. I used the property to set the format because by default it just shows the date only which is useless in this context... <fw:widgetProperty name="dateFormat"> <fw:propertyExpression><![CDATA["HH:mm:ss"]]></fw:propertyExpression> </fw:widgetProperty> any clue why it's doing this?3) the tasks for a given type (process?) are all shown in the same horizontal row, but I get two "listings" if there are two tasks - how do I prevent that second blank row from appearing?4) Is there any way to make the hours appear along the x-axis, and/or some vertical gridlines, to make it easier to see when a task starts/stops without having to mouseover it?Please help, this is SO close to what I need, I am sure that I just need to modify some settings/properties but I can't seem to find which ones to use. Thanks in advance! Link to comment Share on other sites More sharing options...
jrot Posted May 5, 2011 Share Posted May 5, 2011 I played around a lot with this yesterday, and I've hit a wall. I'll share what I learned, and ask some questions:1 & 4) I've gotten the one-hour time periods to display - however I had to hard-code them as a list of individual categories. I tried asking over at the fusioncharts forum and got no help (they suggested I post here instead). How would I use an expression to get a list of CategoryData objects, what does that mean?2) I got the times on the taskbars displaying correctly - it turns out that in the fusioncharts, when you specify a time format, you don't specify "HH:mm:ss" as one would expect, but rather "HH:mn:ss". weird but okay.3) After looking at a lot of example from the fusioncharts site (they are kind enough to provide the xml for each of their many examples), I can't seem to figure out how to get the tasks/processes sorted out correctly.The closest thing I can get to what I want is in the attached sched chart 3.jpg, and it is achieved by having my report group by user, then putting a chart in the footer for the group, using the first value {sheduled shift, payable time, non-payable pauses} as the process, and then the second value {scheduled shift, login, lunch} as the task. But it seems like it is making a new process for every record - notice there are two "rows" (processes) for payable time. I tried specifying the processes each individually (hardcoding the name/id for each), I tried providing the expression, and I tried doing it within the task. Nothing eliminates that extra row.Ideally though, what I want is a combination of two example charts I found:http://www.fusioncharts.com/widgets/Gallery/Gantt2.html shows the people as processes, and a set of tasks all in the same row. looking at the xml it seems they achieved that by making sure that all the tasks that are to appear in the same horizontal line have the same process id assigned to them.http://www.fusioncharts.com/widgets/Gallery/Gantt5.html shows the different processes {writing, signing, etc} each having two tasks, but the tasks are shown one above the other. Looking at the xml it seems they categorized the two different color bars for each by giving them different labels - but I tried doing something like that in my report and it didn't work.What I really want is to have one gantt chart, with each user as a process, some additional info from my query in the datatable (such as total payable time), and the different types of tasks {scheduled shift, payable time, and non-payable pauses} each as a different color and different horizontal row. taskgroups with more than one task belonging to it (like the two login tasks that are both "payable time") should appear on the same horizontal row.Does anyone have any idea how I can accomplish this? Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now