2011-01-10 18:03:19 -06:00
|
|
|
import com.jdbernard.timeanalyzer.*
|
|
|
|
import com.jdbernard.timestamper.core.*
|
|
|
|
import com.quantumdigital.ithelp.timeanalyzer.*
|
2011-01-11 08:21:41 -06:00
|
|
|
import org.joda.time.*
|
|
|
|
import org.joda.time.format.*
|
|
|
|
import org.jfree.chart.*
|
|
|
|
import org.jfree.data.general.*
|
|
|
|
import org.jfree.util.SortOrder
|
2011-01-10 18:03:19 -06:00
|
|
|
|
|
|
|
tep = new TimelineEventProcessor()
|
|
|
|
tep.exclusions << ~/Going Home/
|
2011-01-11 08:21:41 -06:00
|
|
|
|
|
|
|
pf = PeriodFormat.getDefault()
|
|
|
|
|
|
|
|
fileSource = new FileTimelineSource(new File("timeline.jdbernard.txt").toURI())
|
2011-01-10 18:03:19 -06:00
|
|
|
timeline = fileSource.read()
|
|
|
|
events = tep.process(timeline)
|
2011-01-11 08:21:41 -06:00
|
|
|
|
2011-01-12 17:21:39 -06:00
|
|
|
topcat = new FilteredCategory("Top Category")
|
2011-01-11 08:21:41 -06:00
|
|
|
topcat.filters << new TimeIntervalCategoryFilter(
|
|
|
|
new DateTime(2011, 1, 2, 0, 0, 0, 0), new DateTime(2011, 1, 9, 0, 0, 0, 0))
|
|
|
|
|
2011-01-12 17:21:39 -06:00
|
|
|
twoLevelCatPlan = new TwoLevelCategorizationPlan()
|
|
|
|
descriptionBasedCatPlan = new DescriptionBasedCategorizationPlan()
|
|
|
|
topcat.categorizationPlans << twoLevelCatPlan
|
|
|
|
topcat.categorizationPlans << descriptionBasedCatPlan
|
|
|
|
|
|
|
|
ithelpcat = new TwoLevelCategory("ITHelp")
|
|
|
|
ticketCatPlan = new TicketCategorizationPlan()
|
|
|
|
|
|
|
|
ithelpcat.categorizationPlans << ticketCatPlan
|
|
|
|
ithelpcat.categorizationPlans << descriptionBasedCatPlan
|
|
|
|
|
2011-01-10 18:03:19 -06:00
|
|
|
topcat.categories << ithelpcat
|
2011-01-11 08:21:41 -06:00
|
|
|
|
2011-01-12 17:21:39 -06:00
|
|
|
//events.each { if (topcat.matchesEvent(it)) topcat.addEvent(it) }
|
2011-01-11 08:21:41 -06:00
|
|
|
|
|
|
|
makePieDataset = { category ->
|
|
|
|
DefaultPieDataset dpds = new DefaultPieDataset()
|
|
|
|
category.categories.each { cat ->
|
|
|
|
dpds.setValue(cat.description, cat.duration.standardSeconds) }
|
|
|
|
category.entries.each { entry ->
|
|
|
|
dpds.setValue(entry.description, entry.duration.standardSeconds) }
|
|
|
|
dpds.sortByValues(SortOrder.DESCENDING)
|
|
|
|
|
|
|
|
return dpds
|
|
|
|
}
|
|
|
|
|
2011-01-12 17:21:39 -06:00
|
|
|
//topcatDataset = makePieDataset(topcat)
|
|
|
|
//ithelpDataset = makePieDataset(ithelpcat)
|
2011-01-11 08:21:41 -06:00
|
|
|
|
2011-01-12 17:21:39 -06:00
|
|
|
//topcatFrame = new ChartFrame("Top Category",
|
|
|
|
//ChartFactory.createPieChart("Time Spent", topcatDataset, true, true, false))
|
|
|
|
//ithelpFrame = new ChartFrame("ITHelp",
|
|
|
|
//ChartFactory.createPieChart("Time Spent", ithelpDataset, true, true, false))
|
|
|
|
|