Example usage for org.jfree.chart ChartFactory createLineChart

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

Introduction

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

Prototype

public static JFreeChart createLineChart(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:views.analysis.LinearRegressionDisplay.java

@Override
public void initialize() {
    JFreeChart lineChart = ChartFactory.createLineChart(this.getTitle(), "Temps", "Valeurs", createDataset(),
            PlotOrientation.VERTICAL, true, true, false);

    ChartPanel chartPanel = new ChartPanel(lineChart);
    chartPanel.setPreferredSize(new java.awt.Dimension(560, 367));
    setContentPane(chartPanel);// w  ww. jav a  2s  .c  o m
}

From source file:org.apache.qpid.disttest.charting.chartbuilder.LineChartBuilder.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.createLineChart(title, xAxisTitle, yAxisTitle, (CategoryDataset) dataset,
            plotOrientation, showLegend, showToolTips, showUrls);
    return chart;
}

From source file:Graphics.Linechart.java

public void createGraphic(String titulo, int largura, int altura) {
    CategoryDataset data = this.createDataset();
    grafico = ChartFactory.createLineChart(titulo, xtitle, ytitle, data, PlotOrientation.VERTICAL, true, false,
            false);/*from   w w  w  .  j  av a  2s .c o  m*/
    this.altura = altura;
    this.largura = largura;
    ChartPanel ch = new ChartPanel(grafico);
    ch.setSize(largura, altura);
    ch.setBounds(0, 0, largura, altura);
    this.setDefaultCloseOperation(javax.swing.JFrame.DISPOSE_ON_CLOSE);
    this.setContentPane(ch);
}

From source file:peakmlviewer.widgets.IPeakIntensityGraph.java

@SuppressWarnings("deprecation")
public IPeakIntensityGraph(Composite parent, int style) {
    super(parent, style | SWT.EMBEDDED);

    // create the components
    linechart = ChartFactory.createLineChart(null, "", "Intensity", dataset, PlotOrientation.VERTICAL, false, // legend
            false, // tooltips
            false // urls
    );//from w  w w .j  av a 2 s. co m

    CategoryPlot plot = (CategoryPlot) linechart.getPlot();
    CategoryAxis axis = (CategoryAxis) plot.getDomainAxis();
    axis.setCategoryLabelPositions(CategoryLabelPositions.UP_45);
    LineAndShapeRenderer renderer = (LineAndShapeRenderer) plot.getRenderer();

    renderer.setShapesFilled(true);
    renderer.setShapesVisible(true);

    linechart.setBackgroundPaint(java.awt.Color.WHITE);
    linechart.setBorderVisible(false);
    linechart.setAntiAlias(true);

    plot.setBackgroundPaint(java.awt.Color.WHITE);
    plot.setDomainGridlinesVisible(true);
    plot.setRangeGridlinesVisible(true);

    // add the components
    // --------------------------------------------------------------------------------
    // This uses the SWT-trick for embedding AWT-controls in an SWT-Composite.
    try {
        System.setProperty("sun.awt.noerasebackground", "true");
    } catch (NoSuchMethodError error) {
        ;
    }

    // create a new ChartPanel, without the popup-menu (5x false)
    java.awt.Frame frame = org.eclipse.swt.awt.SWT_AWT.new_Frame(this);
    frame.add(new ChartPanel(linechart, false, false, false, false, false));
    // --------------------------------------------------------------------------------
}

From source file:SeriesDiarias.VisualizadorSeries.java

/**
 * Constri a visualizao dos dados. Cria a janela e o grfico a ser exibido
 * nela.//from   ww  w . ja  va 2 s . co  m
 * 
 * @param serieDados A srie de dados que ter seus dados exibidos em um grfico
 */
public VisualizadorSeries(SerieDadosDiarios serieDados) {
    // cria a janela
    janela = new ApplicationFrame("Visualizador Series Diarias");
    janela.setDefaultCloseOperation(ApplicationFrame.EXIT_ON_CLOSE);

    // cria o grfico que contm os dados da srie
    JFreeChart graficoLinha = ChartFactory.createLineChart(serieDados.obterIdentificacaoSerie(), // Ttulo do grfico
            "Dia", // Nome do eixo X
            "Valor", // Nome do eixo Y
            criarDataset(serieDados), // mtodo que cria os dados do grfico
            PlotOrientation.VERTICAL, // Orientao do grfico
            true, true, false); // legenda, tooltips, urls

    // adiciona o grfico na janela
    ChartPanel painelGrafico = new ChartPanel(graficoLinha);
    painelGrafico.setPreferredSize(new Dimension(600, 400));
    janela.setContentPane(painelGrafico);
    janela.pack();

    // posiciona a janela aleatoriamente na tela
    RefineryUtilities.positionFrameRandomly(janela);
}

From source file:jasmine.imaging.shapes.RadiusChart.java

public RadiusChart(Vector<Double> values) {

    super();/*from  ww w  .  ja  va 2s .  c  om*/

    DefaultCategoryDataset series = new DefaultCategoryDataset();

    for (int i = 0; i < values.size(); i++) {
        series.addValue(values.elementAt(i), "row1", String.valueOf(i));
    }

    setTitle("Radius Change");

    chart = new JLabel();
    getContentPane().add(chart);

    setSize(320, 240);
    setVisible(true);

    myChart = ChartFactory.createLineChart(null, null, null, series, PlotOrientation.VERTICAL, false, false,
            false);

    addComponentListener(new ComponentAdapter() {
        public void componentResized(ComponentEvent e) {
            if (myChart != null)
                updateChart();
        }
    });

}

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

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

From source file:view.HistogramFloat.java

public HistogramFloat(String applicationTitle, String TituloGrafico, List<StringFloat> Lista) {
    super(applicationTitle);

    String legenda = Lista.get(Lista.size() - 1).getDescricao();
    DefaultCategoryDataset DatasetGrafico = new DefaultCategoryDataset();
    int i;// www . j  a  v  a 2 s .c  o m
    for (i = 0; i < Lista.size() - 1; i++) {
        DatasetGrafico.addValue(Lista.get(i).getValor(), legenda, Lista.get(i).getDescricao());

    }

    //JFreeChart grafico = ChartFactory.createBarChart(TituloGrafico, "Legends", "Value of Quality Index using "+legenda, DatasetGrafico);

    JFreeChart grafico = ChartFactory.createLineChart(TituloGrafico, "Number of Clusters", "Index of Quality",
            DatasetGrafico, PlotOrientation.VERTICAL, true, true, true);
    CategoryPlot plot = grafico.getCategoryPlot();
    LineAndShapeRenderer renderer = new LineAndShapeRenderer();
    plot.setRenderer(renderer);

    //createBarChart(TituloGrafico, "Legends", "Value of Quality Index using "+legenda, DatasetGrafico);

    this.add(new ChartPanel(grafico));
    this.pack();
}

From source file:com.softidea.www.private_access.adminstrator.admin_index.java

/**
 * Creates new form admin_index//from www.  j a  va 2  s  . c o  m
 */
public admin_index() {
    initComponents();
    try {
        UIManager.setLookAndFeel("com.sun.java.swing.plaf.windows.WindowsLookAndFeel");
    } catch (Exception ex) {
    }
    try {
        AWTUtilities.setWindowOpaque(this, false);
    } catch (Exception e) {
    }
    pro_lookandfeel.Set();

    JFreeChart lineChart = ChartFactory.createLineChart("Title", "Years", "Number of Schools", createDataset(),
            PlotOrientation.VERTICAL, true, true, false);
    loadChart();

}

From source file:UI.Graphic.java

private void init() {
    panel = new JPanel();
    getContentPane().add(panel);//from w w  w .  ja va2s  . c o  m
    // Fuente de Datos
    DefaultCategoryDataset line_chart_dataset = new DefaultCategoryDataset();
    for (int i = 0; i < experiment1.getMedia().size(); i++) {
        line_chart_dataset.addValue(experiment1.getMedia().get(i), "aptitud", String.valueOf(i));
    }

    // Creando el Grafico
    JFreeChart chart = ChartFactory.createLineChart("Apitud de las generaciones", "Generacion", "Aptitud",
            line_chart_dataset, PlotOrientation.VERTICAL, true, true, false);

    // Mostrar Grafico
    ChartPanel chartPanel = new ChartPanel(chart);
    panel.add(chartPanel);
}