Example usage for org.jfree.chart.plot PlotOrientation HORIZONTAL

List of usage examples for org.jfree.chart.plot PlotOrientation HORIZONTAL

Introduction

In this page you can find the example usage for org.jfree.chart.plot PlotOrientation HORIZONTAL.

Prototype

PlotOrientation HORIZONTAL

To view the source code for org.jfree.chart.plot PlotOrientation HORIZONTAL.

Click Source Link

Document

For a plot where the range axis is horizontal.

Usage

From source file:NovoClass.java

public static void main(String[] args) {
    DefaultCategoryDataset dataset = new DefaultCategoryDataset();

    dataset.addValue(10.1, "Maximo", "Hora 1");
    dataset.addValue(20.1, "Maximo", "Hora 2");
    dataset.addValue(30.1, "Maximo", "Hora 3");
    dataset.addValue(40.1, "Maximo", "Hora 4");
    dataset.addValue(70.1, "Maximo", "Hora 5");

    JFreeChart chart = ChartFactory.createLineChart("Grafico Simpes", "Hora", "Valor", dataset,
            PlotOrientation.HORIZONTAL, true, true, false);

    try {//from   w  w w . ja  v a2s  .c  o  m
        System.out.println("Criando...");
        OutputStream png = new FileOutputStream("GraficoSimples.png");
        ChartUtilities.writeChartAsPNG(png, chart, 500, 400);
        png.close();
    } catch (Exception e) {
    }
}

From source file:LoggerGUI.MainFrame.java

public static void main(String[] args) {

    SwingUtilities.invokeLater(new Runnable() {
        public void run() {

            /*JFrame frame = new JFrame("Charts");
                    /* w  w w  .j a v  a2s .co  m*/
            frame.setSize(700, 400);
            frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
            frame.setVisible(true);
                */

            DataLogger demo = new DataLogger("DemoUI", 51);

            Container contentPane = demo.getContentPane();

            demo.pack();

            demo.setVisible(true);
            demo.setSize(100, 100);

            demo.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
            demo.setVisible(true);

            XYDataset ds = createDataset();
            JFreeChart chart = ChartFactory.createXYLineChart("Test Chart", "x", "y", ds,
                    PlotOrientation.HORIZONTAL, true, true, false);

            ChartPanel cp = new ChartPanel(chart);

            //cp.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
            //contentPane.add(cp, BorderLayout.EAST);

            //cp.setSize(100,100);

            //RefineryUtilities.centerFrameOnScreen(demo);

            demo.pack();

        }
    });

}

From source file:org.jfree.chart.demo.XYBarChartDemo6.java

private static JFreeChart createChart(IntervalXYDataset intervalxydataset) {
    JFreeChart jfreechart = ChartFactory.createXYBarChart("XYBarChartDemo6", "X", false, "Y", intervalxydataset,
            PlotOrientation.HORIZONTAL, false, false, false);
    jfreechart.setBackgroundPaint(Color.white);
    XYPlot xyplot = (XYPlot) jfreechart.getPlot();
    XYBarRenderer xybarrenderer = (XYBarRenderer) xyplot.getRenderer();
    xybarrenderer.setUseYInterval(true);
    xyplot.setBackgroundPaint(Color.lightGray);
    xyplot.setDomainGridlinePaint(Color.white);
    xyplot.setRangeGridlinePaint(Color.white);
    return jfreechart;
}

From source file:org.jfree.chart.demo.BubbleChartDemo1.java

private static JFreeChart createChart(XYZDataset xyzdataset) {
    JFreeChart jfreechart = ChartFactory.createBubbleChart("Bubble Chart Demo 1", "X", "Y", xyzdataset,
            PlotOrientation.HORIZONTAL, true, true, false);
    XYPlot xyplot = (XYPlot) jfreechart.getPlot();
    xyplot.setForegroundAlpha(0.65F);/*from  www .j ava2 s.  co m*/
    XYItemRenderer xyitemrenderer = xyplot.getRenderer();
    xyitemrenderer.setSeriesPaint(0, Color.blue);
    NumberAxis numberaxis = (NumberAxis) xyplot.getDomainAxis();
    numberaxis.setLowerMargin(0.14999999999999999D);
    numberaxis.setUpperMargin(0.14999999999999999D);
    NumberAxis numberaxis1 = (NumberAxis) xyplot.getRangeAxis();
    numberaxis1.setLowerMargin(0.14999999999999999D);
    numberaxis1.setUpperMargin(0.14999999999999999D);
    return jfreechart;
}

From source file:cv.mikusher.freechart.BubbleChart.java

private static JFreeChart createChart(XYZDataset xyzdataset) {
    JFreeChart jfreechart = ChartFactory.createBubbleChart("AGE vs WEIGHT vs WORK", "Weight", "AGE", xyzdataset,
            PlotOrientation.HORIZONTAL, true, true, false);

    XYPlot xyplot = (XYPlot) jfreechart.getPlot();
    xyplot.setForegroundAlpha(0.65F);/*from   w  ww . j  a  v  a2 s.  c  o m*/
    XYItemRenderer xyitemrenderer = xyplot.getRenderer();
    xyitemrenderer.setSeriesPaint(0, Color.blue);
    NumberAxis numberaxis = (NumberAxis) xyplot.getDomainAxis();
    numberaxis.setLowerMargin(0.2);
    numberaxis.setUpperMargin(0.5);
    NumberAxis numberaxis1 = (NumberAxis) xyplot.getRangeAxis();
    numberaxis1.setLowerMargin(0.8);
    numberaxis1.setUpperMargin(0.9);

    return jfreechart;
}

From source file:org.jfree.chart.demo.EventFrequencyDemo1.java

private static JFreeChart createChart(CategoryDataset categorydataset) {
    JFreeChart jfreechart = ChartFactory.createBarChart("Event Frequency Demo", "Category", "Value",
            categorydataset, PlotOrientation.HORIZONTAL, true, true, false);
    jfreechart.setBackgroundPaint(new Color(255, 255, 204));
    CategoryPlot categoryplot = (CategoryPlot) jfreechart.getPlot();
    categoryplot.getDomainAxis().setMaximumCategoryLabelWidthRatio(10F);
    categoryplot.setRangeAxis(new DateAxis("Date"));
    StandardCategoryToolTipGenerator standardcategorytooltipgenerator = new StandardCategoryToolTipGenerator("",
            DateFormat.getDateInstance());
    LineAndShapeRenderer lineandshaperenderer = new LineAndShapeRenderer(false, true);
    lineandshaperenderer.setBaseToolTipGenerator(standardcategorytooltipgenerator);
    categoryplot.setRenderer(lineandshaperenderer);
    return jfreechart;
}

From source file:com.jaspersoft.studio.components.chart.model.enums.JFreeChartPlotOrientationEnum.java

public static JFreeChartPlotOrientationEnum getValue(PlotOrientation ha) {
    if (ha != null) {
        if (ha.equals(PlotOrientation.HORIZONTAL))
            return HORIZONTAL;
        if (ha.equals(PlotOrientation.VERTICAL))
            return VERTICAL;
    }/* w ww  .  j a va 2  s.c  om*/
    return VERTICAL;
}

From source file:org.jfree.chart.demo.XYTaskDatasetDemo1.java

private static JFreeChart createChart(IntervalXYDataset intervalxydataset) {
    JFreeChart jfreechart = ChartFactory.createXYBarChart("XYTaskDatasetDemo1", "Resource", false, "Timing",
            intervalxydataset, PlotOrientation.HORIZONTAL, true, false, false);
    jfreechart.setBackgroundPaint(Color.white);
    XYPlot xyplot = (XYPlot) jfreechart.getPlot();
    xyplot.setRangePannable(true);//from  www  .j a v  a2  s .c  o  m
    SymbolAxis symbolaxis = new SymbolAxis("Series", new String[] { "Team A", "Team B", "Team C", "Team D" });
    symbolaxis.setGridBandsVisible(false);
    xyplot.setDomainAxis(symbolaxis);
    XYBarRenderer xybarrenderer = (XYBarRenderer) xyplot.getRenderer();
    xybarrenderer.setUseYInterval(true);
    xyplot.setRangeAxis(new DateAxis("Timing"));
    ChartUtilities.applyCurrentTheme(jfreechart);
    return jfreechart;
}

From source file:org.jfree.chart.demo.PopulationChartDemo1.java

public PopulationChartDemo1(String s) {
    super(s);//w  ww  .j  a  v a  2 s . com
    KeyedValues2DDataset keyedvalues2ddataset = createDataset();
    org.jfree.chart.JFreeChart jfreechart = ChartFactory.createStackedBarChart("Population Chart Demo",
            "Age Group", "Population (millions)", keyedvalues2ddataset, PlotOrientation.HORIZONTAL, true, true,
            false);
    ChartPanel chartpanel = new ChartPanel(jfreechart);
    chartpanel.setPreferredSize(new Dimension(500, 270));
    setContentPane(chartpanel);
}

From source file:org.jfree.chart.demo.StackedBarChartDemo6.java

private static JFreeChart createChart(CategoryDataset categorydataset) {
    JFreeChart jfreechart = ChartFactory.createStackedBarChart("Stacked Bar Chart Demo 6", "Category", "Value",
            categorydataset, PlotOrientation.HORIZONTAL, true, true, false);
    jfreechart.setBackgroundPaint(Color.white);
    CategoryPlot categoryplot = (CategoryPlot) jfreechart.getPlot();
    categoryplot.setBackgroundPaint(Color.lightGray);
    categoryplot.setRangeGridlinePaint(Color.white);
    StackedBarRenderer stackedbarrenderer = (StackedBarRenderer) categoryplot.getRenderer();
    stackedbarrenderer.setDrawBarOutline(false);
    long l = System.currentTimeMillis();
    stackedbarrenderer.setBase(l);/*  w  w w .  ja v a2  s.  c  om*/
    DateAxis dateaxis = new DateAxis("Date");
    dateaxis.setLowerMargin(0.0D);
    categoryplot.setRangeAxis(dateaxis);
    return jfreechart;
}