Search in sources :

Example 1 with XYLineAnnotation

use of org.jfree.chart.annotations.XYLineAnnotation in project processdash by dtuma.

the class EstErrorScatterChart method createChart.

@Override
public JFreeChart createChart() {
    JFreeChart chart = super.createChart();
    // set minimum/maximum bounds on the two axes
    XYPlot xyPlot = chart.getXYPlot();
    double cutoff = getPercentParam("cut", 100, 200, 5000);
    xyPlot.setDomainAxis(truncAxis(xyPlot.getDomainAxis(), cutoff));
    xyPlot.setRangeAxis(truncAxis(xyPlot.getRangeAxis(), cutoff));
    xyPlot.setRenderer(new TruncatedItemRenderer(xyPlot.getRenderer()));
    // add a box illustrating the target range
    if (data.numRows() > 0) {
        double box = getPercentParam("pct", 0, 50, 100);
        xyPlot.addAnnotation(new XYBoxAnnotation(-box, -box, box, box));
        xyPlot.addAnnotation(new XYLineAnnotation(-box, 0, box, 0));
        xyPlot.addAnnotation(new XYLineAnnotation(0, -box, 0, box));
    }
    return chart;
}
Also used : XYBoxAnnotation(org.jfree.chart.annotations.XYBoxAnnotation) XYPlot(org.jfree.chart.plot.XYPlot) XYLineAnnotation(org.jfree.chart.annotations.XYLineAnnotation) JFreeChart(org.jfree.chart.JFreeChart)

Example 2 with XYLineAnnotation

use of org.jfree.chart.annotations.XYLineAnnotation 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)2 XYLineAnnotation (org.jfree.chart.annotations.XYLineAnnotation)2 JFreeChart (org.jfree.chart.JFreeChart)1 SegmentedTimeline (org.jfree.chart.axis.SegmentedTimeline)1 XYPlot (org.jfree.chart.plot.XYPlot)1