Example usage for org.jfree.chart ChartFactory createXYBarChart

List of usage examples for org.jfree.chart ChartFactory createXYBarChart

Introduction

In this page you can find the example usage for org.jfree.chart ChartFactory createXYBarChart.

Prototype

public static JFreeChart createXYBarChart(String title, String xAxisLabel, boolean dateAxis, String yAxisLabel,
        IntervalXYDataset dataset, PlotOrientation orientation, boolean legend, boolean tooltips,
        boolean urls) 

Source Link

Document

Creates and returns a default instance of an XY bar chart.

Usage

From source file:Operacional.Janela2.java

private static JFreeChart createChart(IntervalXYDataset intervalxydataset) {
    JFreeChart jfreechart = ChartFactory.createXYBarChart("Dados Parquimetro", "Mes", true, "Dados",
            intervalxydataset, PlotOrientation.VERTICAL, true, false, false);
    jfreechart.setBackgroundPaint(Color.white);
    XYPlot xyplot = jfreechart.getXYPlot();
    XYItemRenderer xyitemrenderer = xyplot.getRenderer();
    StandardXYToolTipGenerator standardxytooltipgenerator = new StandardXYToolTipGenerator("{1} = {2}",
            new SimpleDateFormat("yyyy"), new DecimalFormat("0"));
    //xyitemrenderer.setToolTipGenerator(standardxytooltipgenerator);   
    xyplot.setBackgroundPaint(Color.lightGray);
    xyplot.setRangeGridlinePaint(Color.white);
    DateAxis dateaxis = (DateAxis) xyplot.getDomainAxis();
    dateaxis.setTickMarkPosition(DateTickMarkPosition.MIDDLE);
    dateaxis.setLowerMargin(0.01D);/*w ww  .  j a  v  a2s .c  om*/
    dateaxis.setUpperMargin(0.01D);
    return jfreechart;
}

From source file:no.imr.sea2data.guibase.chart.XYBarChart.java

public XYBarChart() {
    dataset = new XYSeriesCollection(new XYSeries("Series 1"));
    JFreeChart chart = ChartFactory.createXYBarChart("", "X axis", false, "Y axis", dataset,
            PlotOrientation.VERTICAL, false, true, false);
    chart.setBackgroundPaint(Color.white);
    chart.getTitle().setPaint(Color.black);
    chart.getTitle().setFont(new Font("SansSerif", Font.PLAIN, 12));
    chart.addSubtitle(trendLegend);/*  w  w  w.ja  v a2 s  .c  om*/
    chart.addSubtitle(trendLegend2);
    trendLegend.setPosition(RectangleEdge.TOP);
    trendLegend2.setPosition(RectangleEdge.TOP);
    plot = (XYPlot) chart.getPlot();
    XYBarRenderer renderer = (XYBarRenderer) plot.getRenderer();
    renderer.setShadowVisible(false);
    chartPanel = new ChartPanel(chart);
    plot.getRangeAxis().setStandardTickUnits(NumberAxis.createIntegerTickUnits());
}

From source file:com.thecoderscorner.groovychart.chart.XYBarChart.java

public JFreeChart createChart() {
    JFreeChart chart = ChartFactory.createXYBarChart(this.getTitle(), this.getXAxisLabel(), this.isDateAxis(),
            this.getYAxisLabel(), (IntervalXYDataset) this.getDataset(), this.getOrientation(), this.isLegend(),
            this.isTooltips(), this.isUrls());
    return setExtraProperties(chart);

}

From source file:osproject.Drawer.java

private static JFreeChart createChart(IntervalXYDataset paramIntervalXYDataset) {
    JFreeChart localJFreeChart = ChartFactory.createXYBarChart("Procssing schadual", "Resource", false,
            "Timing", paramIntervalXYDataset, PlotOrientation.HORIZONTAL, true, false, false);
    localJFreeChart.setBackgroundPaint(Color.BLACK);
    XYPlot localXYPlot = (XYPlot) localJFreeChart.getPlot();

    SymbolAxis localSymbolAxis = new SymbolAxis("Process", arr);
    localSymbolAxis.setGridBandsVisible(false);
    localXYPlot.setDomainAxis(localSymbolAxis);
    XYBarRenderer localXYBarRenderer = (XYBarRenderer) localXYPlot.getRenderer();
    localXYBarRenderer.setUseYInterval(true);
    localXYPlot.setRangeAxis(new DateAxis("Timing"));
    ChartUtilities.applyCurrentTheme(localJFreeChart);
    return localJFreeChart;
}

From source file:pwm.visualizer.MotivationDistributionPanel.java

private JPanel createPanel(String title) {
    IntervalXYDataset xybardataset = new XYBarDataset(motivationDataSet, 0.2D);
    JFreeChart jfreechart = ChartFactory.createXYBarChart(title, "", false, "Likelihood", xybardataset,
            PlotOrientation.VERTICAL, true, false, false);
    xyplot = (XYPlot) jfreechart.getPlot();
    NumberAxis numberaxis = (NumberAxis) xyplot.getDomainAxis();
    numberaxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits());
    XYBarRenderer xybarrenderer = (XYBarRenderer) xyplot.getRenderer();
    xybarrenderer.setDrawBarOutline(false);

    return new ChartPanel(jfreechart);
}

From source file:de.fub.maps.project.plugins.tasks.eval.RoadClassifcationDiagram.java

/**
 * Creates new form RoadClassifcationDiagram
 *///from  www . j a v  a 2 s.com
public RoadClassifcationDiagram() {
    initComponents();
    barChart = ChartFactory.createXYBarChart(null, "Degree", false, null, dataset, PlotOrientation.VERTICAL,
            true, true, true);
    barChart.setBackgroundPaint(Color.WHITE);
    barChart.getPlot().setBackgroundPaint(Color.WHITE);
    chartpanel = new ChartPanel(barChart, false);
    add(chartpanel, BorderLayout.CENTER);
}

From source file:de.fub.maps.project.plugins.tasks.eval.heading.HeadingHistogramm.java

/**
 * Creates new form HeadingHistogramm//from  w  w  w .j  a  va  2s .com
 */
public HeadingHistogramm() {
    initComponents();
    barChart = ChartFactory.createXYBarChart(null, "Degree", false, null, dataset, PlotOrientation.VERTICAL,
            true, true, true);
    barChart.setBackgroundPaint(Color.WHITE);
    barChart.getPlot().setBackgroundPaint(Color.WHITE);
    XYBarRenderer barRenderer = new XYBarRenderer(.05);
    barRenderer.setShadowVisible(false);
    barRenderer.setBarPainter(new StandardXYBarPainter());
    barRenderer.setBaseToolTipGenerator(new StandardXYToolTipGenerator());
    barChart.getXYPlot().setRenderer(barRenderer);
    chartpanel = new ChartPanel(barChart, false);
    add(chartpanel, BorderLayout.CENTER);
}

From source file:org.matsim.contrib.dvrp.util.chart.ScheduleChartUtils.java

public static <T extends Task> JFreeChart chartSchedule(List<? extends Vehicle> vehicles,
        DescriptionCreator<T> descriptionCreator, PaintSelector<T> paintSelector) {
    // data/* ww w  .  j a  va2s .  co  m*/
    TaskSeriesCollection dataset = createScheduleDataset(vehicles, descriptionCreator);
    XYTaskDataset xyTaskDataset = new XYTaskDataset(dataset);

    // chart
    JFreeChart chart = ChartFactory.createXYBarChart("Schedules", "Time", false, "Vehicles", xyTaskDataset,
            PlotOrientation.HORIZONTAL, false, true, false);
    XYPlot plot = (XYPlot) chart.getPlot();

    // Y axis
    String[] series = new String[vehicles.size()];
    for (int i = 0; i < series.length; i++) {
        series[i] = vehicles.get(i).getId().toString();
    }

    SymbolAxis symbolAxis = new SymbolAxis("Vehicles", series);
    symbolAxis.setGridBandsVisible(false);
    plot.setDomainAxis(symbolAxis);

    // X axis
    plot.setRangeAxis(new DateAxis("Time", TimeZone.getTimeZone("GMT"), Locale.getDefault()));

    // Renderer
    XYBarRenderer xyBarRenderer = new ChartTaskRenderer<T>(dataset, paintSelector);
    xyBarRenderer.setUseYInterval(true);
    plot.setRenderer(xyBarRenderer);

    return chart;
}

From source file:pl.poid.bzdp.zadanieObrazy.ImageHistogram.java

private JFreeChart createChart(final XYSeriesCollection dataset, Color c) {

    final JFreeChart chart = ChartFactory.createXYBarChart("Histogram", "Brightness", false, "Values", dataset,
            PlotOrientation.VERTICAL, true, true, false);

    XYItemRenderer renderer = chart.getXYPlot().getRenderer();
    renderer.setSeriesPaint(0, c);/*ww w .  j  ava 2 s.co m*/
    // NOW DO SOME OPTIONAL CUSTOMISATION OF THE CHART...
    // set the background color for the chart...
    chart.setBackgroundPaint(Color.white);

    return chart;

}

From source file:netplot.BarPlotPanel.java

private JFreeChart createChart() {
    collection = new XYSeriesCollection();
    collection.addSeries(series);/*from w ww.  j a  va 2s.c o m*/
    dataset = new XYBarDataset(collection, 0.9);

    chart = ChartFactory.createXYBarChart(plotTitle, "", false, "", dataset, PlotOrientation.VERTICAL,
            enableLegend, true, true);

    plot = (XYPlot) chart.getPlot();
    plot.setBackgroundPaint(Color.WHITE);
    plot.setDomainGridlinePaint(Color.DARK_GRAY);
    plot.setRangeGridlinePaint(Color.DARK_GRAY);
    NumberAxis domainAxis = (NumberAxis) plot.getDomainAxis();
    domainAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits());

    renderer = (XYBarRenderer) plot.getRenderer();
    renderer.setDrawBarOutline(true);
    return chart;
}