Example usage for org.jfree.chart ChartFactory createLineChart3D

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

Introduction

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

Prototype

public static JFreeChart createLineChart3D(String title, String categoryAxisLabel, String valueAxisLabel,
        CategoryDataset dataset, PlotOrientation orientation, boolean legend, boolean tooltips, boolean urls) 

Source Link

Document

Creates a line chart with default settings.

Usage

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

private static JFreeChart createChart(CategoryDataset categorydataset) {
    JFreeChart jfreechart = ChartFactory.createLineChart3D("Line Chart 3D Demo 1", null, "Class Count",
            categorydataset, PlotOrientation.VERTICAL, false, true, false);
    jfreechart.setBackgroundPaint(new Color(187, 187, 221));
    CategoryPlot categoryplot = (CategoryPlot) jfreechart.getPlot();
    NumberAxis numberaxis = (NumberAxis) categoryplot.getRangeAxis();
    numberaxis.setAutoRangeIncludesZero(false);
    numberaxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits());
    return jfreechart;
}

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

public JFreeChart createChart() {
    return ChartFactory.createLineChart3D(getTitle(), this.getCategoryAxisLabel(), this.getValueAxisLabel(),
            (CategoryDataset) getDataset(), getOrientation(), isLegend(), isTooltips(), isUrls());
}

From source file:org.apache.qpid.disttest.charting.chartbuilder.LineChart3DBuilder.java

@Override
protected JFreeChart createCategoryChart(String title, String xAxisTitle, String yAxisTitle,
        final Dataset dataset, PlotOrientation plotOrientation, boolean showLegend, boolean showToolTips,
        boolean showUrls) {
    JFreeChart chart = ChartFactory.createLineChart3D(title, xAxisTitle, yAxisTitle, (CategoryDataset) dataset,
            plotOrientation, showLegend, showToolTips, showUrls);
    return chart;
}

From source file:com.manydesigns.portofino.chart.ChartLine3DGenerator.java

protected JFreeChart createChart(ChartDefinition chartDefinition, CategoryDataset dataset,
        PlotOrientation plotOrientation) {
    return ChartFactory.createLineChart3D(chartDefinition.getName(), chartDefinition.getXAxisName(),
            chartDefinition.getYAxisName(), dataset, plotOrientation, true, true, true);
}

From source file:org.pentaho.plugin.jfreereport.reportcharts.LineChartExpression.java

protected JFreeChart computeCategoryChart(final CategoryDataset dataset) {
    final PlotOrientation orientation = computePlotOrientation();
    if (isThreeD()) {
        final JFreeChart chart = ChartFactory.createLineChart3D(computeTitle(), getCategoryAxisLabel(),
                getValueAxisLabel(), dataset, orientation, isShowLegend(), false, false);
        chart.getCategoryPlot().setDomainAxis(new FormattedCategoryAxis3D(getCategoryAxisLabel(),
                getCategoricalAxisMessageFormat(), getRuntime().getResourceBundleFactory().getLocale()));
        final CategoryPlot plot = (CategoryPlot) chart.getPlot();
        configureLogarithmicAxis(plot);//from w w w  .  j av a2s.c om
        return chart;
    } else {
        final JFreeChart chart = ChartFactory.createLineChart(computeTitle(), getCategoryAxisLabel(),
                getValueAxisLabel(), dataset, orientation, isShowLegend(), false, false);
        chart.getCategoryPlot().setDomainAxis(new FormattedCategoryAxis(getCategoryAxisLabel(),
                getCategoricalAxisMessageFormat(), getRuntime().getResourceBundleFactory().getLocale()));
        final CategoryPlot plot = (CategoryPlot) chart.getPlot();
        configureLogarithmicAxis(plot);
        return chart;
    }
}

From source file:org.jboss.seam.cron.examples.swinggrapher.SwingGrapherForm.java

/**
 * Initialise the chart visuals./*from  w  w  w  .j a v  a2  s. c  o  m*/
 */
@PostConstruct
public void initChart() {
    log.info("Initializing");
    final JFreeChart chart = ChartFactory.createLineChart3D("Free Memory", "Time", "Bytes", catDataSet,
            PlotOrientation.VERTICAL, true, true, true);
    final ChartPanel chartPanel = new ChartPanel(chart);
    setContentPane(chartPanel);
}

From source file:org.operamasks.faces.render.graph.LineChartRenderer.java

protected JFreeChart createChart(UIChart comp) {
    Dataset dataset = createDataset(comp);
    JFreeChart chart = null;/*from  w w  w.  j a v a2  s . com*/

    if (dataset instanceof CategoryDataset) {
        if (comp.isEffect3D()) {
            chart = ChartFactory.createLineChart3D(null, null, null, (CategoryDataset) dataset,
                    getChartOrientation(comp), false, false, false);
        } else {
            chart = ChartFactory.createLineChart(null, null, null, (CategoryDataset) dataset,
                    getChartOrientation(comp), false, false, false);
        }
    } else if (dataset instanceof TimeSeriesCollection) {
        chart = ChartFactory.createTimeSeriesChart(null, null, null, (XYDataset) dataset, false, false, false);
        ((XYPlot) chart.getPlot()).setOrientation(getChartOrientation(comp));
    } else if (dataset instanceof XYDataset) {
        chart = ChartFactory.createXYLineChart(null, null, null, (XYDataset) dataset, getChartOrientation(comp),
                false, false, false);
    }

    return chart;
}

From source file:biz.ixnay.pivot.charts.skin.jfree.LineChartViewSkin.java

@Override
protected JFreeChart createChart() {
    LineChartView chartView = (LineChartView) getComponent();

    String title = chartView.getTitle();
    String horizontalAxisLabel = chartView.getHorizontalAxisLabel();
    String verticalAxisLabel = chartView.getVerticalAxisLabel();
    boolean showLegend = chartView.getShowLegend();

    String seriesNameKey = chartView.getSeriesNameKey();
    List<?> chartData = chartView.getChartData();

    JFreeChart chart;/*from   ww  w  .  j  a  va  2 s  .  c om*/
    ChartView.CategorySequence categories = chartView.getCategories();
    if (categories.getLength() > 0) {
        CategorySeriesDataset dataset = new CategorySeriesDataset(categories, seriesNameKey, chartData);

        if (threeDimensional) {
            chart = ChartFactory.createLineChart3D(title, horizontalAxisLabel, verticalAxisLabel, dataset,
                    PlotOrientation.VERTICAL, showLegend, false, false);
        } else {
            chart = ChartFactory.createLineChart(title, horizontalAxisLabel, verticalAxisLabel, dataset,
                    PlotOrientation.VERTICAL, showLegend, false, false);
        }

        CategoryPlot plot = (CategoryPlot) chart.getPlot();
        CategoryAxis domainAxis = plot.getDomainAxis();
        CategoryLabelPositions categoryLabelPositions = CategoryLabelPositions
                .createUpRotationLabelPositions(categoryLabelRotation);
        domainAxis.setCategoryLabelPositions(categoryLabelPositions);

        if (rangeAxisRange != null) {
            ValueAxis rangeAxis = plot.getRangeAxis();
            rangeAxis.setRange(rangeAxisRange);
        }
    } else {
        chart = ChartFactory.createXYLineChart(title, horizontalAxisLabel, verticalAxisLabel,
                new XYSeriesDataset(seriesNameKey, chartData), PlotOrientation.VERTICAL, showLegend, false,
                false);

        if (rangeAxisRange != null) {
            XYPlot plot = (XYPlot) chart.getPlot();
            ValueAxis rangeAxis = plot.getRangeAxis();
            rangeAxis.setRange(rangeAxisRange);
        }
    }

    return chart;
}

From source file:view.statistics.RequestStatsAndPrediction.java

/**
 * Creates new form PredictRequests/*w ww .j  a va 2s  .com*/
 */
public RequestStatsAndPrediction() throws FileNotFoundException, IOException {
    initComponents();
    FileInputStream imgStream = null;
    File imgfile = new File("..\\BBMS\\src\\images\\drop.png");
    imgStream = new FileInputStream(imgfile);
    BufferedImage bi = ImageIO.read(imgStream);
    ImageIcon myImg = new ImageIcon(bi);
    this.setFrameIcon(myImg);
    setTitle("Request Statistics and Prediction");
    sdcontroller = new SampleDetailsController();
    Calendar calendar = Calendar.getInstance();
    yearChooser.setStartYear(calendar.get(Calendar.YEAR));
    monthChooser.setMonth(calendar.get(calendar.MONTH) + 1);

    int year = yearChooser.getYear();
    int month = monthChooser.getMonth() + 1;

    int currentYear = Calendar.getInstance().get(Calendar.YEAR);
    int currentMonth = Calendar.getInstance().get(Calendar.MONTH) + 1;

    int data[][] = null;

    try {
        data = sdcontroller.getYearlyRequestCountsOf(month);
    } catch (ClassNotFoundException ex) {
        Logger.getLogger(RequestStatsAndPrediction.class.getName()).log(Level.SEVERE, null, ex);
    } catch (SQLException ex) {
        Logger.getLogger(RequestStatsAndPrediction.class.getName()).log(Level.SEVERE, null, ex);
    }

    if (year >= currentYear && month >= currentMonth) {

        try {
            predictText.setText(Predictions.getPredictedRequestsOf(year, month) + "");
        } catch (ClassNotFoundException ex) {
            Logger.getLogger(RequestStatsAndPrediction.class.getName()).log(Level.SEVERE, null, ex);
        } catch (SQLException ex) {
            Logger.getLogger(RequestStatsAndPrediction.class.getName()).log(Level.SEVERE, null, ex);
        }
    } else {
        JOptionPane.showMessageDialog(this,
                "Predictions available only for future months. Only the graph will be drawn", "Error",
                JOptionPane.ERROR_MESSAGE);
        predictText.setText("Invalid input!");
    }

    DefaultCategoryDataset dataset = new DefaultCategoryDataset();
    if (data != null) {
        for (int i = 0; i < data[0].length; i++) {
            dataset.setValue(data[1][i], "Bla bla bla", data[0][i] + "");
        }
    }

    JFreeChart chart = ChartFactory.createLineChart3D(
            "Yearly Blood Request Count For The Month of " + getMontName(month + ""), "Year", "Request Count",
            dataset, PlotOrientation.VERTICAL, false, true, false);
    chart.setBackgroundPaint(Color.PINK);
    chart.getTitle().setPaint(Color.RED);
    CategoryPlot p = chart.getCategoryPlot();
    p.setRangeGridlinePaint(Color.BLUE);

    ChartPanel panel = new ChartPanel(chart);
    panel.setPreferredSize(new java.awt.Dimension(200, 350));
    chartAreaPanel.setLayout(new GridLayout());
    chartAreaPanel.removeAll();
    chartAreaPanel.revalidate();
    chartAreaPanel.add(panel);
    chartAreaPanel.repaint();

    this.repaint();

}

From source file:org.wsm.database.tools.editor.ui.GraphPane.java

public JFreeChart getChart(String chartType) {
    if (CHART_TYPE_BAR_3D.equals(chartType))
        return ChartFactory.createBarChart3D("Load Test Results", "Thread Id", "Time taken in Seconds", dcd,
                PlotOrientation.VERTICAL, true, true, true);
    else if (CHART_TYPE_LINE_3D.equals(chartType))
        return ChartFactory.createLineChart3D("Load Test Results", "Thread Id", "Time taken in Seconds", dcd,
                PlotOrientation.VERTICAL, true, true, true);

    else/* w  ww  .  j a va 2s . c o  m*/
        return null;
}