Migrated to jdb-build-1.9, documentation.
This commit is contained in:
BIN
resources/main/jdbernard-timeline.txt
Executable file
BIN
resources/main/jdbernard-timeline.txt
Executable file
Binary file not shown.
46
resources/main/start-script.groovy
Normal file
46
resources/main/start-script.groovy
Normal file
@ -0,0 +1,46 @@
|
||||
import com.jdbernard.timeanalyzer.processors.*
|
||||
import com.jdbernard.timeanalyzer.categories.*
|
||||
import com.jdbernard.timeanalyzer.categorizationplans.*
|
||||
import com.jdbernard.timeanalyzer.chart.*
|
||||
import com.jdbernard.timeanalyzer.events.*
|
||||
import com.jdbernard.timestamper.core.*
|
||||
import com.quantumdigital.ithelp.timeanalyzer.*
|
||||
import org.joda.time.*
|
||||
import org.joda.time.format.*
|
||||
import org.jfree.chart.*
|
||||
import org.jfree.data.general.*
|
||||
import org.jfree.util.SortOrder
|
||||
|
||||
tep = new TimelineEventProcessor()
|
||||
tep.exclusions << ~/.*Home.*/
|
||||
|
||||
pf = PeriodFormat.getDefault()
|
||||
|
||||
topcat = new FilteredCategory("Top Category")
|
||||
|
||||
twoLevelCatPlan = new TwoLevelCategorizationPlan()
|
||||
descriptionBasedCatPlan = new DescriptionBasedCategorizationPlan()
|
||||
topcat.categorizationPlans << twoLevelCatPlan
|
||||
topcat.categorizationPlans << descriptionBasedCatPlan
|
||||
|
||||
loadEvents = { file, processor ->
|
||||
fileSource = new FileTimelineSource(file.toURI())
|
||||
timeline = fileSource.read()
|
||||
return processor.process(timeline) }
|
||||
|
||||
makePieDataset = { category ->
|
||||
DefaultPieDataset dpds = new DefaultPieDataset()
|
||||
category.categories.each { cat ->
|
||||
dpds.setValue(cat.description, cat.duration.standardSeconds) }
|
||||
category.events.each { entry ->
|
||||
dpds.setValue(entry.description, entry.duration.standardSeconds) }
|
||||
dpds.sortByValues(SortOrder.DESCENDING)
|
||||
|
||||
return dpds }
|
||||
|
||||
makeFrame = { categoryName, dataset ->
|
||||
return new ChartFrame(categoryName,
|
||||
ChartFactory.createPieChart("Time Spent", dataset, true, true, false)) }
|
||||
|
||||
createDailyCategory = { file, processor ->
|
||||
events = loadEvents(file)
|
Binary file not shown.
Reference in New Issue
Block a user