Search in sources :

Example 1 with SymbolAxis

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

the class TimeLogPhaseWaterfallChart method createChart.

private JFreeChart createChart(IntervalXYDataset dataset, ProcessUtil process, List<String> phases, GapSkipTracker gaps) {
    JFreeChart result = ChartFactory.createXYBarChart(null, null, true, null, dataset, PlotOrientation.VERTICAL, false, true, false);
    XYPlot xyplot = (XYPlot) result.getPlot();
    DateAxis dateAxis = new DateAxis(null);
    dateAxis.setTickMarksVisible(false);
    dateAxis.setTickLabelsVisible(false);
    dateAxis.setLowerMargin(0.01);
    dateAxis.setUpperMargin(0.01);
    setupGaps(gaps, dateAxis, xyplot);
    xyplot.setDomainAxis(dateAxis);
    String[] phaseNameList = new String[phases.size()];
    for (int i = 0; i < phaseNameList.length; i++) phaseNameList[i] = Translator.translate(phases.get(i));
    SymbolAxis symbolaxis = new SymbolAxis(null, phaseNameList);
    symbolaxis.setGridBandsVisible(false);
    xyplot.setRangeAxis(symbolaxis);
    final XYBarRenderer renderer = (XYBarRenderer) xyplot.getRenderer();
    renderer.setUseYInterval(true);
    renderer.setDrawBarOutline(true);
    renderer.setBaseOutlinePaint(Color.black);
    new PhaseChartColorer(process, phases) {

        public void setItemColor(Object key, int pos, Color c) {
            renderer.setSeriesPaint(pos, c);
        }
    }.run();
    int exceptionSeries = dataset.getSeriesCount() - 1;
    renderer.setSeriesPaint(exceptionSeries, EXCEPTION_PAINT);
    renderer.setSeriesFillPaint(exceptionSeries, EXCEPTION_PAINT);
    renderer.setSeriesOutlinePaint(exceptionSeries, EXCEPTION_PAINT);
    renderer.setBaseToolTipGenerator(new TooltipGenerator());
    xyplot.setBackgroundPaint(Color.white);
    xyplot.setDomainGridlinesVisible(false);
    xyplot.setRangeGridlinePaint(Color.lightGray);
    xyplot.setDrawingSupplier(DRAWING_SUPPLIER_FACTORY.newDrawingSupplier());
    result.setAntiAlias(false);
    result.setTextAntiAlias(true);
    parameters.put("title", resources.getString("Title"));
    return result;
}
Also used : DateAxis(org.jfree.chart.axis.DateAxis) XYPlot(org.jfree.chart.plot.XYPlot) PhaseChartColorer(net.sourceforge.processdash.ui.lib.chart.PhaseChartColorer) Color(java.awt.Color) JFreeChart(org.jfree.chart.JFreeChart) XYBarRenderer(org.jfree.chart.renderer.xy.XYBarRenderer) SymbolAxis(org.jfree.chart.axis.SymbolAxis)

Aggregations

Color (java.awt.Color)1 PhaseChartColorer (net.sourceforge.processdash.ui.lib.chart.PhaseChartColorer)1 JFreeChart (org.jfree.chart.JFreeChart)1 DateAxis (org.jfree.chart.axis.DateAxis)1 SymbolAxis (org.jfree.chart.axis.SymbolAxis)1 XYPlot (org.jfree.chart.plot.XYPlot)1 XYBarRenderer (org.jfree.chart.renderer.xy.XYBarRenderer)1