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

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

Introduction

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

Prototype

public int getItemCount(int series);

Source Link

Document

Returns the number of items in a series.

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.j  av  a2  s .  c o  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;
}