Example usage for org.jfree.chart JFreeChart setTitle

List of usage examples for org.jfree.chart JFreeChart setTitle

Introduction

In this page you can find the example usage for org.jfree.chart JFreeChart setTitle.

Prototype

public void setTitle(String text) 

Source Link

Document

Sets the chart title and sends a ChartChangeEvent to all registered listeners.

Usage

From source file:org.pentaho.di.ui.spoon.trans.TransPerfDelegate.java

private void updateCanvas() {
    Rectangle bounds = canvas.getBounds();
    if (bounds.width <= 0 || bounds.height <= 0) {
        return;//from  w w w.jav a  2  s  .  co  m
    }

    // The list of snapshots : convert to JFreeChart dataset
    //
    DefaultCategoryDataset dataset = new DefaultCategoryDataset();

    String[] selectedSteps = stepsList.getSelection();
    if (selectedSteps == null || selectedSteps.length == 0) {
        selectedSteps = new String[] { steps[0], }; // first step
        stepsList.select(0);
    }
    int[] dataIndices = dataList.getSelectionIndices();
    if (dataIndices == null || dataIndices.length == 0) {
        dataIndices = new int[] { DATA_CHOICE_WRITTEN, };
        dataList.select(0);
    }

    boolean multiStep = stepsList.getSelectionCount() > 1;
    boolean multiData = dataList.getSelectionCount() > 1;
    boolean calcMoving = !multiStep && !multiData; // A single metric shown for a single step
    List<Double> movingList = new ArrayList<Double>();
    int movingSize = 10;
    double movingTotal = 0;
    int totalTimeInSeconds = 0;

    for (int t = 0; t < selectedSteps.length; t++) {

        String stepNameCopy = selectedSteps[t];

        List<StepPerformanceSnapShot> snapShotList = stepPerformanceSnapShots.get(stepNameCopy);
        if (snapShotList != null && snapShotList.size() > 1) {
            totalTimeInSeconds = (int) Math
                    .round(((double) (snapShotList.get(snapShotList.size() - 1).getDate().getTime()
                            - snapShotList.get(0).getDate().getTime())) / 1000);
            for (int i = 0; i < snapShotList.size(); i++) {
                StepPerformanceSnapShot snapShot = snapShotList.get(i);
                if (snapShot.getTimeDifference() != 0) {

                    double factor = (double) 1000 / (double) snapShot.getTimeDifference();

                    for (int d = 0; d < dataIndices.length; d++) {

                        String dataType;
                        if (multiStep) {
                            dataType = stepNameCopy;
                        } else {
                            dataType = dataChoices[dataIndices[d]];
                        }
                        String xLabel = Integer.toString(Math.round(i * timeDifference / 1000));
                        Double metric = null;
                        switch (dataIndices[d]) {
                        case DATA_CHOICE_INPUT:
                            metric = snapShot.getLinesInput() * factor;
                            break;
                        case DATA_CHOICE_OUTPUT:
                            metric = snapShot.getLinesOutput() * factor;
                            break;
                        case DATA_CHOICE_READ:
                            metric = snapShot.getLinesRead() * factor;
                            break;
                        case DATA_CHOICE_WRITTEN:
                            metric = snapShot.getLinesWritten() * factor;
                            break;
                        case DATA_CHOICE_UPDATED:
                            metric = snapShot.getLinesUpdated() * factor;
                            break;
                        case DATA_CHOICE_REJECTED:
                            metric = snapShot.getLinesRejected() * factor;
                            break;
                        case DATA_CHOICE_INPUT_BUFFER_SIZE:
                            metric = (double) snapShot.getInputBufferSize();
                            break;
                        case DATA_CHOICE_OUTPUT_BUFFER_SIZE:
                            metric = (double) snapShot.getOutputBufferSize();
                            break;
                        default:
                            break;
                        }
                        if (metric != null) {
                            dataset.addValue(metric, dataType, xLabel);

                            if (calcMoving) {
                                movingTotal += metric;
                                movingList.add(metric);
                                if (movingList.size() > movingSize) {
                                    movingTotal -= movingList.get(0);
                                    movingList.remove(0);
                                }
                                double movingAverage = movingTotal / movingList.size();
                                dataset.addValue(movingAverage, dataType + "(Avg)", xLabel);
                                // System.out.println("moving average = "+movingAverage+", movingTotal="+movingTotal+", m");
                            }
                        }
                    }
                }
            }
        }
    }
    String chartTitle = title;
    if (multiStep) {
        chartTitle += " (" + dataChoices[dataIndices[0]] + ")";
    } else {
        chartTitle += " (" + selectedSteps[0] + ")";
    }
    final JFreeChart chart = ChartFactory.createLineChart(chartTitle, // chart title
            BaseMessages.getString(PKG, "StepPerformanceSnapShotDialog.TimeInSeconds.Label",
                    Integer.toString(totalTimeInSeconds), Long.toString(timeDifference)), // domain axis label
            BaseMessages.getString(PKG, "StepPerformanceSnapShotDialog.RowsPerSecond.Label"), // range axis label
            dataset, // data
            PlotOrientation.VERTICAL, // orientation
            true, // include legend
            true, // tooltips
            false); // urls       
    chart.setBackgroundPaint(Color.white);
    TextTitle title = new TextTitle(chartTitle);
    // title.setExpandToFitSpace(true);
    // org.eclipse.swt.graphics.Color pentahoColor = GUIResource.getInstance().getColorPentaho();
    // java.awt.Color color = new java.awt.Color(pentahoColor.getRed(), pentahoColor.getGreen(),pentahoColor.getBlue());
    // title.setBackgroundPaint(color);
    title.setFont(new java.awt.Font("SansSerif", java.awt.Font.BOLD, 12));
    chart.setTitle(title);
    CategoryPlot plot = (CategoryPlot) chart.getPlot();
    plot.setBackgroundPaint(Color.white);
    plot.setForegroundAlpha(0.5f);
    plot.setRangeGridlinesVisible(true);

    NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis();
    rangeAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits());

    CategoryAxis domainAxis = plot.getDomainAxis();
    domainAxis.setTickLabelsVisible(false);

    // Customize the renderer...
    //
    LineAndShapeRenderer renderer = (LineAndShapeRenderer) plot.getRenderer();
    renderer.setBaseShapesVisible(true);
    renderer.setDrawOutlines(true);
    renderer.setUseFillPaint(true);
    renderer.setBaseFillPaint(Color.white);
    renderer.setSeriesStroke(0, new BasicStroke(1.5f));
    renderer.setSeriesOutlineStroke(0, new BasicStroke(1.5f));
    renderer.setSeriesStroke(1, new BasicStroke(2.5f));
    renderer.setSeriesOutlineStroke(1, new BasicStroke(2.5f));
    renderer.setSeriesShape(0, new Ellipse2D.Double(-3.0, -3.0, 6.0, 6.0));

    BufferedImage bufferedImage = chart.createBufferedImage(bounds.width, bounds.height,
            BufferedImage.TYPE_INT_RGB, null);
    ImageData imageData = ImageUtil.convertToSWT(bufferedImage);

    // dispose previous image...
    //
    if (image != null) {
        image.dispose();
    }
    image = new Image(transGraph.getDisplay(), imageData);

    // Draw the image on the canvas...
    //
    canvas.redraw();
}

From source file:ro.nextreports.engine.chart.JFreeChartExporter.java

private void setTitle(JFreeChart jfreechart) {
    TextTitle title = new TextTitle(StringUtil.getI18nString(replaceParameters(chart.getTitle().getTitle()),
            I18nUtil.getLanguageByName(chart, language)));
    title.setFont(chart.getTitle().getFont());
    title.setPaint(chart.getTitle().getColor());
    if (chart.getTitle().getAlignment() == ChartTitle.LEFT_ALIGNMENT) {
        title.setHorizontalAlignment(HorizontalAlignment.LEFT);
    } else if (chart.getTitle().getAlignment() == ChartTitle.RIGHT_ALIGNMENT) {
        title.setHorizontalAlignment(HorizontalAlignment.RIGHT);
    } else {//  w  ww  .j  a v a  2 s.  c  o  m
        title.setHorizontalAlignment(HorizontalAlignment.CENTER);
    }
    jfreechart.setTitle(title);
}

From source file:com.rapidminer.gui.new_plotter.engine.jfreechart.JFreeChartPlotEngine.java

private void setChartTitle() {
    JFreeChart chart = getCurrentChart();
    if (chart != null) {
        String text = plotInstance.getCurrentPlotConfigurationClone().getTitleText();
        if (text == null) {
            chart.setTitle(text);
            return;
        }/*ww w  .  j ava  2  s. c  o  m*/

        Font font = plotInstance.getCurrentPlotConfigurationClone().getTitleFont();
        if (font == null) {
            font = new Font("Dialog", Font.PLAIN, 10);
        }

        TextTitle textTitle = new TextTitle(text, font);
        textTitle.setPaint(plotInstance.getCurrentPlotConfigurationClone().getTitleColor());

        chart.setTitle(textTitle);

    }

}

From source file:org.gumtree.vis.awt.JChartPanel.java

@Override
public void setPlotTitle(String title) {
    JFreeChart chart = getChart();
    chart.setTitle(title);
}

From source file:graficos.Grafico1.java

private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed

    ChartPanel panel;// w ww  .j  a va 2 s.  c  om
    JFreeChart chart = null;

    if (l.isSelected()) {
        //Grafico de Linea
        int ban = 1; //para validar que la tabla no esta vacia o que tenga solo caracteres numericos

        XYSplineRenderer renderer = new XYSplineRenderer();// renderizador
        XYSeriesCollection dataset = new XYSeriesCollection();// variable para almacenar los datos que le enviamos para hacer el ploteo

        //Ejes x , y
        ValueAxis x = new NumberAxis();
        ValueAxis y = new NumberAxis();

        XYSeries serie = new XYSeries("Datos");//almacena conjunto de datos que vamos a graficar
        //Le paso por parametro el nombre que recibe la serie

        XYPlot plot;

        // Hago el recorrido del JTable datos y lo agrego a la serie 
        try {
            for (int fila = 0; fila < 5; fila++) {
                GraficoLinea.removeAll();

                serie.add(Float.parseFloat(String.valueOf(datos.getValueAt(fila, 0))),
                        Float.parseFloat(String.valueOf(datos.getValueAt(fila, 1))));
            }
        } catch (Exception e) {
            ban = 0;
            JOptionPane.showMessageDialog(this, e.toString());
        }

        if (ban == 1) {
            // Pasos claves para hacer el grafico de linea
            // Agrego al dataset la serie de datos.
            dataset.addSeries(serie);
            //Nombres de los ejes
            x.setLabel("Eje X");
            y.setLabel("Eje Y");
            //Ploteo pasando por parametr , el data set, los ejes y el renderer.
            plot = new XYPlot(dataset, x, y, renderer);

            chart = new JFreeChart(plot);
            chart.setTitle("Grafico de Lineas");

        }

    } else {
        if (b.isSelected()) {
            //Grafico de Barra
            DefaultCategoryDataset data = new DefaultCategoryDataset();
            // este esta hecho con datos que yo invente..

            String producto1 = "Sopa Quick";
            String producto2 = "Yerba Mate";

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

            data.addValue(14, dia1, producto1);
            data.addValue(17, dia2, producto1);
            data.addValue(19, dia3, producto1);
            data.addValue(27, dia4, producto1);
            data.addValue(30, dia5, producto1);

            data.addValue(1, dia1, producto2);
            data.addValue(4, dia2, producto2);
            data.addValue(9, dia3, producto2);
            data.addValue(16, dia4, producto2);
            data.addValue(33, dia5, producto2);

            chart = ChartFactory.createBarChart("Grafico de Barra", "Dia", "Cantidad", data,
                    PlotOrientation.VERTICAL, true, true, true);

            CategoryPlot plot = (CategoryPlot) chart.getPlot();
            plot.setDomainGridlinesVisible(true);
        } else {

            //Grafico de Torta
            DefaultPieDataset data = new DefaultPieDataset();
            data.setValue("Categoria1", 20);
            data.setValue("Categoria2", 400);
            data.setValue("Categoria3", 60);

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

        }

    }

    panel = new ChartPanel(chart);
    panel.setBounds(5, 10, 410, 400);

    if (b.isSelected()) {//Barra
        GraficoBarra.add(panel);
        GraficoBarra.repaint();
    } else {
        if (l.isSelected()) {//Linea
            GraficoLinea.add(panel);
            GraficoLinea.repaint();
        } else {
            //Torta
            GraficoTorta.add(panel);
            GraficoTorta.repaint();
        }

    }

}

From source file:org.sakaiproject.gradebookng.tool.panels.SettingsGradingSchemaPanel.java

/**
 * Build the data for the chart//from  w  w  w.  j  a v  a 2s.c  om
 * 
 * @return
 */
private JFreeChart getChartData() {

    // just need the list
    final List<CourseGrade> courseGrades = this.courseGradeMap.values().stream().collect(Collectors.toList());

    // get current grading schema (from model so that it reflects current state)
    final List<GbGradingSchemaEntry> gradingSchemaEntries = this.model.getObject().getGradingSchemaEntries();

    final DefaultCategoryDataset data = new DefaultCategoryDataset();
    final Map<String, Integer> counts = new LinkedHashMap<>(); // must retain order so graph can be printed correctly

    // add all schema entries (these will be sorted according to {@link LetterGradeComparator})
    gradingSchemaEntries.forEach(e -> {
        counts.put(e.getGrade(), 0);
    });

    // now add the count of each course grade for those schema entries
    this.total = 0;
    for (final CourseGrade g : courseGrades) {

        // course grade may not be released so we have to skip it
        if (StringUtils.isBlank(g.getMappedGrade())) {
            continue;
        }

        counts.put(g.getMappedGrade(), counts.get(g.getMappedGrade()) + 1);
        this.total++;
    }

    // build the data
    final ListIterator<String> iter = new ArrayList<>(counts.keySet()).listIterator(0);
    while (iter.hasNext()) {
        final String c = iter.next();
        data.addValue(counts.get(c), "count", c);
    }

    final JFreeChart chart = ChartFactory.createBarChart(null, // the chart title
            getString("settingspage.gradingschema.chart.xaxis"), // the label for the category (x) axis
            getString("label.statistics.chart.yaxis"), // the label for the value (y) axis
            data, // the dataset for the chart
            PlotOrientation.HORIZONTAL, // the plot orientation
            false, // show legend
            true, // show tooltips
            false); // show urls

    chart.getCategoryPlot().setRangeAxisLocation(AxisLocation.BOTTOM_OR_RIGHT);
    chart.setBorderVisible(false);
    chart.setAntiAlias(false);

    final CategoryPlot plot = chart.getCategoryPlot();
    final BarRenderer br = (BarRenderer) plot.getRenderer();

    br.setItemMargin(0);
    br.setMinimumBarLength(0.05);
    br.setMaximumBarWidth(0.1);
    br.setSeriesPaint(0, new Color(51, 122, 183));
    br.setBarPainter(new StandardBarPainter());
    br.setShadowPaint(new Color(220, 220, 220));
    BarRenderer.setDefaultShadowsVisible(true);

    br.setBaseToolTipGenerator(new StandardCategoryToolTipGenerator(getString("label.statistics.chart.tooltip"),
            NumberFormat.getInstance()));

    plot.setRenderer(br);

    // show only integers in the count axis
    plot.getRangeAxis().setStandardTickUnits(new NumberTickUnitSource(true));

    // make x-axis wide enough so we don't get ... suffix
    plot.getDomainAxis().setMaximumCategoryLabelWidthRatio(2.0f);

    plot.setBackgroundPaint(Color.white);

    chart.setTitle(getString("settingspage.gradingschema.chart.heading"));

    return chart;
}

From source file:udea.edu.com.co.grafico.Graficas.java

private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed
    ChartPanel panel;/*from w  w w .j  a  v a 2 s .  co m*/
    JFreeChart chart = null;
    //GRAFICO 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 {
        if (columnaX != null && columnaY != null) {
            B0 = Calculos.calcularBetaCero(columnaX, columnaY);
            B1 = Calculos.calcularBetaUno(columnaX, columnaY);
            double r = Calculos.calcularR(columnaX, columnaY);
            double[][] resultados = Calculos.calcularYkEnFuncionDeXk(columnaX, B0, B1);
            for (int i = 0; i < resultados.length; i++) {
                serie.add(resultados[1][i], resultados[0][i]);
            }

            B0 = Calculos.roundDouble(B0, 4);
            B1 = Calculos.roundDouble(B1, 4);
            r = Calculos.roundDouble(r, 4);
            double rCuadrado = Calculos.roundDouble(pow(r, 2), 4);

            this.textBeta0.setText(String.valueOf(B0));
            this.textBeta1.setText(String.valueOf(B1));
            this.textErreXY.setText(String.valueOf(r));
            this.textErre2.setText(String.valueOf(rCuadrado));

            this.labelYk1.setVisible(true);
            this.textYk.setVisible(true);
            this.btnCalcularYk.setVisible(true);
        }
    } catch (Exception ex) {
        validar = 0;
    }
    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("Y = " + String.format("%.3f", B0) + " + " + String.format("%.3f", B1) + "X");
    } else {
        JOptionPane.showMessageDialog(this, "Debe llenar la tabla con datos numericos");
    }
    panel = new ChartPanel(chart);
    panel.setBounds(5, 10, 410, 350);
    lineas.add(panel);
    lineas.repaint();
}

From source file:it.eng.spagobi.engines.chart.bo.charttypes.piecharts.SimplePie.java

public JFreeChart createChart(DatasetMap datasets) {

    Dataset dataset = (Dataset) datasets.getDatasets().get("1");

    JFreeChart chart = null;

    if (!threeD) {
        chart = ChartFactory.createPieChart(name, (PieDataset) dataset, // data
                legend, // include legend
                true, false);//from w  w  w.ja v  a2  s  . c o  m

        chart.setBackgroundPaint(color);

        TextTitle title = chart.getTitle();
        title.setToolTipText("A title tooltip!");

        PiePlot plot = (PiePlot) chart.getPlot();
        plot.setLabelFont(new Font(defaultLabelsStyle.getFontName(), Font.PLAIN, defaultLabelsStyle.getSize()));
        plot.setCircular(false);
        plot.setLabelGap(0.02);
        plot.setNoDataMessage("No data available");

        if (percentage == false) {
            plot.setLabelGenerator(new StandardPieSectionLabelGenerator("{0} ({1})"));
        } else {
            plot.setLabelGenerator(new StandardPieSectionLabelGenerator("{0} ({2})"));
        }

    } else {
        chart = ChartFactory.createPieChart3D(name, (PieDataset) dataset, // data
                true, // include legend
                true, false);

        chart.setBackgroundPaint(color);

        TextTitle title = chart.getTitle();
        title.setToolTipText("A title tooltip!");

        PiePlot3D plot = (PiePlot3D) chart.getPlot();

        plot.setDarkerSides(true);
        plot.setStartAngle(290);
        plot.setDirection(Rotation.CLOCKWISE);
        plot.setForegroundAlpha(1.0f);
        plot.setDepthFactor(0.2);

        plot.setLabelFont(new Font(defaultLabelsStyle.getFontName(), Font.PLAIN, defaultLabelsStyle.getSize()));
        // plot.setNoDataMessages("No data available");
        plot.setCircular(false);
        plot.setLabelGap(0.02);
        plot.setNoDataMessage("No data available");

        if (percentage == false) {
            plot.setLabelGenerator(new StandardPieSectionLabelGenerator("{0} ({1})"));
        } else {
            plot.setLabelGenerator(new StandardPieSectionLabelGenerator("{0} ({2})"));
        }
    }

    TextTitle title = setStyleTitle(name, styleTitle);
    chart.setTitle(title);
    if (subName != null && !subName.equals("")) {
        TextTitle subTitle = setStyleTitle(subName, styleSubTitle);
        chart.addSubtitle(subTitle);
    }

    return chart;

}

From source file:com.rapidminer.gui.new_plotter.engine.jfreechart.JFreeChartPlotEngine.java

/**
 * Sets all the format options on the given chart like fonts, chart title, legend, legend
 * position etc.// w  ww  .ja  v  a 2s .c o  m
 */
private void formatChart(JFreeChart chart) {
    Plot plot = chart.getPlot();
    PlotConfiguration currentPlotConfigurationClone = plotInstance.getCurrentPlotConfigurationClone();

    // set plot background color
    plot.setBackgroundPaint(currentPlotConfigurationClone.getPlotBackgroundColor());

    formatLegend(chart);

    // set chart background color
    chart.setBackgroundPaint(currentPlotConfigurationClone.getChartBackgroundColor());

    // add title to chart
    String text = currentPlotConfigurationClone.getTitleText();
    if (text == null) {
        chart.setTitle(text);
    } else {
        Font font = currentPlotConfigurationClone.getTitleFont();
        if (font == null) {
            font = new Font("Dialog", Font.PLAIN, 10);
        }

        TextTitle textTitle = new TextTitle(text, font);
        textTitle.setPaint(currentPlotConfigurationClone.getTitleColor());

        chart.setTitle(textTitle);
    }
}

From source file:gov.nih.nci.caintegrator.plots.kaplanmeier.JFreeChartIKMPlottermpl.java

public JFreeChart createKMPlot(Collection<GroupCoordinates> groupsToBePlotted, String title, String xAxisLabel,
        String yAxisLabel) {/* ww w . j  a  v a  2  s  .  c  o m*/
    List<KMPlotPointSeriesSet> kmPlotSets = new ArrayList<KMPlotPointSeriesSet>(
            convertToKaplanMeierPlotPointSeriesSet(groupsToBePlotted));

    XYSeriesCollection finalDataCollection = new XYSeriesCollection();
    /*  Repackage all the datasets to go into the XYSeriesCollection */
    for (KMPlotPointSeriesSet dataSet : kmPlotSets) {
        finalDataCollection.addSeries(dataSet.getCensorPlotPoints());
        finalDataCollection.addSeries(dataSet.getProbabilityPlotPoints());

    }

    JFreeChart chart = ChartFactory.createXYLineChart("", xAxisLabel, yAxisLabel, finalDataCollection,
            PlotOrientation.VERTICAL, true, //legend
            true, //tooltips
            false//urls
    );
    XYPlot plot = (XYPlot) chart.getPlot();
    /*
     * Ideally the actual Renderer settings should have been created
     * at the survivalLength of iterating KaplanMeierPlotPointSeriesSets, adding them to the actual
     * Data Set that is going to be going into the Chart plotter.  But you have no idea how
     * they are going to be sitting in the Plot dataset so there is no guarantee that setting the
     * renderer based on a supposed index will actually work. In fact
     */

    XYLineAndShapeRenderer renderer = new XYLineAndShapeRenderer();
    for (int i = 0; i < finalDataCollection.getSeriesCount(); i++) {
        KMPlotPointSeries kmSeries = (KMPlotPointSeries) finalDataCollection.getSeries(i);

        if (kmSeries.getType() == KMPlotPointSeries.SeriesType.CENSOR) {
            renderer.setSeriesLinesVisible(i, false);
            renderer.setSeriesShapesVisible(i, true);
            renderer.setSeriesShape(i, getCensorShape());
        } else if (kmSeries.getType() == KMPlotPointSeries.SeriesType.PROBABILITY) {
            renderer.setSeriesLinesVisible(i, true);
            renderer.setSeriesShapesVisible(i, false);

        } else {
            //don't show this set as it is not a known type
            renderer.setSeriesLinesVisible(i, false);
            renderer.setSeriesShapesVisible(i, false);
        }
        renderer.setSeriesPaint(i, getKMSetColor(kmPlotSets, kmSeries.getKey(), kmSeries.getType()), true);
    }

    renderer.setToolTipGenerator(new StandardXYToolTipGenerator());
    renderer.setDefaultEntityRadius(6);
    plot.setRenderer(renderer);

    /* change the auto tick unit selection to integer units only... */
    NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis();
    rangeAxis.setStandardTickUnits(NumberAxis.createStandardTickUnits());

    /* OPTIONAL CUSTOMISATION COMPLETED. */
    rangeAxis.setAutoRange(true);
    rangeAxis.setRange(0.0, 1.0);

    /* set Title and Legend */
    chart.setTitle(title);
    createLegend(chart, kmPlotSets);

    return chart;
}