Example usage for org.jfree.data.xy IntervalXYDataset getSeriesCount

List of usage examples for org.jfree.data.xy IntervalXYDataset getSeriesCount

Introduction

In this page you can find the example usage for org.jfree.data.xy IntervalXYDataset getSeriesCount.

Prototype

public int getSeriesCount();

Source Link

Document

Returns the number of series in the dataset.

Usage

From source file:com.googlecode.logVisualizer.chart.VerticalXYBarChartBuilder.java

private JFreeChart createChart(final IntervalXYDataset dataset) {
    final JFreeChart chart = ChartFactory.createXYBarChart(getTitle(), xLable, false, yLable, dataset,
            PlotOrientation.VERTICAL, isIncludeLegend(), true, false);
    final XYPlot plot = (XYPlot) chart.getPlot();
    final NumberAxis yAxis = (NumberAxis) plot.getRangeAxis();

    double lastXValue = 0;
    if (dataset.getSeriesCount() > 0)
        lastXValue = dataset.getXValue(0, dataset.getItemCount(0) - 1);

    plot.setDomainAxis(new FixedZoomNumberAxis(lastXValue));
    plot.setNoDataMessage("No data available");
    plot.setBackgroundPaint(Color.white);
    plot.setRangeGridlinePaint(Color.black);
    plot.setRangeAxisLocation(AxisLocation.BOTTOM_OR_LEFT);
    setBarShadowVisible(chart, false);//from  w w w.java  2 s .co  m

    plot.getDomainAxis().setStandardTickUnits(NumberAxis.createIntegerTickUnits());
    if (dataset.getSeriesCount() > 0)
        plot.getDomainAxis().setUpperBound(lastXValue);
    plot.getDomainAxis().setLowerBound(0);
    yAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits());
    yAxis.setUpperMargin(0.1);

    return chart;
}

From source file:net.sourceforge.processdash.ui.web.psp.TimeLogPhaseWaterfallChart.java

private JFreeChart createChart(IntervalXYDataset dataset, ProcessUtil process, List<String> phases,
        GapSkipTracker gaps) {/*ww  w  .j  ava 2  s .  c o  m*/
    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;
}