Example usage for org.jfree.chart.plot XYPlot setBackgroundPaint

List of usage examples for org.jfree.chart.plot XYPlot setBackgroundPaint

Introduction

In this page you can find the example usage for org.jfree.chart.plot XYPlot setBackgroundPaint.

Prototype

public void setBackgroundPaint(Paint paint) 

Source Link

Document

Sets the background color of the plot area and sends a PlotChangeEvent to all registered listeners.

Usage

From source file:com.rapidminer.gui.viewer.metadata.model.DateTimeAttributeStatisticsModel.java

/**
 * Creates the histogram chart.//  w w  w. j  ava  2  s.  c o  m
 *
 * @param exampleSet
 * @return
 */
private JFreeChart createHistogramChart(final ExampleSet exampleSet) {
    JFreeChart chart = ChartFactory.createHistogram(null, null, null, createHistogramDataset(exampleSet),
            PlotOrientation.VERTICAL, false, false, false);
    AbstractAttributeStatisticsModel.setDefaultChartFonts(chart);
    chart.setBackgroundPaint(null);
    chart.setBackgroundImageAlpha(0.0f);

    XYPlot plot = (XYPlot) chart.getPlot();
    plot.setRangeGridlinesVisible(false);
    plot.setDomainGridlinesVisible(false);
    plot.setOutlineVisible(false);
    plot.setRangeZeroBaselineVisible(false);
    plot.setDomainZeroBaselineVisible(false);
    plot.getDomainAxis().setTickLabelsVisible(false);
    plot.setBackgroundPaint(COLOR_INVISIBLE);
    plot.setBackgroundImageAlpha(0.0f);

    XYBarRenderer renderer = (XYBarRenderer) plot.getRenderer();
    renderer.setSeriesPaint(0, AttributeGuiTools.getColorForValueType(Ontology.DATE_TIME));
    renderer.setBarPainter(new StandardXYBarPainter());
    renderer.setDrawBarOutline(true);
    renderer.setShadowVisible(false);

    return chart;
}

From source file:mil.tatrc.physiology.biogears.verification.ScenarioPlotTool.java

public void formatXYPlot(JFreeChart chart, Paint bgColor) {
    XYPlot plot = (XYPlot) chart.getPlot();

    //For Scientific notation
    NumberFormat formatter = new DecimalFormat("0.######E0");
    NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis();
    rangeAxis.setNumberFormatOverride(formatter);

    //White background outside of plottable area
    chart.setBackgroundPaint(bgColor);/* ww  w  . j  a va2s.c om*/

    plot.setBackgroundPaint(Color.white);
    plot.setDomainGridlinePaint(Color.black);
    plot.setRangeGridlinePaint(Color.black);

    plot.setDomainCrosshairVisible(true);
    plot.setRangeCrosshairVisible(true);

    //Changing font sizes so they are readable. 
    plot.getDomainAxis().setLabelFont(largeFont);
    plot.getRangeAxis().setLabelFont(largeFont);
    plot.getDomainAxis().setTickLabelFont(smallFont);
    plot.getRangeAxis().setTickLabelFont(smallFont);

    plot.getDomainAxis().setLabelPaint(bgColor == Color.red ? Color.white : Color.black);
    plot.getRangeAxis().setLabelPaint(bgColor == Color.red ? Color.white : Color.black);
    plot.getDomainAxis().setTickLabelPaint(bgColor == Color.red ? Color.white : Color.black);
    plot.getRangeAxis().setTickLabelPaint(bgColor == Color.red ? Color.white : Color.black);

    chart.getLegend().setItemFont(smallFont);
    chart.getTitle().setFont(largeFont);
    chart.getTitle().setPaint(bgColor == Color.red ? Color.white : Color.black);
}

From source file:graph.MySensorPanel.java

/**
 * Creates a new self-contained demo panel.
 *//*  w w  w.  j a v  a 2 s  . c  om*/
public MySensorPanel(String header_str) {
    //super(new BorderLayout());
    this.series1 = new TimeSeries("Temperature");
    this.series2 = new TimeSeries("Humidity");
    TimeSeriesCollection dataset1 = new TimeSeriesCollection(this.series1);
    TimeSeriesCollection dataset2 = new TimeSeriesCollection(this.series2);

    JFreeChart chart = ChartFactory.createTimeSeriesChart(header_str, "Time", "C", dataset1, true, true,
            false);

    /*this.addChart(chart);*/

    XYPlot plot = (XYPlot) chart.getPlot();
    ValueAxis axis = plot.getDomainAxis();
    axis.setAutoRange(true);
    axis.setFixedAutoRange(1000.0 * 60 * 60 /* 24*/); // 24 hrs

    plot.setDataset(1, dataset2);
    NumberAxis rangeAxis2 = new NumberAxis("%");
    rangeAxis2.setAutoRangeIncludesZero(false);
    plot.setRenderer(1, new DefaultXYItemRenderer());
    plot.setRangeAxis(1, rangeAxis2);
    plot.mapDatasetToRangeAxis(1, 1);

    ChartUtilities.applyCurrentTheme(chart);
    plot.setBackgroundPaint(Color.DARK_GRAY);
    plot.setDomainGridlinePaint(Color.white);
    plot.setRangeGridlinePaint(Color.white);

    chartPanel = new ChartPanel(chart);
}

From source file:org.gwaspi.reports.GenericReportGenerator.java

public static XYPlot buildQQPlot(OperationKey testOpKey, int df) throws IOException {

    if (df != 1 && df != 2) {
        throw new IllegalArgumentException("Only df = 1 or 2 is supported; it is " + df);
    }//from w w w .  j a  va 2  s  .c  om

    //<editor-fold defaultstate="expanded" desc="PLOT DEFAULTS">
    final Config config = Config.getSingleton();
    final Color background = config.getColor(PLOT_QQ_BACKGROUND_CONFIG, PLOT_QQ_BACKGROUND_DEFAULT);
    final Color actual = config.getColor(PLOT_QQ_ACTUAL_CONFIG, PLOT_QQ_ACTUAL_DEFAULT);
    final Color sigma = config.getColor(PLOT_QQ_SIGMA_CONFIG, PLOT_QQ_SIGMA_DEFAULT);
    final Color mu = config.getColor(PLOT_QQ_MU_CONFIG, PLOT_QQ_MU_DEFAULT);
    //</editor-fold>

    //<editor-fold defaultstate="expanded" desc="GET X^2">
    List<Double> obsChiSqrVals = assembleQQPlotData(testOpKey);

    int N = obsChiSqrVals.size();
    List<Double> expChiSqrDist;
    if (df == 1) {
        expChiSqrDist = Chisquare.getChiSquareDistributionDf1(N, 1.0f);
    } else { // df == 2
        expChiSqrDist = Chisquare.getChiSquareDistributionDf2(N, 1.0f);
    }
    Collections.sort(expChiSqrDist);
    //</editor-fold>

    //<editor-fold defaultstate="expanded" desc="GET CONFIDENCE BOUNDARY">
    InputStream boundaryStream = GenericReportGenerator.class
            .getResourceAsStream("/samples/chisqrboundary-df" + df + ".txt");
    InputStreamReader isr = new InputStreamReader(boundaryStream);
    BufferedReader inputBufferReader = new BufferedReader(isr);

    Double stopValue = expChiSqrDist.get(N - 1);
    Double currentValue = 0d;
    List<Double[]> boundary = new ArrayList<Double[]>();
    while (currentValue <= stopValue) {
        String l = inputBufferReader.readLine();
        if (l == null) {
            break;
        }
        String[] cVals = l.split(",");
        Double[] slice = new Double[3];
        slice[0] = Double.parseDouble(cVals[0]);
        slice[1] = Double.parseDouble(cVals[1]);
        slice[2] = Double.parseDouble(cVals[2]);
        currentValue = slice[1];
        boundary.add(slice);
    }
    inputBufferReader.close();
    //</editor-fold>

    XYSeriesCollection dataSeries = new XYSeriesCollection();
    XYSeries seriesData = new XYSeries("X");
    XYSeries seriesRef = new XYSeries("Expected");

    for (int i = 0; i < obsChiSqrVals.size(); i++) {
        double obsVal = obsChiSqrVals.get(i);
        double expVal = expChiSqrDist.get(i);

        seriesData.add(expVal, obsVal);
        seriesRef.add(expVal, expVal);
    }

    //constant chi-square boundaries
    XYSeries seriesLower = new XYSeries("2 boundary");
    XYSeries seriesUpper = new XYSeries("");
    for (Double[] slice : boundary) {
        seriesUpper.add(slice[1], slice[0]);
        seriesLower.add(slice[1], slice[2]);
    }

    dataSeries.addSeries(seriesData);
    dataSeries.addSeries(seriesRef);
    dataSeries.addSeries(seriesUpper);
    dataSeries.addSeries(seriesLower);
    final XYDataset data = dataSeries;

    //create QQ plot
    final boolean withLegend = true;
    JFreeChart chart = ChartFactory.createScatterPlot("QQ-plot", "Exp X", "Obs X", data,
            PlotOrientation.VERTICAL, withLegend, false, false);

    final XYPlot plot = chart.getXYPlot();
    XYLineAndShapeRenderer renderer = new XYLineAndShapeRenderer(false, true);
    renderer.setSeriesPaint(0, actual);
    renderer.setSeriesPaint(1, mu);
    renderer.setSeriesPaint(2, sigma);
    renderer.setSeriesPaint(3, sigma);

    renderer.setBaseShapesVisible(true);
    renderer.setBaseShapesFilled(true);
    renderer.setSeriesShape(0, new Rectangle2D.Double(-1.0, -1.0, 2.0, 2.0));
    renderer.setSeriesShape(1, new Rectangle2D.Double(-1.0, -1.0, 2.0, 2.0));
    renderer.setSeriesShape(2, new Rectangle2D.Double(-1.0, -1.0, 2.0, 2.0));
    renderer.setSeriesShape(3, new Rectangle2D.Double(-1.0, -1.0, 2.0, 2.0));

    plot.setRenderer(renderer);

    // PLOT BACKGROUND COLOR
    plot.setBackgroundPaint(background); // Hue, saturation, brightness

    return plot;
}

From source file:com.rapidminer.gui.plotter.charts.SeriesChartPlotter.java

private JFreeChart createChart(XYDataset dataset, boolean createLegend) {

    // create the chart...
    JFreeChart chart = ChartFactory.createXYLineChart(null, // chart title
            null, // x axis label
            null, // y axis label
            dataset, // data
            PlotOrientation.VERTICAL, createLegend, // include legend
            true, // tooltips
            false // urls
    );/*from w w w.j  a va 2s .  c om*/

    chart.setBackgroundPaint(Color.white);

    // get a reference to the plot for further customization...
    XYPlot plot = (XYPlot) chart.getPlot();
    plot.setBackgroundPaint(Color.WHITE);
    plot.setAxisOffset(new RectangleInsets(5.0, 5.0, 5.0, 5.0));
    plot.setDomainGridlinePaint(Color.LIGHT_GRAY);
    plot.setRangeGridlinePaint(Color.LIGHT_GRAY);
    DeviationRenderer renderer = new DeviationRenderer(true, false);

    // colors
    if (dataset.getSeriesCount() == 1) {
        renderer.setSeriesStroke(0, new BasicStroke(1.5f, BasicStroke.CAP_ROUND, BasicStroke.JOIN_ROUND));
        renderer.setSeriesPaint(0, getColorProvider().getPointColor(1.0d));
    } else { // special case needed for avoiding devision by zero
        for (int i = 0; i < dataset.getSeriesCount(); i++) {
            renderer.setSeriesStroke(i, new BasicStroke(1.5f, BasicStroke.CAP_ROUND, BasicStroke.JOIN_ROUND));
            renderer.setSeriesPaint(i,
                    getColorProvider().getPointColor(1.0d - i / (double) (dataset.getSeriesCount() - 1)));
        }
    }
    // background for bounds
    if (plotBounds) {
        float[] dashArray = new float[] { 7, 14 };
        renderer.setSeriesStroke(boundsSeriesIndex,
                new BasicStroke(1.5f, BasicStroke.CAP_ROUND, BasicStroke.JOIN_ROUND, 1.0f, dashArray, 0));
        renderer.setSeriesPaint(boundsSeriesIndex, Color.GRAY.brighter());
        renderer.setSeriesFillPaint(boundsSeriesIndex, Color.GRAY);
    }
    // alpha
    renderer.setAlpha(0.25f);

    plot.setRenderer(renderer);

    NumberAxis xAxis = (NumberAxis) plot.getDomainAxis();
    if (axis[INDEX] < 0) {
        xAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits(Locale.US));
        xAxis.setLabel(SERIESINDEX_LABEL);
        Range range = getRangeForName(SERIESINDEX_LABEL);
        if (range == null) {
            xAxis.setAutoRange(true);
            xAxis.setAutoRangeStickyZero(false);
            xAxis.setAutoRangeIncludesZero(false);
        } else {
            xAxis.setRange(range, true, false);
        }
    } else {
        xAxis.setLabel(dataTable.getColumnName(axis[INDEX]));
        Range range = getRangeForDimension(axis[INDEX]);
        if (range == null) {
            xAxis.setAutoRange(true);
            xAxis.setAutoRangeStickyZero(false);
            xAxis.setAutoRangeIncludesZero(false);
        } else {
            xAxis.setRange(range, true, false);
        }
    }

    xAxis.setLabelFont(LABEL_FONT_BOLD);
    xAxis.setTickLabelFont(LABEL_FONT);
    xAxis.setVerticalTickLabels(isLabelRotating());

    NumberAxis yAxis = (NumberAxis) plot.getRangeAxis();
    yAxis.setLabel(VALUEAXIS_LABEL);
    yAxis.setStandardTickUnits(NumberAxis.createStandardTickUnits(Locale.US));
    setYAxisRange(yAxis);

    yAxis.setLabelFont(LABEL_FONT_BOLD);
    yAxis.setTickLabelFont(LABEL_FONT);

    return chart;
}

From source file:visualizer.datamining.dataanalysis.CreateLineGraph.java

private JFreeChart createChart(XYDataset xydataset, String title, String xtitle, String ytitle) {
    JFreeChart chart = ChartFactory.createXYLineChart(title, xtitle, ytitle, xydataset,
            PlotOrientation.VERTICAL, true, true, false);

    chart.setBackgroundPaint(Color.WHITE);

    XYPlot xyplot = (XYPlot) chart.getPlot();
    NumberAxis numberaxis = (NumberAxis) xyplot.getRangeAxis();
    numberaxis.setAutoRangeIncludesZero(false);

    xyplot.setDomainGridlinePaint(Color.BLACK);
    xyplot.setRangeGridlinePaint(Color.BLACK);

    xyplot.setOutlinePaint(Color.BLACK);
    xyplot.setOutlineStroke(new BasicStroke(1.0f));
    xyplot.setBackgroundPaint(Color.white);
    xyplot.setDomainCrosshairVisible(true);
    xyplot.setRangeCrosshairVisible(true);

    xyplot.setDrawingSupplier(new DefaultDrawingSupplier(
            new Paint[] { Color.RED, Color.BLUE, Color.GREEN, Color.MAGENTA, Color.CYAN, Color.ORANGE,
                    Color.BLACK, Color.DARK_GRAY, Color.GRAY, Color.LIGHT_GRAY, Color.YELLOW },
            DefaultDrawingSupplier.DEFAULT_OUTLINE_PAINT_SEQUENCE,
            DefaultDrawingSupplier.DEFAULT_STROKE_SEQUENCE,
            DefaultDrawingSupplier.DEFAULT_OUTLINE_STROKE_SEQUENCE,
            DefaultDrawingSupplier.DEFAULT_SHAPE_SEQUENCE));

    XYLineAndShapeRenderer xylineandshaperenderer = (XYLineAndShapeRenderer) xyplot.getRenderer();
    xylineandshaperenderer.setBaseShapesVisible(true);
    xylineandshaperenderer.setBaseShapesFilled(true);
    xylineandshaperenderer.setDrawOutlines(true);

    return chart;
}

From source file:edu.ucla.stat.SOCR.chart.demo.HistogramChartDemo3.java

protected JFreeChart createChart(IntervalXYDataset dataset) {
    JFreeChart chart = ChartFactory.createXYBarChart(chartTitle, domainLabel, true, rangeLabel, dataset,
            PlotOrientation.VERTICAL, false, // !legendPanelOn,
            true, false);/*from   w  w w . ja v  a 2  s .  com*/

    // then customise it a little...
    // chart.addSubtitle(new TextTitle("Source: http://www.amnestyusa.org/abolish/listbyyear.do"));
    chart.setBackgroundPaint(Color.white);

    XYPlot plot = chart.getXYPlot();
    plot.setRenderer(new ClusteredXYBarRenderer());
    XYItemRenderer renderer = plot.getRenderer();

    StandardXYToolTipGenerator generator = new StandardXYToolTipGenerator("{1} = {2}",
            new SimpleDateFormat("yyyy"), new DecimalFormat("0"));
    renderer.setBaseToolTipGenerator(generator);
    renderer.setLegendItemLabelGenerator(new SOCRXYSeriesLabelGenerator());

    plot.setBackgroundPaint(Color.lightGray);
    plot.setRangeGridlinePaint(Color.white);

    DateAxis axis = (DateAxis) plot.getDomainAxis();
    axis.setTickMarkPosition(DateTickMarkPosition.MIDDLE);
    axis.setLowerMargin(0.01);
    axis.setUpperMargin(0.01);
    //      setXSummary(dataset);  X  is time
    return chart;
}

From source file:org.eumetsat.metop.visat.SounderInfoView.java

protected void configureSpectrumPlot(XYPlot plot) {
    plot.setBackgroundPaint(Color.lightGray);
    plot.setAxisOffset(new RectangleInsets(5.0, 5.0, 5.0, 5.0));
    plot.setDomainGridlinePaint(Color.white);
    plot.setRangeGridlinePaint(Color.white);

    plot.setDomainCrosshairVisible(true);
    plot.setDomainCrosshairLockedOnData(true);
    plot.setRangeCrosshairVisible(false);
    plot.setNoDataMessage(NO_IFOV_SELECTED);
}

From source file:playground.dgrether.analysis.categoryhistogram.CategoryHistogramWriter.java

public JFreeChart getGraphic(final CategoryHistogram histo, final String modeName) {
    this.checkIndex(histo);
    final XYSeriesCollection xyData = new XYSeriesCollection();
    final XYSeries departuresSerie = new XYSeries(this.departuresName, false, true);
    final XYSeries arrivalsSerie = new XYSeries(this.arrivalsName, false, true);
    final XYSeries onRouteSerie = new XYSeries(this.enRouteName, false, true);
    Integer enRoute = 0;/*from   www. ja  v a 2s.c  o m*/
    for (int i = histo.getFirstIndex() - 2; i <= histo.getLastIndex() + 2; i++) {
        int departures = histo.getDepartures(modeName, i);
        int arrivals = histo.getArrivals(modeName, i);
        int stuck = histo.getAbort(modeName, i);
        enRoute = enRoute + departures - arrivals - stuck;
        double hour = i * histo.getBinSizeSeconds() / 60.0 / 60.0;
        departuresSerie.add(hour, departures);
        arrivalsSerie.add(hour, arrivals);
        onRouteSerie.add(hour, enRoute);
    }
    xyData.addSeries(departuresSerie);
    xyData.addSeries(arrivalsSerie);
    xyData.addSeries(onRouteSerie);

    final JFreeChart chart = ChartFactory.createXYStepChart(
            this.title + ", " + modeName + ", " + "it." + histo.getIteration(), "time [h]", yTitle, xyData,
            PlotOrientation.VERTICAL, true, // legend
            false, // tooltips
            false // urls
    );

    XYPlot plot = chart.getXYPlot();

    final CategoryAxis axis1 = new CategoryAxis("hour");
    axis1.setTickLabelFont(new Font("SansSerif", Font.PLAIN, 7));
    plot.setDomainAxis(new NumberAxis("time"));

    plot.getRenderer().setSeriesStroke(0, new BasicStroke(1.0f));
    plot.getRenderer().setSeriesStroke(1, new BasicStroke(1.0f));
    plot.getRenderer().setSeriesStroke(2, new BasicStroke(1.0f));
    plot.setBackgroundPaint(Color.white);
    plot.setRangeGridlinePaint(Color.gray);
    plot.setDomainGridlinePaint(Color.gray);

    return chart;
}

From source file:edu.unibonn.kmeans.mapreduce.plotting.TimeSeriesPlotter_KMeans.java

/**
  * Creates a chart./*from ww w.jav  a  2  s.c  o  m*/
  * 
  * @param dataset  a dataset.
 * @param clusters 
  * 
  * @return A chart.
  */
//    private JFreeChart createChart(final XYDataset dataset, ArrayList<Cluster_DBScan> clusters) {
//
//        final JFreeChart chart = ChartFactory.createTimeSeriesChart(
//            "Sensors",
//            "Time", "Erlang",
//            dataset,
//            false, //t
//            true, //t
//            false //f
//        );
//
//        ChartUtilities.applyCurrentTheme(chart);
//        
//        //chart.setBackgroundPaint(Color.white);
//
////        final StandardLegend sl = (StandardLegend) chart.getLegend();
////        sl.setDisplaySeriesShapes(true);
//
//        final XYPlot plot = chart.getXYPlot();
//        plot.setBackgroundPaint(Color.WHITE);
//        plot.setDomainGridlinePaint(Color.white);
//        plot.setRangeGridlinePaint(Color.white);
////        plot.setAxisOffset(new Spacer(Spacer.ABSOLUTE, 5.0, 5.0, 5.0, 5.0));
//        plot.setDomainCrosshairVisible(true);
//        plot.setRangeCrosshairVisible(true);
//        
//        final XYItemRenderer renderer = plot.getRenderer();
//        
//        if (renderer instanceof StandardXYItemRenderer) 
//        {
//            final StandardXYItemRenderer rr = (StandardXYItemRenderer) renderer;
//            //rr.setPlotShapes(true);
//            rr.setShapesFilled(true);
//            rr.setItemLabelsVisible(true);
//        }
//
//        int temp_count = 0;
//        
//        //for (int i = 0; i < clusters.size(); i++)
//        for (int i = 0; (i < 11) && (i < clusters.size()); i++)
//      {
//         Cluster_DBScan current_cluster = clusters.get(i);   
//         ArrayList<Day_24d> member_time_series = current_cluster.getMembership();
//         
//         for (int j = 0; j < member_time_series.size(); j++)
//         {
//            renderer.setSeriesPaint(j+temp_count, getColor(i));
//         }
//         temp_count = temp_count + member_time_series.size();
//      }
//        
//        final DateAxis axis = (DateAxis) plot.getDomainAxis();    
//        axis.setDateFormatOverride(new SimpleDateFormat("HH:mm"));
//        
//        final ValueAxis axis_y = plot.getRangeAxis();
//        axis_y.setRange(0, 100);
//        
//        return chart;
//
//    }

private JFreeChart createChart(final XYDataset dataset, final XYDataset dataset_centroids,
        ArrayList<Cluster_KMeans> clusters) {
    final JFreeChart chart = ChartFactory.createTimeSeriesChart("Sensors", "Time", "Erlang", dataset, false, //t
            true, //t
            false //f
    );

    ChartUtilities.applyCurrentTheme(chart);

    //chart.setBackgroundPaint(Color.white);

    //        final StandardLegend sl = (StandardLegend) chart.getLegend();
    //        sl.setDisplaySeriesShapes(true);

    final XYPlot plot = chart.getXYPlot();
    plot.setBackgroundPaint(Color.WHITE);
    plot.setDomainGridlinePaint(Color.white);
    plot.setRangeGridlinePaint(Color.white);
    //        plot.setAxisOffset(new Spacer(Spacer.ABSOLUTE, 5.0, 5.0, 5.0, 5.0));
    plot.setDomainCrosshairVisible(true);
    plot.setRangeCrosshairVisible(true);

    final XYItemRenderer renderer = plot.getRenderer();

    if (renderer instanceof StandardXYItemRenderer) {
        final StandardXYItemRenderer rr = (StandardXYItemRenderer) renderer;
        //rr.setPlotShapes(true);
        rr.setShapesFilled(true);
        rr.setItemLabelsVisible(true);
    }

    int temp_count = 0;

    //for (int i = 0; i < clusters.size(); i++)
    for (int i = 0; (i < 11) && (i < clusters.size()); i++) {
        Cluster_KMeans current_cluster = clusters.get(i);
        ArrayList<Day_24d> member_time_series = current_cluster.getMembership();

        for (int j = 0; j < member_time_series.size(); j++) {
            renderer.setSeriesPaint(j + temp_count, getColor(i));
        }
        temp_count = temp_count + member_time_series.size();
    }

    final DateAxis axis = (DateAxis) plot.getDomainAxis();
    axis.setDateFormatOverride(new SimpleDateFormat("HH:mm"));

    //final ValueAxis axis_y = plot.getRangeAxis();
    //axis_y.setRange(0, 20);

    plot.setDataset(1, dataset_centroids);
    plot.setRenderer(1, new StandardXYItemRenderer());

    for (int i = 0; (i < clusters.size()); i++) {
        //plot.getRenderer(1).setSeriesPaint(i, getColor(i));
        plot.getRenderer(1).setSeriesPaint(i, Color.BLACK);
        plot.getRenderer(1).setSeriesStroke(i, new BasicStroke(3.0f, BasicStroke.CAP_ROUND,
                BasicStroke.JOIN_ROUND, 1.0f, new float[] { 10.0f, 6.0f }, 0.0f));
    }

    plot.setDatasetRenderingOrder(DatasetRenderingOrder.FORWARD);

    return chart;
}