use of org.jfree.data.gantt.GanttCategoryDataset in project tdq-studio-se by Talend.
the class HideSeriesGanttRenderer method drawItem.
/**
* Draws the bar for a single (series, category) data item.
*
* @param g2 the graphics device.
* @param state the renderer state.
* @param dataArea the data area.
* @param plot the plot.
* @param domainAxis the domain axis.
* @param rangeAxis the range axis.
* @param dataset the dataset.
* @param row the row index (zero-based).
* @param column the column index (zero-based).
* @param pass the pass index.
*/
@Override
public void drawItem(Graphics2D g2, CategoryItemRendererState state, Rectangle2D dataArea, CategoryPlot plot, CategoryAxis domainAxis, ValueAxis rangeAxis, CategoryDataset dataset, int row, int column, int pass) {
if (dataset instanceof GanttCategoryDataset) {
GanttCategoryDataset gcd = (GanttCategoryDataset) dataset;
drawTasks(g2, state, dataArea, plot, domainAxis, rangeAxis, gcd, row, column);
} else {
// let the superclass handle it...
super.drawItem(g2, state, dataArea, plot, domainAxis, rangeAxis, dataset, row, column, pass);
}
}
use of org.jfree.data.gantt.GanttCategoryDataset in project watchdog by TestRoots.
the class EventStatistics method createDebugEventGanttChartDataset.
/**
* Creates a dataset of all events that occurred during the selected debug
* interval.
*/
public GanttCategoryDataset createDebugEventGanttChartDataset() {
// Create and add the tasks for each event type.
TaskSeries allTasks = new TaskSeries("Debug Events");
for (TrackingEventType type : TrackingEventType.values()) {
final List<EventBase> filteredEventList = events.stream().filter(e -> e.getType() == type).collect(Collectors.toList());
allTasks.add(createTaskForEventsWithName(filteredEventList, type.getTextualDescription()));
}
// Create collection of the overall tasks.
TaskSeriesCollection collection = new TaskSeriesCollection();
collection.add(allTasks);
return collection;
}
use of org.jfree.data.gantt.GanttCategoryDataset in project watchdog by TestRoots.
the class WatchDogView method createDebugEventGanttChart.
private JFreeChart createDebugEventGanttChart() {
eventStatistics = new EventStatistics(InitializationManager.getInstance().getTrackingEventManager(), selectedDebugInterval);
GanttCategoryDataset dataset = eventStatistics.createDebugEventGanttChartDataset();
JFreeChart chart = ChartFactory.createGanttChart("Debug Events During Selected Debug Interval", "Event", "Time", dataset, false, true, false);
// Scale the chart based on the selected debug interval.
CategoryPlot plot = chart.getCategoryPlot();
ValueAxis axis = plot.getRangeAxis();
axis.setRangeWithMargins(selectedDebugInterval.getStart().getTime() - EventStatistics.PRE_SESSION_TIME_TO_INCLUDE, selectedDebugInterval.getEnd().getTime());
// Give each event type a different color.
plot.setRenderer(new WatchDogGanttRenderer());
return chart;
}
use of org.jfree.data.gantt.GanttCategoryDataset in project watchdog by TestRoots.
the class WatchDogView method createDebugEventGanttChart.
private JFreeChart createDebugEventGanttChart() {
eventStatistics = new EventStatistics(InitializationManager.getInstance(WatchDogUtils.getProject()).getTrackingEventManager(), selectedDebugInterval);
GanttCategoryDataset dataset = eventStatistics.createDebugEventGanttChartDataset();
JFreeChart chart = ChartFactory.createGanttChart("Debug Events During Selected Debug Interval", "Event", "Time", dataset, false, true, false);
// Scale the chart based on the selected debug interval.
CategoryPlot plot = chart.getCategoryPlot();
ValueAxis axis = plot.getRangeAxis();
axis.setRangeWithMargins(selectedDebugInterval.getStart().getTime() - EventStatistics.PRE_SESSION_TIME_TO_INCLUDE, selectedDebugInterval.getEnd().getTime());
// Give each event type a different color.
plot.setRenderer(new WatchDogGanttRenderer());
return chart;
}
Aggregations