Search in sources :

Example 1 with SegmentedTimeline

use of org.jfree.chart.axis.SegmentedTimeline in project processdash by dtuma.

the class TimeLogPhaseWaterfallChart method setupGaps.

private void setupGaps(GapSkipTracker gapTracker, DateAxis dateAxis, XYPlot plot) {
    if (gapTracker.gaps.isEmpty())
        return;
    SegmentedTimeline timeline = new SegmentedTimeline(1000, 100, 0);
    timeline.setStartTime(gapTracker.leftEnd);
    for (Span gap : gapTracker.gaps) {
        timeline.addException(gap.start + GAP_SPACING, gap.end - 1000);
        long annotationX = gap.start + GAP_SPACING / 2;
        plot.addAnnotation(new XYLineAnnotation(annotationX, VERT_LINE_MIN_Y, annotationX, VERT_LINE_MAX_Y, GAP_STROKE, Color.darkGray));
        double boxW = GAP_SPACING * 0.4;
        XYBoxAnnotation box = new XYBoxAnnotation(annotationX - boxW, VERT_LINE_MIN_Y, annotationX + boxW, VERT_LINE_MAX_Y, null, null, null);
        String toolTip = resources.format("No_Activity_FMT", gap.getStart(), gap.getEnd());
        box.setToolTipText(toolTip);
        plot.addAnnotation(box);
    }
    dateAxis.setTimeline(timeline);
}
Also used : XYBoxAnnotation(org.jfree.chart.annotations.XYBoxAnnotation) SegmentedTimeline(org.jfree.chart.axis.SegmentedTimeline) XYLineAnnotation(org.jfree.chart.annotations.XYLineAnnotation)

Aggregations

XYBoxAnnotation (org.jfree.chart.annotations.XYBoxAnnotation)1 XYLineAnnotation (org.jfree.chart.annotations.XYLineAnnotation)1 SegmentedTimeline (org.jfree.chart.axis.SegmentedTimeline)1