Example usage for org.jfree.chart.renderer.xy XYSplineRenderer XYSplineRenderer

List of usage examples for org.jfree.chart.renderer.xy XYSplineRenderer XYSplineRenderer

Introduction

In this page you can find the example usage for org.jfree.chart.renderer.xy XYSplineRenderer XYSplineRenderer.

Prototype

public XYSplineRenderer() 

Source Link

Document

Creates a new instance with the precision attribute defaulting to 5 and no fill of the area 'under' the spline.

Usage

From source file:loci.slim.ui.ExcitationGraph.java

/**
 * Creates the chart/*from   w ww.  j a  v  a 2  s  .  c  o m*/
 *
 * @param bins number of bins
 * @param timeInc time increment per bin
 * @param data fitted data
 * @return the chart
 */
JFreeChart createChart(final int bins, final double timeInc, final double[] values) {

    // create chart data
    createDataset(bins, timeInc, values);

    // make a horizontal axis
    final NumberAxis timeAxis = new NumberAxis(TIME_AXIS_LABEL);
    timeAxis.setLabel(UNITS_LABEL);
    timeAxis.setRange(0.0, (bins - 1) * timeInc);

    // make a vertical axis
    NumberAxis photonAxis;
    if (_logarithmic) {
        photonAxis = new LogarithmicAxis(PHOTON_AXIS_LABEL);
    } else {
        photonAxis = new NumberAxis(PHOTON_AXIS_LABEL);
    }

    // make an excitation plot
    final XYSplineRenderer excitationRenderer = new XYSplineRenderer();
    excitationRenderer.setSeriesShapesVisible(0, false);
    excitationRenderer.setSeriesPaint(0, EXCITATION_COLOR);

    _excitationPlot = new XYPlot(_excitationDataset, timeAxis, photonAxis, excitationRenderer);
    _excitationPlot.setDomainCrosshairVisible(true);
    _excitationPlot.setRangeCrosshairVisible(true);

    // now make the top level JFreeChart
    final JFreeChart chart = new JFreeChart(null, JFreeChart.DEFAULT_TITLE_FONT, _excitationPlot, true);
    chart.removeLegend();

    return chart;
}

From source file:loci.slim2.process.interactive.ui.DefaultExcitationGraph.java

/**
 * Creates the chart/*from  w ww  . j a v  a  2 s. c o m*/
 *
 * @param bins number of bins
 * @param timeInc time increment per bin
 * @param data fitted data
 * @return the chart
 */
JFreeChart createChart(final int bins, final double timeInc, final double[] values) {

    // create chart data
    createDataset(bins, timeInc, values);

    // make a horizontal axis
    final NumberAxis timeAxis = new NumberAxis(TIME_AXIS_LABEL);
    timeAxis.setLabel(UNITS_LABEL);
    timeAxis.setRange(0.0, (bins - 1) * timeInc);

    // make a vertical axis
    NumberAxis photonAxis;
    if (logarithmic) {
        photonAxis = new LogarithmicAxis(PHOTON_AXIS_LABEL);
    } else {
        photonAxis = new NumberAxis(PHOTON_AXIS_LABEL);
    }

    // make an excitation plot
    final XYSplineRenderer excitationRenderer = new XYSplineRenderer();
    excitationRenderer.setSeriesShapesVisible(0, false);
    excitationRenderer.setSeriesPaint(0, EXCITATION_COLOR);

    excitationPlot = new XYPlot(excitationDataset, timeAxis, photonAxis, excitationRenderer);
    excitationPlot.setDomainCrosshairVisible(true);
    excitationPlot.setRangeCrosshairVisible(true);

    // now make the top level JFreeChart
    final JFreeChart chart = new JFreeChart(null, JFreeChart.DEFAULT_TITLE_FONT, excitationPlot, true);
    chart.removeLegend();

    return chart;
}

From source file:msi.gama.outputs.layers.charts.ChartJFreeChartOutputScatter.java

@Override
protected AbstractRenderer createRenderer(final IScope scope, final String serieid) {
    final String style = this.getChartdataset().getDataSeries(scope, serieid).getStyle(scope);
    AbstractRenderer newr = new myXYErrorRenderer();
    switch (style) {
    case IKeyword.SPLINE: {
        newr = new XYSplineRenderer();
        break;//ww  w . ja  va2s.c o  m
    }
    case IKeyword.STEP: {
        newr = new XYStepRenderer();
        break;
    }
    case IKeyword.DOT: {
        newr = new XYShapeRenderer();
        break;
    }
    case IKeyword.WHISKER: {
        newr = new XYBoxAndWhiskerRenderer();
        break;
    }
    case IKeyword.AREA: {
        newr = new XYAreaRenderer();
        break;
    }
    case IKeyword.BAR: {
        newr = new XYBarRenderer();
        break;
    }
    case IKeyword.THREE_D: {
        newr = new XYLine3DRenderer();
        break;
    }
    case IKeyword.STACK:
    case IKeyword.RING:
    case IKeyword.EXPLODED:
    default: {
        // newr = new FastXYItemRenderer();
        newr = new myXYErrorRenderer();
        ((myXYErrorRenderer) newr).setMyid(serieid);
        ((myXYErrorRenderer) newr).setOutput(this);
        break;

    }
    }
    return newr;
}

From source file:msi.gama.outputs.layers.ChartDataStatement.java

/**
 * @throws GamaRuntimeException//  w  ww.j  av a2s . co  m
 * @param scope
 */
public ChartData createData(final IScope scope) throws GamaRuntimeException {
    ChartData data = new ChartData();
    String style = getLiteral(IKeyword.STYLE);
    if (style == null) {
        style = IKeyword.LINE;
    }

    GamaColor color = Cast.asColor(scope, getFacetValue(scope, IKeyword.COLOR, Cast.asColor(scope, "black")));
    boolean showMarkers = getFacetValue(scope, MARKER, true);
    boolean showLine = getFacetValue(scope, LINE_VISIBLE, true);
    boolean fillMarkers = getFacetValue(scope, FILL, true);
    String shapeMarker = getFacetValue(scope, MARKERSHAPE, null);

    AbstractRenderer r = null;
    if (style.equals(IKeyword.LINE)) {
        r = new XYLineAndShapeRenderer(true, showMarkers);
        r.setSeriesPaint(0, color);
        ((XYLineAndShapeRenderer) r).setBaseShapesFilled(fillMarkers);
        if (shapeMarker != null) {
            if (shapeMarker.equals(MARKER_SQUARE)) {
                ((XYLineAndShapeRenderer) r).setSeriesShape(0, defaultmarkers[0]);
            } else if (shapeMarker.equals(MARKER_CIRCLE)) {
                ((XYLineAndShapeRenderer) r).setSeriesShape(0, defaultmarkers[1]);
            } else if (shapeMarker.equals(MARKER_UP_TRIANGLE)) {
                ((XYLineAndShapeRenderer) r).setSeriesShape(0, defaultmarkers[2]);
            } else if (shapeMarker.equals(MARKER_DIAMOND)) {
                ((XYLineAndShapeRenderer) r).setSeriesShape(0, defaultmarkers[3]);
            } else if (shapeMarker.equals(MARKER_HOR_RECTANGLE)) {
                ((XYLineAndShapeRenderer) r).setSeriesShape(0, defaultmarkers[4]);
            } else if (shapeMarker.equals(MARKER_DOWN_TRIANGLE)) {
                ((XYLineAndShapeRenderer) r).setSeriesShape(0, defaultmarkers[5]);
            } else if (shapeMarker.equals(MARKER_HOR_ELLIPSE)) {
                ((XYLineAndShapeRenderer) r).setSeriesShape(0, defaultmarkers[6]);
            } else if (shapeMarker.equals(MARKER_RIGHT_TRIANGLE)) {
                ((XYLineAndShapeRenderer) r).setSeriesShape(0, defaultmarkers[7]);
            } else if (shapeMarker.equals(MARKER_VERT_RECTANGLE)) {
                ((XYLineAndShapeRenderer) r).setSeriesShape(0, defaultmarkers[8]);
            } else if (shapeMarker.equals(MARKER_LEFT_TRIANGLE)) {
                ((XYLineAndShapeRenderer) r).setSeriesShape(0, defaultmarkers[9]);
            } else if (shapeMarker.equals(MARKER_EMPTY)) {
                ((XYLineAndShapeRenderer) r).setSeriesShapesVisible(0, false);
            }

        }
        ((XYLineAndShapeRenderer) r).setSeriesLinesVisible(0, showLine);
    } else if (style.equals(IKeyword.AREA)) {
        r = new XYAreaRenderer();
        r.setSeriesPaint(0, color);
    } else if (style.equals(IKeyword.WHISKER)) {
        r = new BoxAndWhiskerRenderer();
        r.setSeriesPaint(0, color);
    } else if (style.equals(IKeyword.BAR)) {
        r = new BarRenderer();
        r.setSeriesPaint(0, color);
    } else if (style.equals(IKeyword.DOT)) {
        r = new XYDotRenderer();
        r = new XYShapeRenderer();
        r.setSeriesPaint(0, color);
    } else if (style.equals(IKeyword.SPLINE)) {
        r = new XYSplineRenderer();
        r.setSeriesPaint(0, color);
        ((XYSplineRenderer) r).setBaseShapesFilled(fillMarkers);
        ((XYSplineRenderer) r).setBaseShapesVisible(showMarkers);
    } else if (style.equals(IKeyword.STEP)) {
        r = new XYStepRenderer();
    } else if (style.equals(IKeyword.AREA_STACK)) {
        r = new StackedXYAreaRenderer2();
        r.setSeriesPaint(0, color);
    } else if (style.equals(IKeyword.STACK)) {
        r = new StackedBarRenderer();
        r.setSeriesPaint(0, color);
        // ((XYStepRenderer) r).setBaseShapesFilled(fillMarkers);
        // ((XYStepRenderer) r).setBaseShapesVisible(showMarkers);
    }
    data.renderer = r;

    data.name = Cast.asString(scope,
            getFacetValue(scope, IKeyword.LEGEND, getFacetValue(scope, IKeyword.NAME, "data" + dataNumber++)));
    data.color = color;
    // r.setSeriesPaint(0, data.color);
    // in order to "detach" the expression from the current definition scope
    data.value = getFacet(IKeyword.VALUE).resolveAgainst(scope);
    return data;
}

From source file:br.ufrgs.enq.jcosmo.test.VLEdiagrams.java

/**
 * VLE diagrams using sigma profile by MOPAC
 * /*from   www  .  java  2s .  co m*/
 * @return
 * @throws Exception 
 */
@SuppressWarnings("deprecation")
public JPanel calcEthTolMOPAC() throws Exception {
    super.setTitle("P vs x1");
    double T = 60;
    setLayout(new BorderLayout());

    COSMOSACDataBase db = COSMOSACDataBase.getInstance();

    COSMOSACCompound comps[] = new COSMOSACCompound[2];
    comps[0] = db.getComp("ethanol");
    comps[1] = db.getComp("toluene");

    COSMOSAC cosmosac = new COSMOPAC();
    cosmosac.setComponents(comps);

    cosmosac.setTemperature(T + 273.15);

    double[] x1 = new double[n];
    double[] x2 = new double[n];
    double[] gamma1 = new double[n];
    double[] gamma2 = new double[n];
    double[] z = new double[2];
    double[] lnGamma = new double[2];
    z[0] = 0.00;
    int j = 0;
    while (z[0] < 1.0001) {
        z[1] = 1 - z[0];
        x1[j] = z[0];
        x2[j] = z[1];
        cosmosac.setComposition(z);
        cosmosac.activityCoefficient(lnGamma);
        gamma1[j] = Math.exp(lnGamma[0]);
        gamma2[j] = Math.exp(lnGamma[1]);
        z[0] += 0.05;
        j++;
    }

    double[][] parAntoine = new double[3][3];
    parAntoine[0][0] = 16.8958;
    parAntoine[0][1] = 3795.17;
    parAntoine[0][2] = 230.918;
    parAntoine[1][0] = 13.9320;
    parAntoine[1][1] = 3056.96;
    parAntoine[1][2] = 217.625;

    double[] Psat = pSat(parAntoine, T);
    double[] P = calcPx(x1, x2, gamma1, gamma2, Psat);
    double[] y1 = calcY(x1, gamma1, Psat, P);

    XYPlot plot1;
    XYSeriesCollection dataset = new XYSeriesCollection();
    XYSeries liq = new XYSeries("liquid");
    XYSeries vap = new XYSeries("vapor");
    XYSeries raoult = new XYSeries("Raoult's Law");
    for (int i = 0; i < n; i++) {
        liq.add(x1[i], P[i]);
        vap.add(y1[i], P[i]);
    }
    ;
    raoult.add(0, Psat[1]);
    raoult.add(1, Psat[0]);
    dataset.addSeries(liq);
    dataset.addSeries(vap);
    dataset.addSeries(raoult);

    JFreeChart chart = ChartFactory.createXYLineChart(null, "Mole Fraction: x1, y1", "P/KPa", null,
            PlotOrientation.VERTICAL, true, true, false);
    plot1 = (XYPlot) chart.getPlot();
    plot1.getDomainAxis().setRange(new Range(0.0, 1.0));
    plot1.getRangeAxis().setRange(new Range(15.0, 50.0));

    plot1.setDataset(dataset);

    XYSplineRenderer r = new XYSplineRenderer();
    BasicStroke stroke = new BasicStroke(2f);
    r.setStroke(stroke);
    plot1.setRenderer(r);
    r.setBaseShapesVisible(false);

    ChartPanel chartPanel = new ChartPanel(chart);
    JPanel jp = new JPanel(new BorderLayout());
    jp.add(chartPanel);

    add(jp, BorderLayout.CENTER);
    setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    setSize(400, 500);

    return jp;
}

From source file:DashboardInterface.LaunchGraph.java

public void addDataset(String title, int index, int range) {
    XYSplineRenderer render = new XYSplineRenderer();
    TimeSeriesCollection dataset = new TimeSeriesCollection();
    TimeSeries series = new TimeSeries(title);
    dataset.addSeries(series);/*from   w  ww.  ja v a2s  .c o m*/
    XYDataset xyDataset = dataset;

    plot.setDataset(index, xyDataset);
    plot.setRenderer(index, render);

    NumberAxis axis = new NumberAxis(title);
    axis.setRange(0, range);

    plot.setRangeAxis(index, axis);
    plot.mapDatasetToRangeAxis(index, index);

    XYLineAndShapeRenderer renderer = (XYLineAndShapeRenderer) plot.getRendererForDataset(xyDataset);
    renderer.setBaseShapesVisible(false);
    renderer.setBaseShapesFilled(false);
}

From source file:msi.gama.outputs.layers.ChartDataListStatement.java

public ChartDataList createData(final IScope scope) throws GamaRuntimeException {
    ChartDataList datalist = new ChartDataList();

    //      scope.addVarWithValue(ChartDataListStatement.UPDATEDATA, new Boolean(true));
    //      scope.addVarWithValue(ChartDataListStatement.REVERSEDATA, new Boolean(reverse));
    //      for (int i=0; i<values.size(); i++)
    //      {/*from   ww w  . j a  v a  2  s.co  m*/
    //         ((ArrayList) scope.getVarValue(ChartDataStatement.DATAS)).add(values.get(i));         
    //      }
    IExpression valexp = getFacet(IKeyword.VALUE);
    datalist.valuelistexp = valexp;
    Boolean reverse = Cast.asBool(scope, getFacetValue(scope, "inverse_series_categories", false));
    datalist.doreverse = reverse;

    IExpression categexp = getFacet(ChartDataListStatement.CATEGNAMES);
    datalist.categlistexp = categexp;

    IExpression colorexp = getFacet(IKeyword.COLOR);
    datalist.colorlistexp = colorexp;

    IExpression serexp = getFacet(IKeyword.LEGEND);
    datalist.legendlistexp = serexp;

    if (categexp != null) {
        //         scope.addVarWithValue(ChartDataListStatement.CATEGNAMES, categexp);         
    }
    if (serexp != null) {
        //         scope.addVarWithValue(ChartDataListStatement.SERIESNAMES, serexp);
    }

    /*      Object val=valexp.resolveAgainst(scope).value(scope);
          if (!(val instanceof GamaList))
          {
             GuiUtils.debug("chart list with no list...");
             return datalist;
          }
                  
          IList values = Cast.asList(scope,val);
          GamaList defaultnames=new GamaList<String>();
          GamaList defaultcolors=new GamaList<GamaColor>();
          for (int i=0; i<values.size();i++)
          {
             defaultnames.add("data"+i);
             if (i<10)
             {
    if (i==0) defaultcolors.add((GamaColor)Cast.asColor(scope,GamaColor.CYAN));
    if (i==1) defaultcolors.add((GamaColor)Cast.asColor(scope,GamaColor.RED));
    if (i==2) defaultcolors.add((GamaColor)Cast.asColor(scope,GamaColor.YELLOW));
    if (i==3) defaultcolors.add((GamaColor)Cast.asColor(scope,GamaColor.GREEN));
    if (i==4) defaultcolors.add((GamaColor)Cast.asColor(scope,GamaColor.BLUE));
    if (i==5) defaultcolors.add((GamaColor)Cast.asColor(scope,GamaColor.PINK));
    if (i==6) defaultcolors.add((GamaColor)Cast.asColor(scope,GamaColor.MAGENTA));
    if (i==7) defaultcolors.add((GamaColor)Cast.asColor(scope,GamaColor.ORANGE));
    if (i==8) defaultcolors.add((GamaColor)Cast.asColor(scope,GamaColor.LIGHT_GRAY));
    if (i==9) defaultcolors.add((GamaColor)Cast.asColor(scope,GamaColor.DARK_GRAY));
             }
             if (i>=10)
             if (i<GamaColor.colors.size())
    defaultcolors.add(GamaColor.int_colors.values().toArray()[i]);
             else
    defaultcolors.add(GamaColor.getInt(Random.opRnd(scope, 10000)));            
                     
          }
          IList colors=defaultcolors;
            
          boolean dynamicseriesnames=false;
          GamaList seriesnames=defaultnames;
                  
          IExpression serievalue=(IExpression) scope.getVarValue(ChartDataListStatement.SERIESNAMES);
                  
          if (serievalue!=null)
          {
          Object valc=serievalue.resolveAgainst(scope).value(scope);
          if ((valc instanceof GamaList))
          {
             dynamicseriesnames=true;
             seriesnames=(GamaList)valc;
             for (int i=0; i<Math.min(values.size(),seriesnames.size());i++)
             {
    defaultnames.set(i,seriesnames.get(i)+"("+i+")");
             }
          }
          }
    //      GuiUtils.debug("dyncateg:"+defaultnames);
                  
    //      names = Cast.asList(scope, getFacetValue(scope, IKeyword.LEGEND,getFacetValue(scope, IKeyword.NAME,defaultnames)));
          colors = Cast.asList(scope, getFacetValue(scope, IKeyword.COLOR,defaultcolors));
    */

    boolean showMarkers = getFacetValue(scope, ChartDataStatement.MARKER, true);
    boolean showLine = getFacetValue(scope, ChartDataStatement.LINE_VISIBLE, true);
    boolean fillMarkers = getFacetValue(scope, ChartDataStatement.FILL, true);
    String style = getLiteral(IKeyword.STYLE);
    if (style == null) {
        style = IKeyword.LINE;
    }
    AbstractRenderer r = null;
    if (style.equals(IKeyword.LINE)) {
        r = new XYLineAndShapeRenderer(true, showMarkers);
        ((XYLineAndShapeRenderer) r).setBaseShapesFilled(fillMarkers);
        ((XYLineAndShapeRenderer) r).setSeriesLinesVisible(0, showLine);
    } else if (style.equals(IKeyword.AREA)) {
        r = new XYAreaRenderer();
    } else if (style.equals(IKeyword.WHISKER)) {
        r = new BoxAndWhiskerRenderer();
    } else if (style.equals(IKeyword.BAR)) {
        r = new BarRenderer();
    } else if (style.equals(IKeyword.DOT)) {
        r = new XYDotRenderer();
    } else if (style.equals(IKeyword.SPLINE)) {
        r = new XYSplineRenderer();
    } else if (style.equals(IKeyword.STEP)) {
        r = new XYStepRenderer();
    } else if (style.equals(IKeyword.AREA_STACK)) {
        r = new StackedXYAreaRenderer2();
    } else if (style.equals(IKeyword.STACK)) {
        r = new StackedBarRenderer();
    }
    datalist.renderer = r;

    return datalist;
}

From source file:graficoyoutube.Grafico.java

private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed
    // TODO add your handling code here:
    ChartPanel panel;/*from  w  w  w. j a  v  a  2  s .  c  om*/
    JFreeChart chart = null;

    if (l.isSelected()) {
        //Graficas de Lineas
        int validar = 1;
        XYSplineRenderer renderer = new XYSplineRenderer();
        XYSeriesCollection dataset = new XYSeriesCollection();

        ValueAxis x = new NumberAxis();
        ValueAxis y = new NumberAxis();

        XYSeries serie = new XYSeries("Datos");

        XYPlot plot;
        lineas.removeAll();

        try {
            for (int fila = 0; fila <= datos.getRowCount(); fila++) {
                serie.add(Float.parseFloat(String.valueOf(datos.getValueAt(fila, 0))),
                        Float.parseFloat(String.valueOf(datos.getValueAt(fila, 1))));
                //JOptionPane.showMessageDialog(this,datos.getValueAt(fila, 0)+" ,"+ datos.getValueAt(fila, 1));
            }
        } catch (Exception ex) {
            validar = 0;
            JOptionPane.showMessageDialog(this, ex.getMessage() + "\n" + validar);

        }
        if (validar == 1) {
            dataset.addSeries(serie);
            x.setLabel("Eje X");
            y.setLabel("Eje Y");
            plot = new XYPlot(dataset, x, y, renderer);
            chart = new JFreeChart(plot);
            chart.setTitle("Grafico de Lineas YouTube");

        } else {
            JOptionPane.showMessageDialog(this, "Debe llenar la tabla con datos numericos");
        }

    } else {
        if (b.isSelected()) {
            //Grafico de Barras
            DefaultCategoryDataset data = new DefaultCategoryDataset();
            String producto1 = "Sopas";
            String producto2 = "Soda";

            String dia1 = "Dia 1";
            String dia2 = "Dia 2";
            String dia3 = "Dia 3";
            String dia4 = "Dia 4";

            data.addValue(18, producto1, dia1);
            data.addValue(15, producto1, dia2);
            data.addValue(14, producto1, dia3);
            data.addValue(1, producto1, dia4);

            data.addValue(50, producto2, dia1);
            data.addValue(45, producto2, dia2);
            data.addValue(31, producto2, dia3);
            data.addValue(10, producto2, dia4);

            chart = ChartFactory.createBarChart("Grafico de Barras YouTube", "Dia", "Cantidad", data,
                    PlotOrientation.HORIZONTAL, true, true, true);

            CategoryPlot plot = (CategoryPlot) chart.getPlot();
            plot.setDomainGridlinesVisible(true);

        } else {
            //Grafico de Pastel
            DefaultPieDataset data = new DefaultKeyedValuesDataset();
            data.setValue("Categoria 1", 20);
            data.setValue("Categoria 2", 60);
            data.setValue("Categoria 3", 20);

            chart = ChartFactory.createPieChart3D("Grafico de Pastel", data, true, true, true);

        }
    }
    panel = new ChartPanel(chart);
    panel.setBounds(5, 10, 410, 400);
    if (l.isSelected()) {
        //Lineas
        lineas.add(panel);
        lineas.repaint();
    } else {
        if (b.isSelected()) {
            barras.add(panel);
            barras.repaint();
        } else {
            pastel.add(panel);
            pastel.repaint();
        }
    }

}

From source file:ec.ui.view.DistributionView.java

private static JFreeChart createDistributionViewChart() {
    XYPlot plot = new XYPlot();

    XYLineAndShapeRenderer dRenderer = new XYSplineRenderer();
    dRenderer.setBaseShapesVisible(false);
    dRenderer.setAutoPopulateSeriesPaint(false);
    dRenderer.setAutoPopulateSeriesStroke(false);
    dRenderer.setBaseStroke(TsCharts.getStrongStroke(LinesThickness.Thin));
    dRenderer.setDrawSeriesLineAsPath(true); // not sure if useful
    plot.setDataset(DISTRIBUTION_INDEX, Charts.emptyXYDataset());
    plot.setRenderer(DISTRIBUTION_INDEX, dRenderer);

    XYBarRenderer hRenderer = new XYBarRenderer();
    hRenderer.setShadowVisible(false);//w  ww  . j a  v  a  2s. c  o m
    hRenderer.setDrawBarOutline(true);
    hRenderer.setAutoPopulateSeriesPaint(false);
    hRenderer.setAutoPopulateSeriesOutlinePaint(false);
    hRenderer.setBaseSeriesVisibleInLegend(false);
    plot.setDataset(HISTOGRAM_INDEX, Charts.emptyXYDataset());
    plot.setRenderer(HISTOGRAM_INDEX, hRenderer);

    NumberAxis domainAxis = new NumberAxis();
    domainAxis.setTickLabelPaint(TsCharts.CHART_TICK_LABEL_COLOR);
    plot.setDomainAxis(domainAxis);
    plot.setDomainGridlinesVisible(false);

    NumberAxis rangeAxis = new NumberAxis();
    rangeAxis.setTickLabelPaint(TsCharts.CHART_TICK_LABEL_COLOR);
    rangeAxis.setTickUnit(new NumberTickUnit(0.05));
    rangeAxis.setNumberFormatOverride(new DecimalFormat("0.###"));
    plot.setRangeAxis(rangeAxis);

    plot.mapDatasetToDomainAxis(0, 0);
    plot.mapDatasetToRangeAxis(0, 0);
    plot.mapDatasetToDomainAxis(1, 0);
    plot.mapDatasetToRangeAxis(1, 0);

    JFreeChart result = new JFreeChart("", JFreeChart.DEFAULT_TITLE_FONT, plot, true);
    result.setPadding(TsCharts.CHART_PADDING);
    result.getTitle().setFont(TsCharts.CHART_TITLE_FONT);
    result.getLegend().setFrame(BlockBorder.NONE);
    result.getLegend().setBackgroundPaint(null);
    return result;
}

From source file:org.deegree.graphics.charts.ChartsBuilder.java

/**
 * Creates an XY Line chart// w  w w .j a va  2s .  c o m
 *
 * @param title
 * @param keyedValues
 *            key is the category name, value is a series tupels Format: key = x1,y1;x2,y2;x3,y3 Example row1 =
 *            2,3;4,10 Note that x and y have to be numbers
 * @param width
 *            of the output image
 * @param height
 *            height of the output image
 * @param legend
 *            for the output chart
 * @param tooltips
 *            for the output de.latlon.charts
 * @param orientation
 *            Horiyontal or vertical chart
 * @param imageType
 *            of the output image
 * @param horizontalAxisName
 *            Name of the Horizontal Axis
 * @param verticalAxisName
 *            Name of the vertical Axis
 * @param chartConfigs
 *            to configure the output chart, or null to use the default ChartConfig
 * @return BufferedImage representing the generated chart
 * @throws IncorrectFormatException
 */
public BufferedImage createXYLineChart(String title, QueuedMap<String, String> keyedValues, int width,
        int height, boolean legend, boolean tooltips, int orientation, String imageType,
        String horizontalAxisName, String verticalAxisName, ChartConfig chartConfigs)
        throws IncorrectFormatException {
    XYDataset dataset = convertMapToXYSeriesDataSet(keyedValues);

    JFreeChart chart = null;
    chart = ChartFactory.createXYLineChart(title, horizontalAxisName, verticalAxisName, dataset,
            translateToPlotOrientation(orientation), legend, tooltips, false);

    XYSplineRenderer renderer = new XYSplineRenderer();
    XYPlot plot = (XYPlot) chart.getPlot();
    plot.setRenderer(renderer);
    if (chartConfigs == null) {
        chartConfigs = this.chartConfigs;
    }
    return createBufferedImage(configLineChart(chart, chartConfigs), width, height, imageType);
}