Example usage for org.jfree.chart.axis ValueAxis setTickLabelFont

List of usage examples for org.jfree.chart.axis ValueAxis setTickLabelFont

Introduction

In this page you can find the example usage for org.jfree.chart.axis ValueAxis setTickLabelFont.

Prototype

public void setTickLabelFont(Font font) 

Source Link

Document

Sets the font for the tick labels and sends an AxisChangeEvent to all registered listeners.

Usage

From source file:de.aidger.view.utils.Charts.java

/**
 * Creates a xy area chart./*www  .ja v a  2  s. c  o  m*/
 * 
 * @param title
 *            the diagram title
 * @param dataset
 *            the dataset.
 * @param width
 *            the width of the chart as image
 * @param height
 *            the height of the chart as image
 * @return the xy area chart as image
 */
public static ImageIcon createXYAreaChart(String title, XYDataset dataset, int width, int height) {
    JFreeChart chart = ChartFactory.createXYAreaChart(title, "", "", dataset, PlotOrientation.VERTICAL, false,
            false, false);

    Font titleFont = UIManager.getFont("TitledBorder.font");

    chart.setBackgroundPaint(null);
    chart.getTitle().setFont(new Font(titleFont.getName(), titleFont.getStyle(), 14));
    chart.getTitle().setPaint(UIManager.getColor("TitledBorder.titleColor"));
    chart.setBorderPaint(null);

    XYPlot plot = chart.getXYPlot();
    plot.setInsets(new RectangleInsets(10, 1, 5, 1));
    plot.setBackgroundPaint(null);
    plot.setOutlineVisible(false);
    plot.setNoDataMessage(_("No data to display."));

    ValueAxis domainAxis = new DateAxis();
    domainAxis.setLowerMargin(0.0);
    domainAxis.setUpperMargin(0.0);
    domainAxis.setTickLabelFont(UIManager.getFont("RootPane.font"));

    ValueAxis rangeAxis = new NumberAxis();
    rangeAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits());

    plot.setDomainAxis(domainAxis);
    plot.setRangeAxis(rangeAxis);

    plot.setForegroundAlpha(0.5f);

    return new ImageIcon(chart.createBufferedImage(width, height));
}

From source file:unalcol.termites.boxplots.SucessfulRatesGlobal.java

private static JFreeChart createChart(CategoryDataset categorydataset, ArrayList<Double> pf) {
    JFreeChart jfreechart = ChartFactory.createBarChart("Success Rates - " + getTitle(pf), "", "",
            categorydataset, PlotOrientation.VERTICAL, true, true, false);
    jfreechart.getTitle().setFont(new Font("Sans-Serif", Font.PLAIN, 18));
    jfreechart.setBackgroundPaint(new Color(221, 223, 238));
    CategoryPlot categoryplot = (CategoryPlot) jfreechart.getPlot();
    categoryplot.setBackgroundPaint(Color.white);
    categoryplot.setDomainGridlinePaint(Color.white);
    categoryplot.setRangeGridlinePaint(Color.gray);
    categoryplot.setRangeAxisLocation(AxisLocation.BOTTOM_OR_LEFT);

    BarRenderer renderer = (BarRenderer) categoryplot.getRenderer();
    //categoryplot.setBackgroundPaint(new Color(221, 223, 238));

    renderer.setSeriesPaint(0, new Color(130, 165, 70));
    renderer.setSeriesPaint(1, new Color(220, 165, 70));
    renderer.setSeriesPaint(4, new Color(255, 165, 70));
    renderer.setDrawBarOutline(false);/*from   w  ww .  jav a 2 s . co  m*/
    renderer.setShadowVisible(false);
    // renderer.setMaximumBarWidth(1);
    renderer.setGradientPaintTransformer(null);
    renderer.setDefaultBarPainter(new StandardBarPainter());

    categoryplot.setRenderer(renderer);

    NumberAxis numberaxis = (NumberAxis) categoryplot.getRangeAxis();
    numberaxis.setUpperMargin(0.25D);
    CategoryItemRenderer categoryitemrenderer = categoryplot.getRenderer();
    categoryitemrenderer.setBaseItemLabelsVisible(true);
    categoryitemrenderer.setBaseItemLabelGenerator(new LabelGenerator(null));
    numberaxis.setRange(0, 100);
    //numberaxis.setNumberFormatOverride(NumberFormat.getPercentInstance());

    Font font = new Font("SansSerif", Font.ROMAN_BASELINE, 12);
    numberaxis.setTickLabelFont(font);
    CategoryAxis axisd = categoryplot.getDomainAxis();
    ValueAxis axisr = categoryplot.getRangeAxis();
    axisd.setTickLabelFont(font);
    axisr.setTickLabelFont(font);

    final ChartPanel chartPanel = new ChartPanel(jfreechart);
    chartPanel.setPreferredSize(new java.awt.Dimension(650, 370));

    FileOutputStream output;
    try {
        output = new FileOutputStream("successGlobalRates" + pf + ".jpg");
        ChartUtilities.writeChartAsJPEG(output, 1.0f, jfreechart, 650, 370, null);
    } catch (FileNotFoundException ex) {
        Logger.getLogger(MessagesSent1.class.getName()).log(Level.SEVERE, null, ex);
    } catch (IOException ex) {
        Logger.getLogger(MessagesSent1.class.getName()).log(Level.SEVERE, null, ex);
    }
    return jfreechart;
}

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

private static JFreeChart createChart(XYDataset dataset) {

    // create the chart...
    JFreeChart chart = ChartFactory.createXYLineChart(null, // chart title
            null, // x axis label
            null, // y axis label
            dataset, // data
            PlotOrientation.VERTICAL, false, // include legend
            true, // tooltips
            false // urls
    );//  w  ww.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);

    ValueAxis valueAxis = plot.getRangeAxis();
    valueAxis.setLabelFont(LABEL_FONT_BOLD);
    valueAxis.setTickLabelFont(LABEL_FONT);

    return chart;
}

From source file:unalcol.termites.boxplots.SucessfulRatesHybrid.java

private static JFreeChart createChart(CategoryDataset categorydataset, ArrayList<Double> pf) {
    JFreeChart jfreechart = ChartFactory.createBarChart("Success Rates - " + getTitle(pf), "", "",
            categorydataset, PlotOrientation.VERTICAL, true, true, false);
    jfreechart.getTitle().setFont(new Font("Sans-Serif", Font.PLAIN, 18));
    jfreechart.setBackgroundPaint(new Color(221, 223, 238));
    CategoryPlot categoryplot = (CategoryPlot) jfreechart.getPlot();
    categoryplot.setBackgroundPaint(Color.white);
    categoryplot.setDomainGridlinePaint(Color.white);
    categoryplot.setRangeGridlinePaint(Color.gray);
    categoryplot.setRangeAxisLocation(AxisLocation.BOTTOM_OR_LEFT);

    BarRenderer renderer = (BarRenderer) categoryplot.getRenderer();
    //categoryplot.setBackgroundPaint(new Color(221, 223, 238));

    renderer.setSeriesPaint(0, new Color(130, 165, 70));
    renderer.setSeriesPaint(1, new Color(220, 165, 70));
    renderer.setSeriesPaint(4, new Color(255, 165, 70));
    renderer.setDrawBarOutline(false);/*www  . ja  va  2 s.  c o m*/
    renderer.setShadowVisible(false);
    // renderer.setMaximumBarWidth(1);
    renderer.setGradientPaintTransformer(null);
    renderer.setDefaultBarPainter(new StandardBarPainter());

    categoryplot.setRenderer(renderer);

    NumberAxis numberaxis = (NumberAxis) categoryplot.getRangeAxis();
    numberaxis.setUpperMargin(0.25D);
    CategoryItemRenderer categoryitemrenderer = categoryplot.getRenderer();
    categoryitemrenderer.setBaseItemLabelsVisible(true);
    categoryitemrenderer.setBaseItemLabelGenerator(new LabelGenerator(null));
    numberaxis.setRange(0, 100);
    //numberaxis.setNumberFormatOverride(NumberFormat.getPercentInstance());

    Font font = new Font("SansSerif", Font.ROMAN_BASELINE, 12);
    numberaxis.setTickLabelFont(font);
    CategoryAxis axisd = categoryplot.getDomainAxis();
    ValueAxis axisr = categoryplot.getRangeAxis();
    axisd.setTickLabelFont(font);
    axisr.setTickLabelFont(font);

    axisd.setMaximumCategoryLabelLines(5);

    final ChartPanel chartPanel = new ChartPanel(jfreechart);
    chartPanel.setPreferredSize(new java.awt.Dimension(1300, 370));

    FileOutputStream output;
    try {
        output = new FileOutputStream("sucessrates1" + pf + ".jpg");
        ChartUtilities.writeChartAsJPEG(output, 1.0f, jfreechart, 1300, 370, null);
    } catch (FileNotFoundException ex) {
        Logger.getLogger(MessagesSent1.class.getName()).log(Level.SEVERE, null, ex);
    } catch (IOException ex) {
        Logger.getLogger(MessagesSent1.class.getName()).log(Level.SEVERE, null, ex);
    }
    return jfreechart;
}

From source file:com.hmsinc.epicenter.webapp.chart.ChartService.java

/**
 * @param adapter//  w  ww .  j  a  v  a  2s. co m
 * @param annotations
 * @return
 */
private static JFreeChart createChart(final AbstractChart adapter, final List<XYAnnotation> annotations) {

    final JFreeChart chart;
    if (adapter.getItems() instanceof XYDataset) {

        chart = ChartFactory.createTimeSeriesChart(adapter.getTitle(), adapter.getXLabel(), adapter.getYLabel(),
                (XYDataset) adapter.getItems(), true, false, false);
        final ValueAxis domainAxis = new DateAxis();
        domainAxis.setLabelFont(LABEL_FONT);
        domainAxis.setTickLabelFont(LABEL_FONT);
        domainAxis.setLowerMargin(0.0);
        domainAxis.setUpperMargin(0.0);

        chart.getXYPlot().setDomainAxis(domainAxis);
        chart.getXYPlot().getRangeAxis().setLabelFont(LABEL_FONT);
        chart.getXYPlot().getRangeAxis().setTickLabelFont(LABEL_FONT);
        chart.getXYPlot().getRangeAxis().setStandardTickUnits(adapter.getRangeTickUnits());

        if (adapter.isAlwaysScaleFromZero()) {
            final double upperBound = chart.getXYPlot().getRangeAxis().getRange().getUpperBound();
            final Range range = new Range(0, upperBound + (upperBound * 0.2));
            chart.getXYPlot().getRangeAxis().setRange(range);
        }

        for (Marker marker : adapter.getMarkers()) {
            chart.getXYPlot().addDomainMarker(marker);
        }

        if (annotations != null) {
            for (XYAnnotation annotation : annotations) {
                if (annotation instanceof XYPointerAnnotation) {
                    ((XYPointerAnnotation) annotation).setFont(ANNOTATION_FONT);
                }
                chart.getXYPlot().addAnnotation(annotation);
            }
        }

        // Add any bands to the chart
        if (adapter instanceof TimeSeriesChart) {
            final TimeSeriesChart tsc = (TimeSeriesChart) adapter;
            for (int i = 0; i < tsc.getBands().size(); i++) {

                final Color c = tsc.getBandColors().get(i);
                final Color fill = tsc.getBandFillColors().get(i);
                final XYDifferenceRenderer renderer = new XYDifferenceRenderer(fill, fill, false);
                renderer.setSeriesPaint(0, c);
                renderer.setSeriesPaint(1, c);
                renderer.setSeriesStroke(0, LineStyle.THICK.getStroke());
                renderer.setSeriesStroke(1, LineStyle.THICK.getStroke());

                chart.getXYPlot().setDataset(i + 1, tsc.getBands().get(i));
                chart.getXYPlot().setRenderer(i + 1, renderer);
            }
        }

    } else if (adapter.getItems() instanceof CategoryDataset) {

        chart = ChartFactory.createBarChart(adapter.getTitle(), adapter.getXLabel(), adapter.getYLabel(),
                (CategoryDataset) adapter.getItems(), PlotOrientation.VERTICAL, true, false, false);
        chart.getCategoryPlot().getDomainAxis().setLabelFont(LABEL_FONT);
        chart.getCategoryPlot().getRangeAxis().setLabelFont(LABEL_FONT);
        chart.getCategoryPlot().getDomainAxis().setTickLabelFont(LABEL_FONT);
        chart.getCategoryPlot().getRangeAxis().setTickLabelFont(LABEL_FONT);

        if (adapter.isAlwaysScaleFromZero()) {
            final double upperBound = chart.getCategoryPlot().getRangeAxis().getRange().getUpperBound();
            final Range range = new Range(0, upperBound + (upperBound * 0.1));
            chart.getCategoryPlot().getRangeAxis().setRange(range);
        }

    } else {
        throw new UnsupportedOperationException("Unsupported chart type: " + adapter.getItems().getClass());
    }

    chart.getPlot().setNoDataMessage(NO_DATA_MESSAGE);

    return chart;
}

From source file:unalcol.termites.boxplots.SucessfulRates.java

private static JFreeChart createChart(CategoryDataset categorydataset, ArrayList<Double> pf) {
    JFreeChart jfreechart = ChartFactory.createBarChart("Success Rates - " + getTitle(pf), "", "",
            categorydataset, PlotOrientation.VERTICAL, true, true, false);
    jfreechart.getTitle().setFont(new Font("Sans-Serif", Font.PLAIN, 18));
    jfreechart.setBackgroundPaint(new Color(221, 223, 238));
    CategoryPlot categoryplot = (CategoryPlot) jfreechart.getPlot();
    categoryplot.setBackgroundPaint(Color.white);
    categoryplot.setDomainGridlinePaint(Color.white);
    categoryplot.setRangeGridlinePaint(Color.gray);
    categoryplot.setRangeAxisLocation(AxisLocation.BOTTOM_OR_LEFT);

    BarRenderer renderer = (BarRenderer) categoryplot.getRenderer();
    //categoryplot.setBackgroundPaint(new Color(221, 223, 238));

    renderer.setSeriesPaint(0, new Color(130, 165, 70));
    renderer.setSeriesPaint(1, new Color(220, 165, 70));
    renderer.setSeriesPaint(4, new Color(255, 165, 70));
    renderer.setDrawBarOutline(false);//from   w  w  w. j av a2 s.  c o  m
    renderer.setShadowVisible(false);
    // renderer.setMaximumBarWidth(1);
    renderer.setGradientPaintTransformer(null);
    renderer.setDefaultBarPainter(new StandardBarPainter());

    categoryplot.setRenderer(renderer);

    NumberAxis numberaxis = (NumberAxis) categoryplot.getRangeAxis();
    numberaxis.setUpperMargin(0.25D);
    CategoryItemRenderer categoryitemrenderer = categoryplot.getRenderer();
    categoryitemrenderer.setBaseItemLabelsVisible(true);
    categoryitemrenderer.setBaseItemLabelGenerator(new LabelGenerator(null));
    numberaxis.setRange(0, 100);
    //numberaxis.setNumberFormatOverride(NumberFormat.getPercentInstance());

    Font font = new Font("SansSerif", Font.ROMAN_BASELINE, 12);
    numberaxis.setTickLabelFont(font);
    CategoryAxis axisd = categoryplot.getDomainAxis();
    ValueAxis axisr = categoryplot.getRangeAxis();
    axisd.setTickLabelFont(font);
    axisr.setTickLabelFont(font);

    final ChartPanel chartPanel = new ChartPanel(jfreechart);
    chartPanel.setPreferredSize(new java.awt.Dimension(650, 370));

    FileOutputStream output;
    try {
        output = new FileOutputStream("sucessrates1" + pf + mazeMode + ".jpg");
        ChartUtilities.writeChartAsJPEG(output, 1.0f, jfreechart, 650, 370, null);
    } catch (FileNotFoundException ex) {
        Logger.getLogger(MessagesSent1.class.getName()).log(Level.SEVERE, null, ex);
    } catch (IOException ex) {
        Logger.getLogger(MessagesSent1.class.getName()).log(Level.SEVERE, null, ex);
    }
    return jfreechart;
}

From source file:net.sf.jsfcomp.chartcreator.utils.ChartAxisUtils.java

public static void createXYSeriesAxis(JFreeChart chart, ChartAxisData chartAxisData, int axisIndex) {
    ValueAxis axis = null;
    if (chartAxisData.getType() != null) {
        if (chartAxisData.getType().equals("number"))
            axis = createNumberAxis(chart, chartAxisData);
        else if (chartAxisData.getType().equals("date"))
            axis = createDateAxis(chart, chartAxisData);

        if (chartAxisData.getTickLabelFontSize() > 0) {
            Font tickFont = CategoryAxis.DEFAULT_TICK_LABEL_FONT
                    .deriveFont(chartAxisData.getTickLabelFontSize());
            axis.setTickLabelFont(tickFont);
        }/*from ww w.  j  a  v a  2 s.  co  m*/

        axis.setTickLabelsVisible(chartAxisData.isTickLabels());
        axis.setTickMarksVisible(chartAxisData.isTickMarks());
        axis.setVerticalTickLabels(chartAxisData.isVerticalTickLabels());
    }

    XYPlot plot = chart.getXYPlot();
    if (chartAxisData.isDomain()) {
        plot.setDomainAxis(plot.getDomainAxisCount() - 1, axis);
    } else {
        plot.setRangeAxis(axisIndex, axis);
        XYDataset dataset = (XYDataset) chartAxisData.getDatasource();
        plot.setRenderer(axisIndex, new StandardXYItemRenderer());
        plot.setDataset(axisIndex, dataset);
        plot.mapDatasetToRangeAxis(axisIndex, axisIndex);
    }

    setXYSeriesAxisColors(chartAxisData, plot.getRenderer(axisIndex));
}

From source file:msec.org.Tools.java

public static String generateFullDayChart(String filename, OneDayValue[] data, String title) {
    if (data[0].getValues().length != 1440) {
        return "data size invalid";
    }// w ww  .  ja  v a  2 s. com
    if (data.length > 1) {
        if (data[1].getValues() == null || data[1].getValues().length != 1440) {
            return "data 1 invalid";
        }
    }

    XYDataset xydataset = createDataset(data);
    JFreeChart jfreechart = ChartFactory.createTimeSeriesChart(title, "time", "", xydataset, true, true, true);

    try {
        XYPlot xyplot = (XYPlot) jfreechart.getPlot();

        //
        DateAxis dateaxis = (DateAxis) xyplot.getDomainAxis();
        dateaxis.setDateFormatOverride(new SimpleDateFormat("HH:mm"));
        dateaxis.setLabelFont(new Font("", Font.PLAIN, 16)); //
        dateaxis.setLabelPaint(ChartColor.gray);
        dateaxis.setTickLabelFont(new Font("", Font.PLAIN, 16));
        dateaxis.setTickLabelPaint(ChartColor.GRAY);

        GregorianCalendar endgc = (GregorianCalendar) gc.clone();
        endgc.add(GregorianCalendar.DATE, 1);
        dateaxis.setMaximumDate(endgc.getTime());

        dateaxis.setTickMarksVisible(true);
        dateaxis.setTickMarkInsideLength(5);
        dateaxis.setTickUnit(new DateTickUnit(DateTickUnitType.HOUR, 2));
        dateaxis.setVerticalTickLabels(true);
        dateaxis.setLabel("");

        //
        ValueAxis rangeAxis = xyplot.getRangeAxis();//?
        rangeAxis.setLabelFont(new Font("", Font.PLAIN, 16));
        rangeAxis.setLabelPaint(ChartColor.gray);
        rangeAxis.setTickLabelFont(new Font("", Font.PLAIN, 16));
        rangeAxis.setTickLabelPaint(ChartColor.gray);
        rangeAxis.setLowerBound(0);

        //
        jfreechart.getLegend().setItemFont(new Font("", Font.PLAIN, 12));
        jfreechart.getLegend().setItemPaint(ChartColor.gray);
        jfreechart.getLegend().setBorder(0, 0, 0, 0);//

        //
        jfreechart.getTitle().setFont(new Font("", Font.PLAIN, 18));//
        jfreechart.getTitle().setPaint(ChartColor.gray);

        //?
        xyplot.setRangeGridlinePaint(ChartColor.GRAY);
        xyplot.setBackgroundPaint(ChartColor.WHITE);
        xyplot.setOutlinePaint(null);//

        int w = 500;
        int h = 300;

        // ChartUtilities.saveChartAsPNG(new File(filename), jfreechart, w, h);
        ChartUtilities.saveChartAsJPEG(new File(filename), 0.8f, jfreechart, w, h);

        return "success";

    } catch (Exception e) {
        e.printStackTrace();
        return e.getMessage();
    }
}

From source file:msec.org.Tools.java

public static String generateDaysChart(String filename, ArrayList<OneDayValue> data, OneAttrDaysChart chart,
        String title, int duration) {
    if (data.size() == 0) {
        return "data size invalid";
    }/*from   w  w w .j  av a  2 s .  co m*/

    int date = Integer.parseInt(data.get(0).getDate());
    GregorianCalendar startgc = new GregorianCalendar(date / 10000, date % 10000 / 100 - 1, date % 100);

    XYDataset xydataset = createDaysDataset(data, startgc, chart);
    JFreeChart jfreechart = ChartFactory.createTimeSeriesChart(title, "time", "", xydataset, true, true, true);

    try {
        XYPlot xyplot = (XYPlot) jfreechart.getPlot();

        //
        DateAxis dateaxis = (DateAxis) xyplot.getDomainAxis();
        dateaxis.setDateFormatOverride(new SimpleDateFormat("MM/dd"));
        dateaxis.setLabelFont(new Font("", Font.PLAIN, 16)); //
        dateaxis.setLabelPaint(ChartColor.gray);
        dateaxis.setTickLabelFont(new Font("", Font.PLAIN, 16));
        dateaxis.setTickLabelPaint(ChartColor.GRAY);

        dateaxis.setMinimumDate(startgc.getTime());
        GregorianCalendar endgc = (GregorianCalendar) startgc.clone();
        endgc.add(GregorianCalendar.DATE, duration);
        dateaxis.setMaximumDate(endgc.getTime());

        dateaxis.setTickMarksVisible(true);
        dateaxis.setTickMarkInsideLength(5);
        dateaxis.setTickUnit(new DateTickUnit(DateTickUnitType.DAY, 1));
        dateaxis.setVerticalTickLabels(true);
        dateaxis.setLabel("");

        //
        ValueAxis rangeAxis = xyplot.getRangeAxis();//?
        rangeAxis.setLabelFont(new Font("", Font.PLAIN, 16));
        rangeAxis.setLabelPaint(ChartColor.gray);
        rangeAxis.setTickLabelFont(new Font("", Font.PLAIN, 16));
        rangeAxis.setTickLabelPaint(ChartColor.gray);
        rangeAxis.setLowerBound(0);

        //
        jfreechart.getLegend().setItemFont(new Font("", Font.PLAIN, 12));
        jfreechart.getLegend().setItemPaint(ChartColor.gray);
        jfreechart.getLegend().setBorder(0, 0, 0, 0);//

        //
        jfreechart.getTitle().setFont(new Font("", Font.PLAIN, 18));//
        jfreechart.getTitle().setPaint(ChartColor.gray);

        //?
        xyplot.setRangeGridlinePaint(ChartColor.GRAY);
        xyplot.setBackgroundPaint(ChartColor.WHITE);
        xyplot.setOutlinePaint(null);//

        int w = 500;
        int h = 300;

        // ChartUtilities.saveChartAsPNG(new File(filename), jfreechart, w, h);
        ChartUtilities.saveChartAsJPEG(new File(filename), 0.8f, jfreechart, w, h);

        return "success";

    } catch (Exception e) {
        e.printStackTrace();
        return e.getMessage();
    }
}

From source file:com.griddynamics.jagger.reporting.chart.ChartHelper.java

public static JFreeChart createXYChart(String title, XYDataset data, String xLabel, String yLabel,
        int pointRadius, int lineThickness, ColorTheme theme) {
    JFreeChart chart = ChartFactory.createXYLineChart(title, xLabel, yLabel, data, PlotOrientation.VERTICAL,
            true, false, false);//from   ww  w .ja  v  a  2  s  . co m

    formatColorTheme(chart, theme);

    XYPlot plot = (XYPlot) chart.getPlot();
    Shape icon = new Ellipse2D.Double(-pointRadius, -pointRadius, pointRadius * 2, pointRadius * 2);

    XYLineAndShapeRenderer renderer = new XYLineAndShapeRenderer();
    plot.setRenderer(renderer);

    Color[] colors = generateJetSpectrum(data.getSeriesCount());
    for (int i = 0; i < data.getSeriesCount(); i++) {
        plot.getRenderer().setSeriesStroke(i, new BasicStroke(lineThickness));
        plot.getRenderer().setSeriesShape(i, icon);
        ((XYLineAndShapeRenderer) plot.getRenderer()).setSeriesShapesVisible(i, true);
        ((XYLineAndShapeRenderer) plot.getRenderer()).setSeriesShapesFilled(i, true);
        plot.getRenderer().setSeriesPaint(i, colors[i]);
    }

    LegendTitle legend = chart.getLegend();
    Font legendFont = legend.getItemFont();
    float legendFontSize = legendFont.getSize();
    Font newLegendFont = legendFont.deriveFont(legendFontSize * 0.6f);
    legend.setItemFont(newLegendFont);

    ValueAxis domainAxis = ((XYPlot) chart.getPlot()).getDomainAxis();
    Font domainAxisLabelFont = domainAxis.getLabelFont();
    float domainAxisLabelFontSize = domainAxisLabelFont.getSize();
    domainAxis.setLabelFont(domainAxisLabelFont.deriveFont(domainAxisLabelFontSize * 0.6f));

    Font domainAxisTickLabelFont = domainAxis.getTickLabelFont();
    float domainAxisTickLabelFontSize = domainAxisTickLabelFont.getSize();
    domainAxis.setTickLabelFont(domainAxisTickLabelFont.deriveFont(domainAxisTickLabelFontSize * 0.6f));

    ValueAxis rangeAxis = ((XYPlot) chart.getPlot()).getRangeAxis();
    Font rangeAxisLabelFont = rangeAxis.getLabelFont();
    float rangeAxisLabelFontSize = rangeAxisLabelFont.getSize();
    rangeAxis.setLabelFont(rangeAxisLabelFont.deriveFont(rangeAxisLabelFontSize * 0.6f));

    Font rangeAxisTickLabelFont = rangeAxis.getTickLabelFont();
    float rangeAxisTickLabelFontSize = rangeAxisTickLabelFont.getSize();
    rangeAxis.setTickLabelFont(rangeAxisTickLabelFont.deriveFont(rangeAxisTickLabelFontSize * 0.6f));

    return chart;
}